• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

Hashtables Values - Load or Set Variables?

Not open for further replies.



Level 4
Jan 7, 2009

I've got a little question about the using of values of hashtables.
In every tutorial I've seen that the posters first of all saved the loads of hashtables in additional variables and then used this variables for another actions.

  • Set Integer = (Load 0 of (Key (Triggering unit)) from Hashtable)
  • Set Integer = (Integer + 1)
  • Hashtable - Save Integer as 0 of (Key (Triggering unit)) in Hashtable
So I'm doing it this way:
  • Hashtabelle - Save Integer as ((Load 0 of (Key (Triggering unit)) from Hashtable) + 1) of (Key (Triggering unit)) in Hashtable
Is inefficient or are these steps only there to keep holding the overview?
The first part is saving the value, you can call it whichValue. The second part determines how the value will be labelled.

Now, if you want to load the value back, you need to use that little "label". In the first way you've presented, the label to load the "Integer" value, is "0", because this is how you saved it, to recognize it yourself.
In the second way, the label is the (old label + 1). However, you are saving the value, you are not loading it, which means that the "Integer" variable will not replace the old label, it will save it as a new one, since (old label) != (old label + 1).

Definitely follow the first way, which creates a static label for the "Integer" variable.
This is the one which is identical to the first
  • Hashtable - Save ((Load 0 of (Key (Triggering unit)) from Hashtable) + 1) as 0 of (Key (Triggering unit)) in Hashtable
Since what the first two parts do is to load the value saved on the hashtable, and then increase it by 1...

if ur not reusing it in the same trig, I guess its more efficient this way, but if you're using the value several times in the same trigger, do the first method...
Not open for further replies.