Don't know what you intend to do...
I assume what you mean by "displaying" is showing it on message box?
It's not the variable fault. Even if the value is a number, the variable will adapt (if it's not restricted) so that won't be a problem.
To directly translate an escape code (only work inside window base), replace
"\" with
"\x1b".
ex :
View attachment 151833
Non-window related, use
$gameVariables.value(ID)
Reference:
Hello, I'm having some trouble I'm setting variable 33 with this script: $gameVariables.setValue(33, "Deliver \\C[1]\\v[12]\\fr to \\v[11] in \\v[10]"); Then calling it in a message window with \v[33]. What I am shown in the in-game message window is this: Deliver \C[1]\v[12]\fr to \v[11]...
forums.rpgmakerweb.com
Yeah, well your tips works but it seems it doesn't do what I need....
I hoped to not have to write this whole thing, but...
I have a free input text plugin which can store a string (written by the player) in a variable.
I needed to check dates stored in that variable, but I can't find a way to make javascript check for the dd/mm/yyyy format (it checks only yyyy/mm/dd or mm/dd/yyyy).
So I tried to do a checking date system manually as follow:
Check if the variable(x) which contains the string contains a number ("01" in this case):
Code:
(function(){ words = ["01"]; for(i=0;i<words.length;i++){if(!RegExp("\\b"+words[i]+"\\b").test($gameVariables.value(x).toLowerCase())){break}};if(words.length===i)return!0})()
If yes search for a 4 digit number (year) in that string and store it in another variable (w):
Code:
var year = parseInt($gameVariables.value(x).match(/\d{4}/)[0]);
$gameVariables.setValue(w, (year>=1000 && year <= 9999) ? year : 0);
Count occurences for "01" in the whole string and store that number in another variable (y):
Code:
$gameVariables.setValue(y, ($gameVariables.value(x).match(/01/g) || []).length)
Then I needed to count occurences of that "01" only in var(w) (the year number) and store it in another var(z):
Code:
$gameVariables.setValue(z, ($gameVariables.value(w).match(/01/g) || []).length)
In order to subtract them from the total recurrences number:
var(y) - var(z) = number of "01" occurrences in day and month
Then, checking some other few things, I can tell if that "01" is a day or a month.....
My problem is that I can't get that var(z), it returns always 0 even if the year is "2001"...
I thought the problem was what I wrote in the first post.
This is the whole story.