There's no comparison operator in the first conditional Branch's condition. Without a comparison like == or something, it's just asking if the variable exists. Since you have ! in front of it, it's asking if the variable DOESN'T exist.
So for starters, your array isn't getting populated.
As a result, the random number isn't getting assigned. It's basically asking for
Math.randomInt(0)
EDIT: Unless the initial value for Variable 9 is getting set elsewhere before this?
Try
!gameVariables.value(9).length > 0
or > 1
If you want to check for "equal" that is == or ===, using = means you're actually setting a value, not checking it.
The original check doesnt work because actually, gameVariables are being set to zero initial value by default (or more like its forced to return as 0 if it doesnt exist yet), so in essence, it has a length of 1. Your original check was like "if length doesnt exist", since it exists, the condition turns false.
Now that I'm looking again, the first condition is actually fine. It's just checking for the .length property to see if the array has been created yet.
What is this supposed to be doing? Because it looks like its just getting a random number between 1 and 9, but doing it in a roundabout way.
What is your current result?
The check returns false probably because it returns a length of 1. Meaning, the length exists, and the check is "if length does not exist".
When you call the .value function of $gameVariables, the game forces it to return 0 if the variable has not been set yet to avoid error prompts (which can happen if it returns NULL, nil, whatever)... Since the variable is actually returning a value, the length property still counts it, and thus, length exists.
So your suggestion of putting an evaluation for a value (possibly, > 1) should fix it.
Try > 1 instead of 0... because, read previous statement
or maybe, a safer approach is to check if the variable is an array
!Array.isArray($gameVariables.value(9))
Just done so, still won't work...
Check my other suggestion then...
PS: To be sure what is happening with the original code, try putting a script call like this before your conditional
console.log($gameVariables.value(9).length)
Then playtest with the console on and see what value gets printed. That way we can know if the problem lies with the length or not
And yeah, what exactly happens on your tests? Saying it doesnt work is a bit too vague
PS: Wait wait wait
on your setting of var scList, you have set it to $gameVariables.value(9) > 0
Please remove the > 0 in there
What will happen with that code is that it will store either true or false, not the array saved in Variable 9...
The OP was also trying to have a random variable drawn from a finite list once per each variable until the list has no more numbers in it.
As I test I get this kind of window... I don't know what a console is I am sorry feel like a 6 year old right about now...
It says line 665 has an illegal error.. What is line 665 in Yanfly's Passive state?
And does your event have something to do with Yanfly's passive states? Because the error points to Yanfly's Passive States...
Could you have used variable 9 or 1 in Yanfly's plugin? That could be causing the problem
I see, how do I find out where 665 is?