Status
Not open for further replies.

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
183
Reaction score
37
First Language
Italian
Primarily Uses
RMMV
hey I'm here again asking for infos:

this is the first common event script call that works well:

function makeid(length) {
var result = '';
var characters = 'LETTERS';
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
return result;
}
word = makeid(Math.randomInt(2)+50);
$gameVariables.setValue(29, word);

then i call a conditional branch: ($gameVariables.value(29).match(/text/g) || []).length > 0



THEN, in another common event:

$gameVariables.value(28).push($gameActors.actor(18).name().toUpperCase())

conditional call: ($gameVariables.value(28).match(/text/g) || []).length > 0


how can the first common call event works and the second no?
in the first call event page maybe the big script interact in some way that I don't understand?

I'm really confused..

this is the error message:" $gameVariables.value(...).match is not a function"
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,351
Reaction score
1,371
First Language
Spanish
Primarily Uses
RMVXA
$gameVariables.value(28) results to be an array, because of .push(val)

by retrieving value(28), you're returning an array, not a string.

print index 28 and double check it.... if it's a string, double check the regex... if not, there's your answer.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,319
Reaction score
5,488
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

It can be frustrating that so many commercial games have used up titles that might otherwise be great for a project.
Light up explosions with QABS and Community Lighting.
qcPQHt9.gif
Doing RPG Maker News #18 | Moghunter is Back, Encrypt MV/MZ Plugins, Isometric Geometric Tiles

Forum statistics

Threads
110,655
Messages
1,054,982
Members
143,778
Latest member
dsdgdsfa
Top