1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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.

[JASS] What to do with triggers?

Discussion in 'Triggers & Scripts' started by Marcelo Hossomi, Feb 18, 2009.

  1. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,596
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    The problem with trigger destruction is a handle index recycle bug which can lead to 2 objects having the same hande (and a crash). Although one really should not fear it, it is advisable to keep the ammount of trigger destruction to a minimal. In damage detection systems, for example, you can reuse one trigger for multiple units before destruction instead of 1 trigger per unit.

    This bug does exist, and it mostly causes crashes. However I would say the failed displacement bug is a much more common cause of crashes.
     
  2. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    877
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    If you cannot reset a trigger, what does this native then?

    Code (vJASS):
    native ResetTrigger takes trigger trg returns nothing
     
  3. RolePlaynGamer

    RolePlaynGamer

    Joined:
    Apr 5, 2008
    Messages:
    473
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Nothing. It sucks, as it's a very useful function.
     
  4. Eccho

    Eccho

    Joined:
    Nov 29, 2006
    Messages:
    2,297
    Resources:
    2
    Spells:
    2
    Resources:
    2
    ResetTrigger is a combination of removing the actions and conditions from the trigger. It does not remove the events :7
     
  5. RolePlaynGamer

    RolePlaynGamer

    Joined:
    Apr 5, 2008
    Messages:
    473
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Are you sure? I tried playing with it a while back, and I remeber it didn't do anything. It was more than a year ago, so perhaps my memory is not correct. I'll test it again in a moment...
     
  6. Eccho

    Eccho

    Joined:
    Nov 29, 2006
    Messages:
    2,297
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Well, I found a thread on wc3c where it has been discussed. You can read about it here
     
  7. RolePlaynGamer

    RolePlaynGamer

    Joined:
    Apr 5, 2008
    Messages:
    473
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    I just tested, and it seems that ResetTrigger doesn't do anything. I tried with both triggercondition's and triggeraction's. TriggerClearConditions and TriggerClearActions worked fine, but from reading the thread you linked, it seems that they still leak when cleared.
    Perhaps ResetTrigger resets evaluate/execute count?

    Test Code
    Code (vJASS):

    scope ResetTriggerTest
       
        globals
            public trigger CheckTrig
           
            public trigger TestTrig
        endglobals

    private function check takes nothing returns boolean
      call BJDebugMsg("Trigger is running")
      return false
    endfunction

    private function test takes nothing returns boolean
      call ResetTrigger(CheckTrig)
      //call TriggerClearActions(CheckTrig)
      //call TriggerClearConditions(CheckTrig)
      call BJDebugMsg("Trigger reset")
      return false
    endfunction

    public function InitTrig takes nothing returns nothing
      set CheckTrig = CreateTrigger()
      call TriggerRegisterPlayerEvent(CheckTrig, Player(0), EVENT_PLAYER_END_CINEMATIC)
      call TriggerAddCondition(CheckTrig, Condition(function check))
      //call TriggerAddAction(CheckTrig, function check)
     
      set TestTrig = CreateTrigger()
      call TriggerRegisterPlayerChatEvent(TestTrig, Player(0), "test", false)
      call TriggerAddCondition(TestTrig, Condition(function test))
    endfunction
    endscope
     
  8. Eccho

    Eccho

    Joined:
    Nov 29, 2006
    Messages:
    2,297
    Resources:
    2
    Spells:
    2
    Resources:
    2
    yes, someone was saying that in the link I pasted to you. That was what I meant actually.