Insert string in-game to compare from a list of variables

Status
Not open for further replies.

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
Hi everybody!

This is my first post in this Forum, I wanna specify that I'm Italian so my English is just like ad elementary baby... I'm so sorry about that :(

So, I'm going to present myself in another post later, now I'm in a big trouble (I'm sure you haven't understand what i asked from the title :D): I need to create an Input event for the User and to compare with a list of variables that i've create. So if the Input string is like one of the variables from number 21 to number 40, that's ok, else no...

I've tryied to do it with a Name Input and a script that say
If ($gameActor.actor(4).name()=="\V[21]");
{
($gameSwitches.setValue(02, true);
}

And so I've create a conditional branch that say: If Switch 02 is ON, text "+100J!" else "wrong code!", but when I try to insert the Input Name HCI0501 (that is the 21 Variable value) the game says "Syntax Error"

So, what is the best solution for my needs? Mabye there's another way to have a list of password that I can compare with an Input?

Thanks for the support, if I've not write understandble things you just ask to my....
I'm so glad to be here in RPG MAKER WORLD! :) :) :)
ZEPHIRO
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
14,129
Reaction score
7,795
First Language
English
Primarily Uses
RMMV

I've moved this thread to Javascript/Plugin Support. Please be sure to post your threads in the correct forum next time. Thank you.

 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
\V[21] does only work inside text boxes. But you can use a scriptcall to get the value of a variable instead: $gameVariables.value(21).
 

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
I've tryied to make a conditional branch with a scriptcall like this:

$gameActor.actor(4).name()== $gameVariables.value(21)

But it says "$gameActor not defined"

do I have to do a screenshot for you?
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
It's $gameActors
 

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
IT DOESN'T WORK!!!! :(
It ever say textbox "RIPROVA"
 

Attachments

Last edited:

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
You just need to input 21 not 0021.
 

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
You just need to input 21 not 0021.
It really doesn't work, I've tryied... I'm sure that the variable value is HCI0501 because i've made a textbox with \V[21] and it says right...

WTF I'VE TO DOOOO???? :( :( :(
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,445
Reaction score
12,012
First Language
English
Primarily Uses
RMMV
First thing would be to calm down a bit. Nobody is going to want to help you if you yell at them.

Next thing would be to output the name in a text box as well. Could you change your Show Text command to this:
Name: \N[4]
Variable: \V[21]

and put the Show Text command after the Name Input command.

When you've done that, show us a new screenshot of your event, and a screenshot of the text box when you play the game.

I'm guessing that you either have a space at the start or end of the name or the variable, or they are not the same case - one's upper case and the other isn't.


Also try === instead of ==. JS is a bit funny with this, and I don't fully understand it, but I think one of them is checking to see if they're the same object (occupy the same space in memory, which they don't), and the other is checking to see if they have the same value. I might be wrong on that, and I'm sure someone will say so if that's the case. I always use ===.
 

Tsumio

Business NEET
Member
Joined
Aug 14, 2017
Messages
13
Reaction score
11
First Language
Japanese
Primarily Uses
RMMV
Code:
$gameActors.actor(1).name() === $gameVariables.value(21)
I think this code work.

Hope this reply help !

Edit:
Maybe 'Name' is wrong as @Shaz said(I missed the reply because I am slow to write and understand English.).
So, I edit and add now.
Actor($gameActors) should be started '1' not '0'.
Please confirm actor's number is correct.
If it cause confusion, excuse me !

More Edit:
@Shaz
Very sorry !
I received '\ N [4]' is not '\ V [21]' in program by your comment.
And I thought it is right.
I will read English more carefully.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,445
Reaction score
12,012
First Language
English
Primarily Uses
RMMV
I didn't say Name is wrong. I said maybe they are not the same case.


OP, can you please show where you set the value of the variables that you're comparing the input name to?
 

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
Code:
$gameActors.actor(1).name() === $gameVariables.value(21)
I think this code work.

Hope this reply help !

Edit:
Maybe 'Name' is wrong as @Shaz said(I missed the reply because I am slow to write and understand English.).
So, I edit and add now.
Actor($gameActors) should be started '1' not '0'.
Please confirm actor's number is correct.
If it cause confusion, excuse me !

More Edit:
@Shaz
Very sorry !
I received '\ N [4]' is not '\ V [21]' in program by your comment.
And I thought it is right.
I will read English more carefully.
YOU.... ARE.... MY.... SAVIOR!!!!! Really, really, really thank you...

One last thing:
can I make a code for compare this Input name with multiple variables? I meen:

if the Input name is like one of variables from 21 to 40 is right, else no... without do exacly 20 conditional branch :D

I'm mortified for my really elementary "mood" in english conversation, but I'm trying to be much understandable as I can!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,445
Reaction score
12,012
First Language
English
Primarily Uses
RMMV
You should probably take a step back and explain what you're trying to achieve, and why you are using so many variables. It may be that there's an easier way to do what you want to do.

You've put a lot of emphasis on how you're trying to do something, but haven't actually explained what you're trying to do or why you've chosen to do it in this way.
 

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
You should probably take a step back and explain what you're trying to achieve, and why you are using so many variables. It may be that there's an easier way to do what you want to do.

You've put a lot of emphasis on how you're trying to do something, but haven't actually explained what you're trying to do or why you've chosen to do it in this way.
Basicaly, I've to make a list of many codes (80) and all of this have a different jobs in the game (4 type of jobs, so 20 codes for tipe).
So I need to create an event that ask player to Insert a code and so if in't one of those in the list it proceed to do what is the job type of the Insert code, and when a code will Insert the first time, it will be disabled.

P.s.: I'm a good boy, a promise that <3 (y) :p
 

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
Maybie it will work a concatenate code when i make a variable "count" that start from value 21 and make a value of +1 eighter 40, than compare the insert code eighter there are this count, but when 40 it will exit...

Something like:
$gameActors.actor(1).name() === $gameVariables.value($gameVariables.value("count index"))

Do I have to try?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,445
Reaction score
12,012
First Language
English
Primarily Uses
RMMV
I did not reply because you really didn't explain anything, and I didn't want to play the 20 questions game trying to figure out what you're trying to do. You're still talking about HOW you're trying to achieve things, rather than WHAT and WHY. What is a code? What is a job? What does the code have to do with the job and why does each job have so many codes? Explain it from the player's perspective.

I was hoping someone else would understand what you mean and could continue to assist, as the weekend is nearly over now and my time is limited during the week.
 

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
I don t understand what's the different but... it will work like that
There are 4 type of passwords: first make money + 100, second +200, third +500 and last +1000... for type, there are 20 different password that have to work. So, now? :D
 

ZEPHIRO

ZephiroLand
Member
Joined
Aug 19, 2017
Messages
18
Reaction score
0
First Language
ITALIAN
Primarily Uses
RMMV
Ok it works with the count variable :) this program is stil amazing
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,578
Reaction score
10,916
First Language
English
Primarily Uses
RMVXA

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.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Been averaging 2-3 hours sleep for almost a month now. Starting to space out all the time ^^;
tfw, after your game being intensively played by many people, after 5 years, patch after patch released, suddenly an innocent person reported another bug.
"Never let a sense of morals/
Prevent me from doing what is right"
- Clutch
OMFG. I had typed \fiPhilosophia Hermetica\fi in a forum post and didn't notice it for AN HOUR.

(Anyone else ever catch themselves doing this?)
Stream will be live shortly with a guest stream! Feel free to drop by and listen to whatever weird stories we're telling~

Forum statistics

Threads
94,252
Messages
919,414
Members
123,970
Latest member
TsuruharaYuki
Top