So i have a name stored into a variable. Lets say "Tomato" in variable 1.
I am able to store part of it in variable 2 with $gameVariables.value(1)[0] and another in var 3 with $gameVariables.value(1)[3].
when i call var 2 and 3 in text it says ta.
However when i put a number in variable 1 it doesnt work. Why is that and how can i change it?
Edit: How do i turn the number set in variable 1 to a String? Its the thing i was trying to do beforehand be cant remember
Showing part of a variable(numbers)
● ARCHIVED · READ-ONLY
-
-
I imagine it would work like that if you changed the number into a string?
-
You can enclose the number in "" so that it saves as a string instead
$gameVariables.set(index,"number")
so for example
$gameVariables.set(1,"500") -
Well ive got as far now as:
var i = $gameVariables.value(1) + "";
$gameVariables.setValue(1, i);
------------------------------------------
By doing(var1 is 12345):
$gameVariables.value(1)[0]
$gameVariables.value(1)[1]
Allows me to do what i set out to do.
By storing:
($gameVariables.value(1)[0] + $gameVariables.value(1)[1])
inside variable 4 says thats 12 is inside it.
So my next question: How do i turn the now text: 12 into a actual number again? -
Number(stufftochangetonumber) does that :) e.g. Number($gameVariables.value(1)). So you can use it as a Script>Control Variable or simply within your scripting block. Whatever is easiest.
and String(stufftochangetostring) works the same, for reference. -
Solved it. Thx both of you.