MV MV script calls crashes if trying to restore party




I tried to Memorise Party Members, clear party (which removes all characters including main), then use restore party members where it crashes. It happens in a new game too, so wondering if I'm missing a step here. Using the example (variable 1 for both scripts) would crash too.



I tried to Memorise Party Members, clear party (which removes all characters including main), then use restore party members where it crashes. It happens in a new game too, so wondering if I'm missing a step here. Using the example (variable 1 for both scripts) would crash too.

Can you show me the actual script you've written for this?
Can you show me the actual script you've written for this?
Get syntax error in first step when starting a new project; old project crashes at 2nd step.
What's the crash?
It crashes at the step saving variable.

syntax.jpg
yes ast least in the setvalue(1

needs the ) behind the 1)
so
setvalue(1)

i havnt been awake long it may take more than that
yes ast least in the setvalue(1

needs the ) behind the 1)
so
setvalue(1)

i havnt been awake long it may take more than that

I've tried and it either crashes or the variable ends up as 0 when asked.

If simply copying the example the script page has then add ) to make that line look like
setvalue(1),
it would crash with the same error.

If I remove the ); in the end , it no longer crashes but when asked in text, variable 1 gets 0 as result.
yes ast least in the setvalue(1

needs the ) behind the 1)
so
setvalue(1)

i havnt been awake long it may take more than that
This is incorrect. $gameVariables.setValue(x, y) needs the id x of the variable and the value y to set. You can't cut off the value and expect it to work.

There is actually an error in the example provided in the script call spreadsheet.
In the spreadsheet the code looks like this:
JavaScript:
// Save
$gameVariables.setValue(id,
  $gameParty.members().map(function(actor) {
    return actor.actorId();
  });
);

However the ; in the second to last line ends the statement prematurely. The last ); get treated as their own second statement after the first. That is why the first statement is missing its closing ).

The following should work as intended:
JavaScript:
// Save
$gameVariables.setValue(id,
  $gameParty.members().map(function(actor) {
    return actor.actorId();
  })
);
This is incorrect. $gameVariables.setValue(x, y) needs the id x of the variable and the value y to set. You can't cut off the value and expect it to work.

There is actually an error in the example provided in the script call spreadsheet.
In the spreadsheet the code looks like this:
JavaScript:
// Save
$gameVariables.setValue(id,
  $gameParty.members().map(function(actor) {
    return actor.actorId();
  });
);

However the ; in the second to last line ends the statement prematurely. The last ); get treated as their own second statement after the first. That is why the first statement is missing its closing ).

The following should work as intended:
JavaScript:
// Save
$gameVariables.setValue(id,
  $gameParty.members().map(function(actor) {
    return actor.actorId();
  })
);
Now the script's working like intended, thank you.
😅 Oops. The sheet has been corrected, cheers!

Original thread: https://forums.rpgmakerweb.com/threads/mv-script-calls-crashes-if-trying-to-restore-party.156496/