I am using arrays to store some data in order to, hopefully, avoid using multiple variables. I was able to get .indexOf to work, but select and fetch aren't working.
For the purpose of this question, I will provide this example.
Now, I used Array1.indexOf(false) to find the first empty save slot (so I know which save file to save to and can add this playthrough's data to its own array based on that.) this way the third save file is the one the game saves to first using script commands.
What I wanted the select/fetch functions for was to get a list of the indexes in Array1 that return true. (0,1,3) so I can then take that data, compare to the list of other arrays that are made for each save file (1-15) to then grab ArraySF1, ArraySF2, and ArraySF4. I would then check to see if the 2nd index of each of those saves matches a separate variable saved to the current playthrough (something like .value(ArraySF1, [2]) ==Var1?) and build an if statement off of that. Goal would be to narrow the options of save files to load from down to the only viable ones. I just need to figure out how to obtain the indexes of the true values so I can then compare them against my variable list.
Which would theoretically let me create choices after doing an if/then for length of the resulting array. So that I could put \V[3,[0]], \V[3,[1]],etc. in the choice boxes and it display the names of actors from the saves on a different path from player. Which, using the above example, would give the name of actor1 from save file 2 and ask the player if they wanted to use that data for their playthrough.
For the purpose of this question, I will provide this example.
Code:
//Array of save files that have a save in them (false if empty)
Array1 = [1,1,0,1,0,0]
//Array of data contained on (x) save file
ArraySF1 = [Name:John,cc2,path 1]
ArraySF2 = [Name:Jim,cc1,path2]
ArraySF4 = [Name:Kara,cc4,path1]
Now, I used Array1.indexOf(false) to find the first empty save slot (so I know which save file to save to and can add this playthrough's data to its own array based on that.) this way the third save file is the one the game saves to first using script commands.
What I wanted the select/fetch functions for was to get a list of the indexes in Array1 that return true. (0,1,3) so I can then take that data, compare to the list of other arrays that are made for each save file (1-15) to then grab ArraySF1, ArraySF2, and ArraySF4. I would then check to see if the 2nd index of each of those saves matches a separate variable saved to the current playthrough (something like .value(ArraySF1, [2]) ==Var1?) and build an if statement off of that. Goal would be to narrow the options of save files to load from down to the only viable ones. I just need to figure out how to obtain the indexes of the true values so I can then compare them against my variable list.
Code:
Array1.select(true) = [0,1,3]
//My ArraySF starts at 506, so adding it to the indexes gives the proper variable number
$gameVariables.value(Array1.select(true)+506, [2])
//The above would theoretically give me the second index of the arrays matching those numbers
[1,2,1]
//which I could then check.
set Var2($gameVariables.value(Array1.select(true)+506, [2])==Path)
// which would give a true or false of which ones matched.
Var2 = [true,false,true] // or // [1,0,1]
//where I would then use select to find all of the falses. Which would give first index
set Var3($gameVariables.value(Array1.select(true)[Var2.select(false)]+506,[0])
Which would theoretically let me create choices after doing an if/then for length of the resulting array. So that I could put \V[3,[0]], \V[3,[1]],etc. in the choice boxes and it display the names of actors from the saves on a different path from player. Which, using the above example, would give the name of actor1 from save file 2 and ask the player if they wanted to use that data for their playthrough.