Help storing a string in a variable

Status
Not open for further replies.

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
I've been stuck trying to store text in a variable. I originally tried doing it directly through the script editor but i messed up the syntax (i'm still really rookie when it comes to Ruby/RGSS3 related things). Since that didn't work, i tried to go for a common event to store the information there and make a switch that turns on when the game begins, but i just can't get it to work. Making a parallel process/autorun switch in my test map or any other map just keep giving zero or freezing the player. Then i tried to fix it by trying to work the swtich through the script editor.

Judging by how this



and this



keep returning errors, how do i set up a switch/variable directly through scripts?

I also tried, just as a test, to set up a test string in a variable and the game crashed and gave me this error



Can anybody tell me what exactly i'm doing wrong here?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You can put a string into a variable using the Control Variables command. The string goes into the Script box at the bottom. You MAY need to put it in quotes - I'm not sure, so give it a try with or without and see if it breaks.


Also check out the beginners' guide link in my signature, as it sounds like you need to learn a bit more about events and triggers.


Create an autorun or parallel process event on your starting map.


Do the Control Variables command to set your variable to a string.


Add a Control Self Switches command to turn self switch A on.


Add a second event page to your event and set its condition (top left, above image) to be Self Switch A = ON. Don't make ANY other changes to this page.
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
I tested ti and your method worked! But will it run every time the game runs or just the first time? Also will this create lag?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Using the self switch and additional page conditioned by the self switch means it will only run once during the game and never again.


And no, it won't cause lag. Why would you think it would? You are telling it to run the first time the map is loaded, and then never again. I assume you've ONLY changed the condition on the second page, and haven't change the trigger of anything else.


Please look at the Starting Point for New Users in my signature, as I already asked you. These tutorials will explain all of this.
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
The beginners page didn't answer my question/. I meant that would it load every time a game is continued, only on the first playthrough and store the variable permanently or only on the first playthrough and leave it blank any time after that? which is my concern. The lag concern was because i'm planning it to load at least 160 variables at once.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
It will run once. Because you give it a second page and you set the conditions so the second page is active, that prevents the first page from running again. Ever.
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
I meant it originally in the sense of "If the game is resumed will the value return to zero since we are no longer in this map" but i tested it (what i should have probably done in the first place) and found out that once set, the value will remain the same.

I guess this has been answered and can be closed.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
If you want your thread closed, please Report your opening post (the Report button is bottom right, near the MultiQuote button) and ask for it to be closed.  The mod for this forum might not see your post, but will see your Report.

Thanks.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
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

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top