• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Set specific variable

Z

zendraw

Guest
so i have this problem.

i have 2 scripts which do lets say 100 checks to see if a condition is true, and if it is true, set "variable"=1;

now in both scripts, the checks are exactly the same, but the variable that i am setting is diffrent. how do i cut this short and not use 2 scripts.

example:
script 1:
GML:
if (walking on street) {sunny=1};
x100

script 2:
GML:
if (walking on street) {nighty=1};
x100

ofcorse i run the scripts for diffrent situations, but still its the same checks, just diffrent variables.
 
Can't you just return the true or false from the script and set the variable that way? I.e.
Code:
nighty = walking_on_street();
sunny = walking_on_street();
walking_on_street script:
Code:
if (walking_on_street) {
   return true;
}
return false;
 
Z

zendraw

Guest
well no, becouse its an array and im setting diffrent spoits in that array in the scripts, BUT i am very stupid, i just realised i am asking can i acces multiple variables with 1 access point, aka ARRAYs...
so yeah ill just have the diffrent variables as an array...
 
Top