Struggling to learn variables..

kasilopana

New Member
Reaction score
1
Ey everybody =)

It've been some time now, and I'm still struggling when it comes to variables..

I've read tons of guides/tutorials, but can't seem to fully understand it, and make it work.

- How did you guys manage to learn about variables? and how long did it take you to like.. Fully understand it, and use it?

I just think it would be a lot easier for me if I had someone to explain it to me In real life, but none of my friends likes the editor, so no help from them :(

(Sorry for my english, my main language is danish)
 

drak_dragon

New Member
Reaction score
6
well, I don't quite understand what you're after. I understand them pretty well, each has its own properties and limitations, and situations you are allowed to use them in. What exactly are you having trouble with?
 

kasilopana

New Member
Reaction score
1
well, I don't quite understand what you're after. I understand them pretty well, each has its own properties and limitations, and situations you are allowed to use them in. What exactly are you having trouble with?

Variables in general... Like.. When I take a look at you guys' triggers.. I just think "How the hell did they do that" Though I did make these for my TD today! :eek: (Stored Lives)

Trigger:
  • Unit dies
    • Events
      • Unit - A unit enters Left side South Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • Unit - Kill (Triggering unit)
      • Set Lost_life = (Lost_life - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: (String(Lost_life))
          • Game - Display to Player Group - Player 2 (Blue) the text: (String(Lost_life))
        • Else - Actions



Trigger:
  • Dead checker
    • Events
      • Unit - A unit enters Left side South Spawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Lost_life Equal to 0
        • Then - Actions
          • Game - Defeat Player 1 (Red) with the message: Defeat!
          • Game - Defeat Player 2 (Blue) with the message: Defeat!
          • Game - Display to (All players) the text: Team 1 has been def...
        • Else - Actions
          • Do nothing
 

drak_dragon

New Member
Reaction score
6
the only other thing i could tell you to do is look at some maps that are open for anyone to peek inside, and see how they work. beyond the tutorial I linked you, the rest is just a little complex for me to explain without going into deep details, probably because it's like second nature. If you can get 'hold of me through the method I proposed you, then possibly I could explain it to you there. Its.... complicated. I'd say just look up typical programming guides and search for how variables work - theyre pretty much the same logic, its just that the words are different? :p
 

kasilopana

New Member
Reaction score
1
the only other thing i could tell you to do is look at some maps that are open for anyone to peek inside, and see how they work. beyond the tutorial I linked you, the rest is just a little complex for me to explain without going into deep details, probably because it's like second nature. If you can get 'hold of me through the method I proposed you, then possibly I could explain it to you there. Its.... complicated. I'd say just look up typical programming guides and search for how variables work - theyre pretty much the same logic, its just that the words are different? :p

How did you manage to learn variables? Just got to it over time? Read some guides? Made a 100 maps? ;)
 

drak_dragon

New Member
Reaction score
6
How did you manage to learn variables? Just got to it over time? Read some guides? Made a 100 maps? ;)

well, i've been programming since i was like 11. had an old TI 83+, loved that thing. Using variables now is just second nature to me :x

just think of variables as tokens to hold information in that you wish to call later on. like, if you want to ask "okay, can I cross the bridge because its built?" you'd have a variable called BridgeBuilt, and it would be boolean (true or false) and would tell whether the bridge is built, or if it is still broken.

this is starting to get lengthy and make little progression. I'd be happy to help you more, but probably in private messages or in msn so it doesnt flood the board with bumps on this.
 

niceone

New Member
Reaction score
3
I never knew what variables where...

Till the day I started C# scripting. And now I don't understand WHY I didn't understand them xD

But its quite simple a variable is something that stays the same the whole game unless you change it.

So if you set a variable at start to like 100 after 2 hours play it will still be 100 :)

Variables aren't bound to a single trigger so when 1 trigger changes its value the other trigger will directly use that new value.

Like in your thing

Set Lost_life = (Lost_life - 1)

at start you set the life to a value (like 50)

Then trought that one you will deduct 1 from it everytime that trigger is called.

But it won't say that your game ends when it hits 0 you will need to check it somewhere in an other trigger if it is less or equal to 0 to have it end a game.

So you can just keep the "variable" in a simple spot and you can call it from everywhere.

(If you do any scripting language a variable would ba a public field :))
 

Tyman2007

Ya Rly >.
Reaction score
74
Variables can be complicated to some, but should not be attempted by someone who is not used to math and storing things properly.
I suggest looking at your floor and counting how many things you can put into a better place :p

Variables are more for organizing and communicating data easier. Say if I REALLY wanted to bring a string, say "Hello" over to another trigger, the variable is like a tiny man that runs at light speed and can carry up to 8192 pounds (that's how many instances you can be running at a time, don't bother knowing this it's not important for you right now) that delivers the string from place to place.

How did I learn about variables? Simply put I learned about them in algebra. There is little difference between the variables you use in math and the variables you use in WC3.

For instance, the variables in WC3 can hold much more than 1 thing and many different types of things, while the variables in math can only hold a real.

If you've taken an algebra course, then that would help. Variables are pretty much 2nd nature to me. I read no guide on them to get my abilities. If you can learn to associate numbers with letters, you're one step closer :p
 

Inflicted

Currently inactive
Reaction score
63
How did you guys manage to learn about variables?

haha i just one day got bored and messed around with the editor and figured out what everything does. just try and see what everything says, most things are self explanetory
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top