| 03-11-2006, 10:23 PM | #1 |
MrApple's Beginner's Guide to Variables
Version 1.2 – 1/14/07Introduction In this tutorial you will learn how to make a variable, what they are, and how they work, yeah! ---1 – What is a Variable---
var•i•a•ble P Pronunciation Key (vâr - -b l, v r -)adj. 1. a. Likely to change or vary; subject to variation; changeable. b. Inconstant; fickle. 2. Biology. Tending to deviate, as from a normal or recognized type; aberrant. 3. Mathematics. Having no fixed quantitative value. Taken from www.dictionary.com What is a Variable in World Editor? A Variable is like empty space. Like a really small Floppy Disc or Flash Drive. You can store stuff in the Variable that you want to use for later in the game. Instead of actually storing stuff inside of the Variable though, it only points to what you saved. If you saved a Unit to a Variable, the actual Unit would still be in the game, but if you ever wanted to do anything to that unit, you could use the Variable. ---2 - Making the Variable---
Time to Create a Variable! (Gasp!). First thing to do is enter the Variable MenuYou’re in the Variables Menu, Congratulations! Now you must make a New Variable (Be Careful!). Ok for your first Variable, let’s do something nice, like a Variable that tracks Kills! Steps -In the Variable Name Spot, type Kills -In the Variable Type Spot, select Integer (An integer is any full number, like 1, 2, and 3, but not 1.5 or 2.3). -Click Ok! You made your first Variable! Congratulations! It should look like this if you did it right. Basic Using Now that you made your first variable, let’s put it into action shall we? Lets say you want to keep track of the Kills by Player 1 (Red), and Player 1 (Red) could check his kills whenever he wanted by typing kills. We would do this. ![]() ![]() Using Arrays Ok, now say you wanted to make it so not just Player 1 (Red) could use this, but every player could! Sounds hard huh? Actually it’s really easy. You have to make a thing called an Array Variable . Array Variables are like a whole bunch of Variables of the same type in one. They work by sorting them by a Number, such as Variable[1] would be a completely different variable then Variable[2], or Variable[3], and so on. These are meant to be used only when its necessary, yes you could put every Variable of the same type into one Array Variable and use numbers, but it would be slower on a very small scale then just using good ole' Single Variables. Now onto making the Kill Check Trigger work for every player. You must go back into the Variable Menu, then Edit the Kills Variable you just made, and check the Array Box near the bottom. That’s it, now your Variable is Array! Tip: Array SIZE is only for how many variables of the array you would like to have the Default Value. But now in order to use the Kills Variable, you have to specify what number, like this. There! Now you have successfully used both Variables and Array Variables! Congratulations! ---Continue your Education--- You can continue your education on Variables with my new tutorial on Playing with Player Names. Learn Renaming, using Arrays properly, Coloring Names, Storing String Variables, and a whole bunch more! Please comment on how this tutorial can be improved, if you find anything that you find confusing, or may be confusing to others, please post it. |
| 03-12-2006, 02:45 AM | #2 |
for reals , integers , strings and boolean it does store a value in a variable and not a pointer |
| 03-12-2006, 04:53 AM | #3 |
you didn't say what the array size does Trigger: Game - Display to (Player group((Owner of (Killing unit)))) the text: (String(Kills[(Player number of (Owner of (Killing unit)))])) |
| 04-10-2006, 08:30 PM | #4 |
Good tutorial for beginners. |
| 04-16-2006, 11:51 PM | #5 |
Yes, Good |
| 08-12-2006, 04:46 PM | #6 |
Uploaded the latest version of this, may be somewhat different. |
| 12-15-2006, 12:46 AM | #7 |
I may update this soon, and I have been thinking of a new color scheme. Recommended Title Text This is a sentence, isn't it amazing, it does stuff like telling people information. Current Title Text This is a sentence, isn't it amazing, it does stuff like telling people information. New? Title Text This is a sentence, isn't it amazing, it does stuff like telling people information. I know alot of people seem to be completly anti-color here, but I find it very hard to read a document without some sort of ... color. |
| 08-08-2008, 12:46 PM | #8 |
pretty confusing for me since i had some trubles finding out how to get the right things in the trigger and such, atm my kill count isent working it always says "0" even though i just killed like 1000 mobs |
| 12-19-2009, 04:49 PM | #9 |
TY (: |
