Script Call Support Boards

i need a script call for the conditional branch command that will check that if variables 121 to 124 and 131 to 134 are equal to 0 and variables 125, 135, 145 are equal to 1 or greater. Any tips?
return true if [121,122,123,124,131,132,133,134].all? {|e| $game_variables[e] == 0} && [125,135,145].all? {|e| $game_variables[e] >= 1}
or maybe
return true if [121..124,131..134].all? {|e| $game_variables[e] == 0} && [125,135,145].all? {|e| $game_variables[e] >= 1}

Might work. No idea. I think it is also very long and won't fit.
You might have to call a Game_Interpreter method and put all the coding checks in there.
Oh well it is me again. Is there a way to check whether or not the character has a certain equipment slot filled, rather than a particular item? I need this for conditional branch script call.
Oh well it is me again. Is there a way to check whether or not the character has a certain equipment slot filled, rather than a particular item? I need this for conditional branch script call.
$game_actors[1].equips[0].nil?
$game_actors[1].equips[0].nil?

oh, that was fast. Thank you!
Anyone know how to properly call .each or {|i|...} via Event Commands Script?
After setting up an array
Code:
$game_variables[1]=[1,2,3,4,5,6]
Spoiler: My failed attempts at using the methods
Code:
$game_variables[1].each{|i|i+1}

$game_variables[1].each{|i|i+=1}

$game_variables[1].each{|i|i=1}

$game_variables[1].each{|i|i==1}

$game_variables[1][0..5].each{|i|i+1}

$game_variables[1][0..5].each{|i|i+=1}

$game_variables[1][0..5].each{|i|i=1}

$game_variables[1][0..5].each{|i|i==1}
By failed attempts, I mean that \v[1] returns [1,2,3,4,5,6] before and after any of the second calls. Instead of the intended [2,3,4,5,6,7] or [1,1,1,1,1,1].
I've also tried .foreach/.for_each or .eachof/.each_of, all of which throw undefined method errors.
On a side note, if anyone also knows how to use an if statement in the afore mentioned method that'd be perfect. Eg.
Code:
$game_variables[1].each{|i|if i<3, then i=0}

Edit:
Spoiler: More failed attempts
Code:
$game_variables[1].each{|i|$game_variables[1][i]=1}
Weirdly results in [1,1,3,1,5,1] and not [1,1,1,1,1,1]. Using + or += here throws undefined method, and using == results in [1,2,3,4,5,6].
Edit2: That took hours but I got it,
Code:
$game_variables[1].each_index{|i|$game_variables[1][i]=1}
$game_variables[1].each_index{|i|$game_variables[1][i]+=1}
Now for that if statement.
Edit3: Solved...
Code:
$game_variables[1].each_index{|i|$game_variables[1][i]=0if$game_variables[1][i]>3}
# Although to fit it on one line
# $v = $game_variables
# $v[1].each_index{|i|$v[1][i]=0if$v[1][i]>3}
var = $game_variables[1]
var.each_index{|i|var[i]=0ifvar[i]>3}
In this cases use a local variable:
var = $game_variables[1]
Then you can replace every occurrence o! $game_variables[1] with var.

Why not a $global variable? Because you rarely need such a thing. Most of a time you'd only need the default globals and that's all. Plus you don't need to increase your memory usage for simple things under such circumstances. You keep the globals to a minimum.
Does anyone know how to write set variable to this event's x pos as a script call?
$game_variables[X] = $game_map.events[Y].x

where X is the variable number/ID and Y is the event ID
and Y is the event ID
Sorry the message was written poorly, but what would I substitute Y for to get This_Event (as in, the ID becomes whichever ID from the event the script is called from)
I see. Well, I haven't ever tried that, always just used specific event IDs, but in my notes on script calls, which I collected from all around the net, I found this: "get_character(0) when used in a Script call (not a movement route script call) means "this event""
So, try using get_character(0).x instead of $game_map.events[Y].x. As I said, I haven't tried it, so let us know if it works.
I see. Well, I haven't ever tried that, always just used specific event IDs, but in my notes on script calls, which I collected from all around the net, I found this: "get_character(0) when used in a Script call (not a movement route script call) means "this event""
So, try using get_character(0).x instead of $game_map.events[Y].x. As I said, I haven't tried it, so let us know if it works.
Both options should work. There Y could be replaced with @event_id
so let us know if it works.

