Jump to Label

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,159
Reaction score
12,431
First Language
English
Primarily Uses
RMMV
Jump to Label
2018.01.14
by Shaz

Introduction
This plugin provides a more flexible Jump to Label command, where the label can be the result of a formula.

How to use
Add plugin to your js/plugins folder - name must be Shaz_JumpToLabel.js.
Add to plugin manager and set parameter for case sensitivity.
Enter JumpToLabel as a plugin command, followed by the label, which can be the result of a formula.
I suggest adding some sort of catch-all after the plugin command, just in case the label couldn't be found - another JumpT o Label (actual event command) to go back to a previous point, or an Exit Event Processing command.

Example
JumpToLabel $this._mapId - searches for a label with the current map number
JumpToLabel $gameParty.leader().name() - searches for a label with actor names
JumpToLabel $gameVariables.value(3) + $gameVariables.value(4) - searches for a label with the sum of whatever is in variables 3 and 4

Plugin
Download from pastebin
make sure to save it as Shaz_JumpToLabel.js

Credit
- Shaz

Terms
- free for use in commercial games
- do not post elsewhere - link back to this page

Notes
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,289
Reaction score
545
First Language
Portuguese - Br
Primarily Uses
RMMV
Hey there!
I'm just curious what can i do with this plugin. I also use the command Label in a test game that i made. I use it in for of substitute for changing pages of an event. Its not the same thing, but, i'm just curious.
What ideas you have while you are making this plugin?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,159
Reaction score
12,431
First Language
English
Primarily Uses
RMMV
Sure, I'll give you a couple of examples ...

I have two common events that are set up for all maps - one of them runs when you first enter a map, and one of them runs when you're about to exit. They do things like moving events to certain positions, changing the BGM or the screen tint or the weather depending on what's happened in the game. I do a JumpToLabel this._mapId so it goes to the block of code to be run for the current map. If I don't have any commands for the current map, nothing gets executed. Previously I would create individual events on each map to do this, but sometimes it wasn't convenient to put them all in a default location and I'd lose them, and sometimes I'd get confused between all the pages they had, and sometimes I'd have to have more than one on a map. Putting them all in a single common event means there is ONE place where I have to look for them.

Another one I've come across a few times is where I want to do a Show Choices, but my choice options are variable, or if I want to check if a group of conditions are met, but want to do different things depending on which are, and which aren't. Let's say I have a quest to bring an apple, a fish and a puppy to a single NPC, and if I've only brought one thing, they will say I need the other two, and if I've brought two things, they'll say I need the other one. I could do this by using a bucketload of IF tests for all the different combinations, or I could do one IF test for each item, and build a string based on the results of the test (something like Apple if I have the apple, then concatenate Fish if I have the fish, then concatenate Puppy if I have the puppy). Using just 3 tests, I'll end up with Apple, Fish, Puppy, AppleFish, ApplePuppy, FishPuppy, or AppleFishPuppy, and can then do a JumpToLabel with the variable I've built. A 3-way check may not be so bad, done with conditional branches, but what if you have 5 or 6 items? Gets a lot more complicated and messy then. But I can do it with just the addition of two or three extra tests, appending to the variable for each one. Then I just create one label for each combination with the appropriate commands.
 
Last edited:

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,289
Reaction score
545
First Language
Portuguese - Br
Primarily Uses
RMMV
HHHHMMMMMMM!!!!
Makes sense!! I already have come to this difficult making a lot of conditional branches to chek something. Then this will be come in handy! When i make something i will show here!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Who shares/sells their scripts/plugins on itch.io? Can I pick your brain?
If you ever need fantasy names and you're bored, make a fictional alphabet. Switch around the letters and see what you get :p
I JUST GOT PROMOTED TO 9TH GRADE BOIS!
On a scale of one to I just drew a pineapple with hairy legs how bored are you today?
Everybody else: We want this, this, this, this, this, and this, and don't forget that, plus that.... we need all of it added to the new RM.

Me: Just don't make me learn a new programming language. :kaoback:

Forum statistics

Threads
98,168
Messages
949,905
Members
129,453
Latest member
tanzx
Top