USE RANDOM VAR TO SHOW IMAGE
Posts
Pages:
1
OK, i am stuck!
I know how to show a specific image:'
$gameScreen.showPicture(1, 1, 0, 34, 6, 100, 100, 255, 0);
I know that the second number is the picture name (in this case 1.png)
I have a random variable before the event, but how can i use the variable to trigger any image that has same number as the vari +.png.
I have 1-10.png, and the variabale is 1-10, how can i capture the variable?
BTW, I know that it is possible to use nested if statements, but is it so messy!
Thanks for supporting!
I know how to show a specific image:'
$gameScreen.showPicture(1, 1, 0, 34, 6, 100, 100, 255, 0);
I know that the second number is the picture name (in this case 1.png)
I have a random variable before the event, but how can i use the variable to trigger any image that has same number as the vari +.png.
I have 1-10.png, and the variabale is 1-10, how can i capture the variable?
BTW, I know that it is possible to use nested if statements, but is it so messy!
Thanks for supporting!
If you want that variable be "captured", and if that works the way you say it does, probably the best way is to do it is through a Control Variables event-command to make a game-variable randomized between 1 and 10, and pass it into that function. Which could look like...
...that, if, for instance you're using the game-variable with an id of 1. Though, the precise code could look different, as I'm sorta going off VXAce's data structure in regards to $game_variables. With MV (and this feels like it could be an MV call), it might be "$gameVariables" instead, but, I don't have MV to look it up.
*Edit: I half-wonder if you have to do something like "$gameVariables[1].to_s" (or whatever) for this to work? It's a thought. The value generated by the random number generator would be a numeric data type, and the function might be looking for a string data type instead.
$gameScreen.showPicture(1, $game_variables[1], 0, 34, 6, 100, 100, 255, 0);
...that, if, for instance you're using the game-variable with an id of 1. Though, the precise code could look different, as I'm sorta going off VXAce's data structure in regards to $game_variables. With MV (and this feels like it could be an MV call), it might be "$gameVariables" instead, but, I don't have MV to look it up.
*Edit: I half-wonder if you have to do something like "$gameVariables[1].to_s" (or whatever) for this to work? It's a thought. The value generated by the random number generator would be a numeric data type, and the function might be looking for a string data type instead.
It would be $gameVariables.value(id)
Pages:
1















