I can't seem to get this to work. I'm trying to make a script call execute the Jump To Label Command because I need it to take in a string variable. I looked at the Script Call Spreadsheet and tried implementing what was documented. But it just gave me an error, I'm guessing I don't understand how it works.
MV Calling the Jump To Label Command using a Script Call
Javascript/Plugin SupportWe can't tell you what you did wrong if you don't show us. Provide a screenshot of your event and paste in the code you typed into the Script box (use the CODE tag, </> on the edit bar).
And, of course, show the error - just saying you got one doesn't tell us anything. When the game crashes, press F8 and go to the Console tab, take a screenshot of that.
And, of course, show the error - just saying you got one doesn't tell us anything. When the game crashes, press F8 and go to the Console tab, take a screenshot of that.
I'm sorry, I forgot.
The event code is pretty big, this is the only part of it that is important.
Variable 64 is set to be a string, I use that variable in the script call above to call a Label.
JavaScript:
var self = $gameMap._interpreter;
self._params = ['$gameVariables.value(64)'];
self.command119();
The event code is pretty big, this is the only part of it that is important.
Variable 64 is set to be a string, I use that variable in the script call above to call a Label.
why not use a switch(string) method?
as you case, it can take the code there, if not, it either breaks or continue.
if there is a match, it breaks the code there
so you dont need a jump to label that way.
if this is inside the editor, than search the code responsible for jumpToLabel.
not sure if its a plugin you use for it.
as you case, it can take the code there, if not, it either breaks or continue.
if there is a match, it breaks the code there
so you dont need a jump to label that way.
if this is inside the editor, than search the code responsible for jumpToLabel.
not sure if its a plugin you use for it.
You don't need that first line - just replace
self in the other ones with this. And remove the '' quotes on line 2 - you're currently setting the value of that parameter to literally "$gameVariables.value(64)", rather than to "WheelExecute".That would work. I just don't know how to do a switch statement in JS. And no I'm not using a plugin for this.
Ah thank you, that works! It seems I still don't understand JS at all lol.
Quotes (single or double) create strings. So when you type '$gameVariables.value(64)' that's creating a string of those characters, and it tries to jump to a label called "$gameVariables.value(64)" - it doesn't treat that as code to be executed at all.
You don't want that, and you don't have that label.
You want the value of game variable 64, which is already a string. So there's no need for any quotes, that's what the value() method will return when executed as code.
That's a pretty big assumption. Based on the one, singular event command the OP shared, there's no way to know if the structure of his event could work in a switch statement.
Besides which, the big drawback to that idea is you'd have to code everything - it would need to all be one Script box with the switch and all of its commands inside.
you could do something like
which you can set in the variable into a string to jump to the label?
so whatever value you set there, you can use the variable with the string
and it should jump to the label of that name (set in "string")
JavaScript:
this.command119([$gameVariables.value(parseInt(ID))])
so whatever value you set there, you can use the variable with the string
and it should jump to the label of that name (set in "string")
That isn't correct.
1 - command119 doesn't take any arguments, the parameters are set externally on the interpreter.
2 - I don't understand why you'd introduce parseInt() here...where is this string version of ID coming from?
3 - This thread was solved back in post #5, I was just explaining why the original syntax was wrong.
That's MZ syntax, but this thread is about MV. 👋
Looks like the problem has been solved, so~
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/calling-the-jump-to-label-command-using-a-script-call.169624/