• 💀 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!

[Solved] Hashtable do not save

Status
Not open for further replies.
Level 10
Joined
May 28, 2011
Messages
455
I cant find the solution for this problem
I want to save indexA (integer variable) in spell_hashtable (hashtable variable) but it doesn't.
After i load it and display its value. it appear 0.
Is something wrong?
 

Attachments

  • Hashtable leak.w3x
    19.1 KB · Views: 28
Level 15
Joined
Jul 4, 2008
Messages
1,106
@WaterKnight; Why to waste a trigger to just initialize a Hashtable, when you could just do
[jass="OnSpellTrigger"]
// Set Hashtable
if (udg_MyHashtable == null ) then
set udg_MyHashtable = InitHashtable()
endif
// Other setups
[/code]

If the jass version is too much to understand... I'm writing a CS version.

  • -------- --------
  • Custom script: if ( udg_MyHashtable == null ) then
  • Custom script: set udg_MyHashtable = InitHashtable()
  • Custom script: endif
  • -------- --------
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Slightly, it does slow down the game but TC named the hashtable as spell_hashtable, so would assume wants to use it in other spell codes, too, therefore, pasting this everywhere, would create more lines/trash/take space. Besides, you normally also do other things on init, you do not have to use a private trigger for it, or you inject it into main function with jass (if InitHashtable works there).
 
Status
Not open for further replies.
Top