• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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)
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
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:.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
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.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Anyway I did storing the loaded value in the variables and I'm doing the 2nd trigger as ALWAYS.. not the 1st trigger :p anyway I think I'll stick to the store loadded value in the variables as deathismyfriend said.
 
Status
Not open for further replies.
Top