- Joined
- Apr 4, 2012
- Messages
- 550
- Reaction score
- 552
- First Language
- Swedish
- Primarily Uses
- RMMZ
I am not exactly sure but my guess would be that since we are doing math equations it will automatically convert it to an integer. Since $gameMessage.add needs a string it will throw a undefined error unless you convert the integer to a string like I did in my example.
As for your next question of adding text you can simple do like this:
var i = Math.floor(Math.random()*(104-18+1)+18);
$gameMessage.add("More text before. " + i +
". More text after.");
Lastly with variables you need to convert it to a string since they are integers from start. Like this:
var j = "Variable value";
$gameVariables.setValue(144, j);
You will see here that we don't need the "String()" because we use the "" quotes instead. Hope that helps
As for your next question of adding text you can simple do like this:
var i = Math.floor(Math.random()*(104-18+1)+18);
$gameMessage.add("More text before. " + i +
". More text after.");
Lastly with variables you need to convert it to a string since they are integers from start. Like this:
var j = "Variable value";
$gameVariables.setValue(144, j);
You will see here that we don't need the "String()" because we use the "" quotes instead. Hope that helps
Last edited by a moderator: