• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Question: About Loading in Hashtables

Status
Not open for further replies.
Level 20
Joined
Aug 13, 2013
Messages
1,696
Hello,

I have a question and I want to know the differences of this procedure =,= When saving a value to the hashtable.. Why other users doing like this?

Loading without Setting it
  • Just Example
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KU_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 1 of KU_Key from KnockUp_Hashtable) Greater than 0.00
            • Then - Actions
            • Else - Actions
And the others are using this: Loading with Setting it
  • Just Example
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KU_Group and do (Actions)
        • Loop - Actions
          • Set KU_Time = (Load 1 of KU_Key from KnockUp_Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KU_Time Greater than 0.00
            • Then - Action
            • Else - Actions
I'm desperately want to know what they're differences XD... Is it brokening MUI (Multi-Unit Instanceabilty) in what procedure... Is it for faster coding???? or Is it for efficiency???? Elaborate Pls...
 
Last edited:
Level 20
Joined
Aug 13, 2013
Messages
1,696
the difference is you're not using your stored variable..
and it's make your code less efficience..

Usually I'm beginning with setting it the stored variables xD but I'm confused to others that they're not storing their stored variables to the trigger and they're just loading the datas to the function not to a variable.

It's for faster...Loading a value saved in hashtable is slow...that's all i can tell :D

So It's faster as you said but is it will affect the MUI of the Spell or the efficiency :D?

Off - Topic : 100 posts :D (just a newbie or noob)
 

Rheiko

Spell Reviewer
Level 25
Joined
Aug 27, 2013
Messages
4,121
because they're setting the variable first, it much faster than the first trigger..
it's like

1st trigger:
you have an apple in the cast trigger
then in the loop trigger, you need to search for it (because you forgot where it is) first then eat it (because you're not save that apple)

2nd trigger:
you have an apple in the cast trigger
then in the loop trigger, you save that apple (you're remember where you put the apple)
you don't need to search for it, you can just eat it.. (because you know where it is)

now, if you see from both of them which one is faster?
the 2nd one of course
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
because they're setting the variable first, it much faster than the first trigger..
it's like

1st trigger:
you have an apple in the cast trigger
then in the loop trigger, you need to search for it (because you forgot where it is) first then eat it (because you're not save that apple)

2nd trigger:
you have an apple in the cast trigger
then in the loop trigger, you save that apple (you're remember where you put the apple)
you don't need to search for it, you can just eat it.. (because you know where it is)

now, if you see from both of them which one is faster?
the 2nd one of course

:ogre_datass: :grin::grin: Nice +rep for your gift then eat it :thumbs_up:.
 
the difference is you're not using your stored variable..
and it's make your code less efficience..

This is not true at all.

@TO
The reason that people store things into temp variables is because hashtable loads are very slow. If you use the hashtable loaded value twice or more it should be stored into a temp variable and the temp variable should be used in your triggers.
 
Status
Not open for further replies.
Top