Home
Help
Search
Calendar
Login
Register
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
New forum theme up and running!
Charas-Project
»
Game Creation
»
Requests
»
RPG Maker Programming
»
Variables: the great mystery. or, What the heck are variables?
« previous
next »
Print
Pages: [
1
]
Author
Topic: Variables: the great mystery. or, What the heck are variables? (Read 1788 times)
Kass
The Creator
Initiate
Posts: 59
Variables: the great mystery. or, What the heck are variables?
«
on:
November 06, 2006, 10:38:23 PM »
Before I start asking for a tutorial, I just thought I might point out that I don't think I'm a newb. I just think that I've never found out how to use variables. I always find an alternate way of coding things. However, I'm getting to the point in my game where variables are probably easier.
Therefore-I am asking for a tutorial on variables.Please help.
Logged
I am the creator. I am the one. I am controller of life! I alone choose who lives, and who dies.
clickage will be appreciated immensly, even by one so great as I, Kass.
www.lost.eu/4898c
Darkfox
These spectacles do nothing
Staff
Over 9000!
Posts: 10,215
(No subject)
«
Reply #1 on:
November 06, 2006, 10:56:00 PM »
It is not essential to use variables but it helps in some things. I used variables to roll a random number that would give NPCs different responses (as used in some console RPGs). Basically a variable is a value or number that determines a cause and effect. If a certain criteria is met there would be a trigger event to acompany it.
Variables can be used to determine time of day as well.
A tutorial just for explaining variables would be rather pointless persay, as it could be explained in few words:
They represent a state, value, or number. If, And, and When. Basically.
"If [variable] is 0, then [do this]." Is a rather simplistic use of variable. And an event may trigger it like so: "Change [variable] to [Off, On, True, False, or a number]" And in an event this may trigger it to behave differently (usually applies to globals).
Logged
Daetyrnis
Zealot
Posts: 616
(No subject)
«
Reply #2 on:
November 06, 2006, 11:04:18 PM »
Variables are a way to store numbers.
You know how a switch works, correct? A switch has two different settings, ON and OFF. You can turn them on and off, or change them to the opposite of the current setting. Usually, when a switch is ON, it lets you tell the game to change how something works. Whether it be that a chest stays closed, or that you've turned on the "mystical fire orb of power".
Variables are similar to switches. They let you work with the coding of events and such, making them do different things based on a value. For example, if in your game an elderly man wants you to bring him 3 silver keys, you would most likely want to use variables. Using the settings on the left of the event page, you could easily determine whether the player has one key, but you need to tell it whether you have 3. For this, you would set a variable to the number if Silver Keys in the player's possession and then work off of that with conditional branches.
Variables work like super-advanced switches. Instead of only two settings though, they range from -9999999 to 9999999, very versitile, wouldn't you say? You can also do more than set them to very specific things (like setting to 3 if you have 3 keys). You can add, subtract, multiply, divide, and mod. Mod gives you the remainder of the current value and the one you Mod it with (if you had divided it). For example, 19 mod 3 is 1. If you don't understand that, don't worry. Mod is very rarely used, and wouldn't be needed by a beginner.
You can also change the values of variables by a range (like switches), and use a variable reference. A variable reference is a little complicated, but very useful. Pretty much it affects the variable which has the number of the variable entered in the reference (confusing, right?). If the reference variable is set 15, then the variable #0015 is affected by the command.
I hope that helps.
Sorry if it's too much.
Logged
Darkfox
These spectacles do nothing
Staff
Over 9000!
Posts: 10,215
(No subject)
«
Reply #3 on:
November 08, 2006, 01:12:17 AM »
Exactly as I said. But mine was with fewer words. XD
People can either understand them or overcomplicate them. But the best I could describe them as is either:
A) A dice roll, useful for random events.
B) A switch that determines how an event would behave, like for instance if you triggered an event the variable might say it has been done and, lets say for example, you have a rock monster in the other room and if a certain thing is done it would come to life and you'd have to fight it but ONLY after the variable was set.
C) Time of day, ammo, so on so on.
I guess that about covers it in basics. XD
Logged
plightofthepureblood
Time Magazines 2004 most promising despot.
Zealot
Posts: 574
I used to go by Gemini, here.I play quadruple neck guitar
(No subject)
«
Reply #4 on:
November 08, 2006, 02:03:09 AM »
What you gotta do, is if the whole thing confuses the heck out of you, then try using some tutorials that use variables. And do a couple of them.
I always found it a bit confusing when people tried to explain it to me.
Make a game Clock.
Thats a good one to start with.
One you get a good grasp on the basics of it, you start finding ways to utilize fork conditions, and cool stuff.
Variables can do alll sort of cool things for you.
They can remember Maps and positions...Remember keys that you have pressed, and assign new abilities to different keys.
Test it out, dood.
Its easer to understand if you teach yourself. Having somebody explain it can get confusing.
Logged
http://myspace.com/knivesarequiet
Print
Pages: [
1
]
« previous
next »
Charas-Project
»
Game Creation
»
Requests
»
RPG Maker Programming
»
Variables: the great mystery. or, What the heck are variables?