wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > Trigger (GUI)/ AI editor Tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-11-2006, 10:23 PM   #1
MrApples
Banned
 
MrApples's Avatar
 
Join Date: Jul 2005
Posts: 343

Submissions (3)

MrApples is on a distinguished road (16)

Default MrApple's Beginner's Guide to Variables

MrApple's Beginner's Guide to Variables
Version 1.2 – 1/14/07

Introduction
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 Menu


You’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.





---3 – Using the Variable---
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.



Voila! It’s Easy, right?


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.

Last edited by MrApples : 04-22-2007 at 09:20 PM.
MrApples is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-12-2006, 02:45 AM   #2
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

for reals , integers , strings and boolean it does store a value in a variable and not a pointer
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-12-2006, 04:53 AM   #3
SomeGuy333
User
 
Join Date: Jan 2006
Posts: 9

Submissions (1)

SomeGuy333 has little to show at this moment (0)

Default

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)))]))
that's wrong, it needs to be triggering player since the event is a chat event.
SomeGuy333 is offline   Reply With Quote
Old 04-10-2006, 08:30 PM   #4
Eternal_Dread
User
 
Eternal_Dread's Avatar
 
Join Date: Feb 2006
Posts: 35

Eternal_Dread has little to show at this moment (0)

Default

Good tutorial for beginners.
__________________

Last edited by Eternal_Dread : 04-16-2006 at 06:17 AM.
Eternal_Dread is offline   Reply With Quote
Old 04-16-2006, 11:51 PM   #5
operator
User
 
Join Date: Apr 2006
Posts: 172

Submissions (7)

operator will become famous soon enough (37)operator will become famous soon enough (37)

Send a message via MSN to operator
Default

Yes, Good
operator is offline   Reply With Quote
Old 08-12-2006, 04:46 PM   #6
MrApples
Banned
 
MrApples's Avatar
 
Join Date: Jul 2005
Posts: 343

Submissions (3)

MrApples is on a distinguished road (16)

Default

Uploaded the latest version of this, may be somewhat different.
MrApples is offline   Reply With Quote
Old 12-15-2006, 12:46 AM   #7
MrApples
Banned
 
MrApples's Avatar
 
Join Date: Jul 2005
Posts: 343

Submissions (3)

MrApples is on a distinguished road (16)

Default

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.

Last edited by MrApples : 12-15-2006 at 12:47 AM.
MrApples is offline   Reply With Quote
Old 08-08-2008, 12:46 PM   #8
Rasmusazu
User
 
Rasmusazu's Avatar
 
Join Date: Aug 2008
Posts: 7

Rasmusazu has little to show at this moment (0)

Default

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
Rasmusazu is offline   Reply With Quote
Old 12-19-2009, 04:49 PM   #9
Wambo06
User
 
Join Date: Dec 2009
Posts: 1

Wambo06 has little to show at this moment (0)

Default

TY (:
Wambo06 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:44 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2018, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services