I found a solution on one of my major issues I had, while I was thinking of implementing an idea into an actual game.
Here goes the solution on the thread I opened for your reference:
forums.rpgmakerweb.com
So far I know:
Still using Script Event Command:
Yes we can do this!
Control Variables 1, 2 and 5 get value using the Script option.
◆Control Variables:#0001 = [2,2,3]
◆Control Variables:#0020 = 2
◆Script:$gameVariables.value(1)[1] = 1;
◆Script:$gameVariables.setValue(2, $gameVariables.value(1)[1]);
◆Script:$gameVariables.setValue($gameVariables.value(20), 'Hello');
◆Control Variables:#0005 = [[1,2,3],[4,5,6],[7,8,9]]
◆Script:$gameVariables.setValue(2, $gameVariables.value(5)[2][1]);
◆Comment:Should return 8 on second row
◆Text:None, Window, Bottom
:Text:\V[1]
:Text:\V[2]
:Text:\V[4]
But this command is really messy. I mean...
◆Control Variables:#0005 = [[1,2,3],[4,5,6],[7,8,9]]
it is kinda bleh!
What if the array has 9001 rows?
So... it seems we can use a multi-line syntax with no problem!
You shall use though a Script Event Command to set the multi dimension Array.
THIS is what you should study, if you wanna play with csv-like data:
◆Control Variables:#0001 = [2,2,3]
◆Control Variables:#0020 = 2
◆Script:$gameVariables.value(1)[1] = 1;
◆Script:$gameVariables.setValue(2, $gameVariables.value(1)[1]);
◆Script:$gameVariables.setValue($gameVariables.value(20), 'Hello');
◆Control Variables:#0005 = [[1,2,3],[4,5,6],[7,8,9]]
◆Script:$gameVariables.setValue(2, $gameVariables.value(5)[2][1]);
◆Comment:Should return 8 on second row
◆Script:$gameVariables.setValue(10, [
: :['Hi!', 'Bye', 'Lie'],
: :['Try','Die','Spy'],
: :['My','Why','Shy']
: :]);
◆Script:$gameVariables.setValue(9, $gameVariables.value(10)[1][0]);
◆Text:None, Window, Bottom
: :\V[1]
: :\V[2]
: : \V[4]
: : \V[9]
◆Comment:4th row should... try!
Moderator note: Opened it for possible questions that may arise.
Here goes the solution on the thread I opened for your reference:
Javascript: I want to turn a csv into an array and play with it.
This is kinda noobish question really. Imagine we got a file at the same folder with the game. Let's say we got a CSV file named ab.csv with a line on it being: STR STR STR STR STR INT INT INT text1, text2, text3, text4, text5, 9, 4, 1 Now imagine 500 lines like that. I want to...
forums.rpgmakerweb.com
So far I know:
- I can set values using script commands.
- I can set as a value a one dimension array.
- I can read values using script commands from normal variables and one dimension arrays.
Still using Script Event Command:
- Can I turn an RPG Maker built in variable into a two dimension array?
- Can I set the data?
- Can I access the data?
- If so, we need a valid example.
Yes we can do this!
Control Variables 1, 2 and 5 get value using the Script option.
◆Control Variables:#0001 = [2,2,3]
◆Control Variables:#0020 = 2
◆Script:$gameVariables.value(1)[1] = 1;
◆Script:$gameVariables.setValue(2, $gameVariables.value(1)[1]);
◆Script:$gameVariables.setValue($gameVariables.value(20), 'Hello');
◆Control Variables:#0005 = [[1,2,3],[4,5,6],[7,8,9]]
◆Script:$gameVariables.setValue(2, $gameVariables.value(5)[2][1]);
◆Comment:Should return 8 on second row
◆Text:None, Window, Bottom
:Text:\V[1]
:Text:\V[2]
:Text:\V[4]
But this command is really messy. I mean...
◆Control Variables:#0005 = [[1,2,3],[4,5,6],[7,8,9]]
it is kinda bleh!
What if the array has 9001 rows?
So... it seems we can use a multi-line syntax with no problem!
You shall use though a Script Event Command to set the multi dimension Array.
THIS is what you should study, if you wanna play with csv-like data:
◆Control Variables:#0001 = [2,2,3]
◆Control Variables:#0020 = 2
◆Script:$gameVariables.value(1)[1] = 1;
◆Script:$gameVariables.setValue(2, $gameVariables.value(1)[1]);
◆Script:$gameVariables.setValue($gameVariables.value(20), 'Hello');
◆Control Variables:#0005 = [[1,2,3],[4,5,6],[7,8,9]]
◆Script:$gameVariables.setValue(2, $gameVariables.value(5)[2][1]);
◆Comment:Should return 8 on second row
◆Script:$gameVariables.setValue(10, [
: :['Hi!', 'Bye', 'Lie'],
: :['Try','Die','Spy'],
: :['My','Why','Shy']
: :]);
◆Script:$gameVariables.setValue(9, $gameVariables.value(10)[1][0]);
◆Text:None, Window, Bottom
: :\V[1]
: :\V[2]
: : \V[4]
: : \V[9]
◆Comment:4th row should... try!
Moderator note: Opened it for possible questions that may arise.