- Joined
- Sep 16, 2014
- Messages
- 7
- Reaction score
- 3
- First Language
- English
- Primarily Uses
Dear javascript guru,
I write these code in common event but the result is weird;
Script:
$gameVariables.setValue(31,[2,3,4,5,6,7,8,9,10,11,12,13,14,15]);
$gameVariables.setValue(9,$gameVariables.value(31));
var j, temp;
for (i = $gameVariables.value(9).length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1));
temp = $gameVariables.value(9);
$gameVariables.value(9) = $gameVariables.value(9)[j];
$gameVariables.value(9)[j] = temp;
}
Then I check the values of variable 31 and 9 in message
Variable 31 is \V[31]
Variable 9 is \V[9]
The result is same. I mean the "Variable 31" was shuffled, too.
Please help how to retain original value of "Variable 31" while "Variable 9" was shuffled.
I write these code in common event but the result is weird;
Script:
$gameVariables.setValue(31,[2,3,4,5,6,7,8,9,10,11,12,13,14,15]);
$gameVariables.setValue(9,$gameVariables.value(31));
var j, temp;
for (i = $gameVariables.value(9).length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1));
temp = $gameVariables.value(9);
$gameVariables.value(9) = $gameVariables.value(9)[j];
$gameVariables.value(9)[j] = temp;
}
Then I check the values of variable 31 and 9 in message
Variable 31 is \V[31]
Variable 9 is \V[9]
The result is same. I mean the "Variable 31" was shuffled, too.
Please help how to retain original value of "Variable 31" while "Variable 9" was shuffled.
Last edited by a moderator: