Calling variables and switches in scripts?

Lemieux

Warper
Member
Joined
Jul 23, 2012
Messages
3
Reaction score
0
First Language
sweden
Primarily Uses
Hello im new to RPG maker and dont know a lot about scripting (though i will try to learn as much as i can)

I have inserted the invader minigame into my project and wanted to have events happen after players

beat high score etc...I also use the pong minigame this is for ACE i might say..

There are variables in invader and switches for pong that are in the scripts for scores Hi score.

I just dont understand because my limited knowledge of scripts how to use

these. What to write etc..

If anyone can answer this i would be eternally grateful..

Im releasing my game in four days so if anyone can help me i would be so happy

Thank you in advance
 
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
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


If you actually need help with the scripts themselves (if you can't get it working on your own), post a link to the scripts you're using so we can find them easily.


I'm not sure what you're struggling with - if you say the switches and variables are already in the scripts, then you have no need to add them to the scripts. If you just want to USE those switches and variables in events, then you use them just the same way you use any other switches and variables - probably in a conditional branch or in event conditions.
 

Lemieux

Warper
Member
Joined
Jul 23, 2012
Messages
3
Reaction score
0
First Language
sweden
Primarily Uses
Script variables are $game_variables[n] and switches are $game_switches[n].  Hope that helps you out some.  In fact, view this thread to learn a lot more about reading the RGSS3 structure of Ace: http://forums.rpgmakerweb.com/index.php?/topic/6248-script-call-equivalent-of-events/
Okay well im a complete newbie to the syntax this is my first project..

 #---------------#

  # OTHER OPTIONS #

  #---------------#

 

  SCORE_VAR = 1         # Variable id to keep track of score

  HIGH_SCORE_VAR = 2    # Variable id to keep track of highest score

 

  RESET_PUP = 130       # Seconds between reset powerup spawns. If the

                        # player manages to get this, the enemy spawn rate is 

                        # reset and has a chance to earn more points!

  RESET_AMOUNT = 0.5    # Ratio of difficulty when reset powerup is obtained

   

  SOUND_TIMER = 5       # Prevent enemy lazor sound spam by increasing this

   

  DESTROY_PUPS = false      # Can destroy powerups true or false

   

  LAZOR_DAMAGE = 1      # Damage done when lazors hit

  COLLIDE_DAMAGE = 4    # Damage done when collide with enemy

 

Is the HIGH SCORE VAR=1 What i should use? how exactly do i write it? correctly? 

 

thank you for all your help!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
Okay well im a complete newbie to the syntax this is my first project..


Is the HIGH SCORE VAR=1 What i should use? how exactly do i write it? correctly? 


thank you for all your help!
Please use the spoiler and code tags for script snippets, they make everything better readable.
You have a few things mixed up...


In cases like those you displayes, the lines tell the script which variables to use.


For example, HIGH_SCORE_VAR = 1 tells the program to store the highscore in the variable number 1.


If you change it to HIGH_SCORE_VAR = 73, then the highscore would be stored in variable number 73.


You do not need scripts to access these variables, you use regular event commands on those variables.


If you use any scripts that use variables for confguration, your first step should always be to open the variable list by the control variable command and give all those variables names that identify script and function. This is to prevent that variable from being used for something else.


Then make sure that NO variable has a double use. If script one uses variable 17 to keep track of the score and script two uses variable 17 to change the game speed, then you have to change one of those scripts to use a different variable.


In your example, the setting HIGH_SCORE_VAR = 1 will result in the highscore for all games being stored in that variable. You should never write into that variable, but you might check it in a conditional branch if the player has topped the number to pass the game (or whatever should happen after the game).


If you want help, please tell us what you want to achieve, what your target is - instead of simply asking how to do something that might not have anything to do with what you want to have as a result...
 

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,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top