1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Essentials Tutorial

Discussion in 'Trigger (GUI) Editor Tutorials' started by Deuterium, Aug 22, 2009.

  1. -Berz-

    -Berz-

    Joined:
    Mar 5, 2008
    Messages:
    3,203
    Resources:
    123
    Icons:
    111
    Packs:
    1
    Skins:
    1
    Spells:
    10
    Resources:
    123
    *off-topic

    I don't get it :p
     
  2. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    lols ;) [/offtopic]
     
  3. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Ok, so you know that triggers tend to queue to run one after the other? Well, some events tend to intercept not only the queue, but actually the actions of the trigger.

    So in case it intercepts at the point of the Integer A loop, and the intercepting trigger itself uses Integer A, BAM, you ruined the loop for the intercepted trigger by changing the original value of Integer A...

    Got it now? ;)
     
  4. -Berz-

    -Berz-

    Joined:
    Mar 5, 2008
    Messages:
    3,203
    Resources:
    123
    Icons:
    111
    Packs:
    1
    Skins:
    1
    Spells:
    10
    Resources:
    123
    Yeah, but this is so rare that...
     
  5. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    True indeed in the case of spells... but imagine having a WHOLE map with tons of triggers and custom made spells... well, it wouldn't be rare anymore.

    And even if a bug is rare, that doesn't mean you don't avoid it ;)
     
  6. -Berz-

    -Berz-

    Joined:
    Mar 5, 2008
    Messages:
    3,203
    Resources:
    123
    Icons:
    111
    Packs:
    1
    Skins:
    1
    Spells:
    10
    Resources:
    123
    You can also use Loop B :p

    Yeah I get the point now ;)
     
  7. -Berz-

    -Berz-

    Joined:
    Mar 5, 2008
    Messages:
    3,203
    Resources:
    123
    Icons:
    111
    Packs:
    1
    Skins:
    1
    Spells:
    10
    Resources:
    123
    I said i get it! xP [/spam]
     
  8. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Sorry... I told you FireFox is going crazy :p
     
  9. mjllonir

    mjllonir

    Joined:
    May 31, 2009
    Messages:
    432
    Resources:
    3
    Spells:
    3
    Resources:
    3
    This clarifies so much, and now I know what would make my triggers go better :)

    Amazing tutorial, great job writing it! Rep to you!
     
  10. aznricepuff

    aznricepuff

    Joined:
    Feb 22, 2006
    Messages:
    749
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    Go into blizzard.j and look at what the BJs do. If they just return GetTriggerUnit()...you know they're useless.
     
  11. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    sounds like me, having tons of code in maps ...

    YES very rare bug but I've seen what it can do and it's not good ... so avoid it
     
  12. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Well aznricepuff, here's the thing... that won't work since all event response units are natives except for GetAttackedUnitBJ().

    Those that happen to be BJ's other than attacked unit return their natives (ex: GetLoadedUnitBJ() returns GetLoadedUnit()).

    However, I ended up testing them yesterday and I've got a table of all those that function equally to GetTriggerUnit()... I'll post it as soon as I updated the tutorial.
     
  13. Eleandor

    Eleandor

    Joined:
    Aug 21, 2005
    Messages:
    3,681
    Resources:
    2
    Models:
    1
    Tutorials:
    1
    Resources:
    2
    Any unit triggering the trigger is the "triggering unit". No table required because it's as simple as that. If a unit enters the region, the "triggering unit" is the entering unit. Etcetera.

    Only in cases where there is no alternative, other units are used. For example: Target unit of issued order, since triggering unit already refers to the unit that was issued the order.
     
  14. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    But don't you need to prove which works and which doesn't before you can state out such things to the readers...? and believe me, there happened to be one weird case where - referring to the event - GetTriggerUnit() replaces the unexpected event response unit instead of the one I was sure it'll replace.

    Anyways, as I said, I already have the table set and ready, I just need to add one more snippet and update it. I'll let you know when I update it :)

    EDIT:
    And oh, well yes the table is required, since this tutorial is made for beginners. What's more, it's better to be specific and detailed when it doesn't confuse the reader :)
     
  15. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Updated:
    - Changed I - 4 - c. Unit: Casting unit to I - 4 - c. Replacing certain Event Response units with Triggering unit
    - Added: I - 4 - h. Using Unit Group: Units In Range instead of Unit Group: Units In Region
     
  16. aznricepuff

    aznricepuff

    Joined:
    Feb 22, 2006
    Messages:
    749
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    Certain Event Response units basically call...in the background of the game, thus instead we should manually...

    Just fix that and I can approve.
     
  17. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
  18. Eleandor

    Eleandor

    Joined:
    Aug 21, 2005
    Messages:
    3,681
    Resources:
    2
    Models:
    1
    Tutorials:
    1
    Resources:
    2
    I find the leaks part lacking. There's no information on array leaks. There's no information on what precisely a leak is and how you can detect leaks yourself without having to browse through endless lists that don't cover them all anyway, or cover things that don't leak.

    No. Just no. Use timers, don't overcomplicate things. Besides, if you got a wait action above .3 your accuracy increases a lot. Your average GUI newby won't need better accuracy.

    Is this a reason for something to be slower??? Get me some benchmarks first before you make claims based on nothing...
    My intuition says the opposite. It takes 4 comparisons to check if a unit is in a rectangle, while it takes 2 multiplications, 1 addition, 1 squareroot and 1 comparison to check if a unit is in range. Both also return different results, they have different uses, so you can't even compare them.

    No.

    I find it funny you're talking about efficiency in GUI in the first place. Efficiency is not "essential" and it's definitely not essential if you're going to use gui. If you want to encourage people to get as much efficiency as possible, learn jass. I certainly don't want to derail this topic into yet another jass vs gui thread, but the main reason GUI users give not to learn jass is that they don't need the efficiency and gui can do most of the things they need. Well, if they don't need to then don't even bother about writing "efficient" gui code. "Efficient" and "GUI" don't fit in the same sentence.

    Maybe tell them that the only reason they added this action is because there is a if/then/else action (single instead of multiple actions). You must enter something in "else", which is why they made "Do nothing". IMO you should avoid the single if/then/else action anyway.

    Using a user declared Integer has the exact same problems as Integer A or Integer B. By not telling them *what* the real problem is, you're just encouraging them to make an Integer C variable and use it for all loops, and you end up having the same problems as before. Besides, the average GUI trigger will not have any problems with Integer A or Integer B.

    I also find your naming bad. Variables like TargUnit? Why do you need to add "Unit"? Call it target, it's shorter, easier to read (everyone knows what a target is, but a "targ"?) and the only variables you can select in GUI will be units anyway. It's something a lot of people do and it's a bad habit.
     
  19. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Well I'll read your post more thoroughly some day later when I've got the time to edit the tutorial, but to quickly answer some of your conerns.

    I wouldn't be mentioning anything here unless I already checked out whether it's true or not.

    Apparently as I read your comments, I find that I missed to say alot of things, so thanks :)

    There's another problem with wait which is occur in case of game lagging or pausing the game. Also, using this way instead of timers make it easier to make the spell MUI with Indexing; however, I got tot check the hashtables case.

    Well, yet I do respect people's free will to pick whatever codin approach they want to use. Using GUI doesn't mean you can't improve some issues. And yes, Jass is far better...


    Again, thanks for checking and giving advice :)
     
  20. Eleandor

    Eleandor

    Joined:
    Aug 21, 2005
    Messages:
    3,681
    Resources:
    2
    Models:
    1
    Tutorials:
    1
    Resources:
    2
    Uh... that's still not a good reference. It's false until you get me some evidence...