Both options should work.
Can confirm, both methods returned the correct x-pos.
Code:
$game_variables[ID]=$game_map.events[@event_id].x
$game_variables[ID]=get_character(0).x
This was used in a common event that in-game spawned events called apon. Although above is heavily simplified since its being used in a RTS.
While writing a large array, I used .each command and some 'template' variables to build it. However later using that array I noticed some bugs and traced them back to here.
When updating Variable[22][2][0] for some reason RM remembers where that script came from and updates that as well, which in turn somehow updates the rest of the .each copies.
I was under the impression that there isn't any auto changing of variables and that everything needs to be defined by the user, so this has majorly confused me.
My guess is that rather than Variable[25]'s value being pushed, "Variable[25]" itself is being pushed... Does anyone know what to change to get the intended result?
My guess is that rather than Variable[25]'s value being pushed, "Variable[25]" itself is being pushed...
correct. Since the way ruby works (and I think other engines) when you tell a variable that it is now equal to another variable, it does not copy the values, it just copies the second variables memory reference. So you could change the second variable and both will change.
I'm not sure how to enforce the copy without a memory reference, I found a piece of code before and it gets fairly (sorta) complicated because using 100 lines of code just to be able to copy variables values is somewhat ridiculous in my opinion.
Some options are
$game_variables[25].clone <- but I believe this is the same as just saying =
$game_variables[25].dup <- might work

otherwise you will need to break the process down a lot more so that each value in the variable is extracted and then added to the new variable
maybe something like
(1..2).each{|i|$game_variables[25].each {|v|$game_variables[22][i].push(v)}}
Thankyou @Roninator2
I wasn't able to wrap my head around this,
Code:
(1..2).each{|i|$game_variables[25].each {|v|$game_variables[22][i].push(v)}}
so after plugging it in as is, it resulted in "Undefined method 'Push' for nil:NilClass"
Edit: Side note, removing [ i] >>> [22].push also resulted in a weird result.

However this worked perfectly!
Code:
(1..2).each{|i|$game_variables[22].push($game_variables[25].dup)}
so after plugging it in as is, it resulted in "Undefined method 'Push' for nil:NilClass"
Edit: Side note, removing [ i] >>> [22].push also resulted in a weird result.
Right that's because the value of $game_variables[22][1] is nil since you made variable 22 equal to [0]
It only has one position (0) 1 and 2 are nil.
Adding in a little extra corrects that by making the position referenced an array.
Ruby:
(1..2).each{|i|$game_variables[25].each {|v| $game_variables[22][i] =
[] if $game_variables[22][i] != [] ; $game_variables[22][i].push(v)}}

And to stop it from overwriting the values if you did this a second time you can do this.
Ruby:
(1..2).each{|i|$game_variables[25].each {|v| $game_variables[22][i] =
[] if !$game_variables[22][i].is_a?(Array) ; $game_variables[22][i].push(v)}}
Keep in mind that the compact method will ignore all nil values... while also changing the values stored in each index. Anyway, why do you need to reference index 2, @Zahawk ? Why didn't you pick another one or got rid of that nil value first?
@kyonides so the script I provided above was a stripped down version of what I'm using it for, since that was the 'bug' I was experiencing. Roninator2 solved that by introducing me to the .dup function.

Anyway the "full" script that I'm using endded up looking like this,
Code:
$game_variables[12]=[0]
$game_variables[15]=[[0,0,0,0],[0,0],[],[0,1],[0,1],[0,0]]
(1..121).each{|i|$game_variables[15][2].push(0)}
(1..90).each{|i|$game_variables[12].push($game_variables[15].dup)}
Which I'm using to hold 90 different arrays of information within v[12].
I first need to put the character's x and y into a variable, and then set a certain event on these x and y.

On MV it looks like this (this line in the sert variable -> script):
$gameVariables.setValue(6,[$gamePlayer.x,$gamePlayer.y])

and this line (in event custom move route -> script):
this.setPosition($gameVariables.value(6)[0],$gameVariables.value(6)[1])

And how to do the same on VXA?

Original thread: https://forums.rpgmakerweb.com/threads/script-call-support-boards.25767/