• 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.

[JASS] What is this function for?

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,243
When a variable's value becomes something the trigger fires. It only works for reals.

For example if you register variable called Deaths, becomes equal to 0. When the variable's value becomes 0, the trigger fires.

If it is already 0, and it is set to 0, nothing happens. If it is 0, you set it to 1, and then back to 0, the trigger executes.
 
TriggerRegisterVariableEvent has only one use in vJass other than Events:

JASS:
library CoolStuffInThisLib

    globals
        real dontEdit = 9001
    endglobals

    private struct Init extends array
        private static method run takes nothing returns boolean
            call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Tard!")
            return false
        endmethod

        private static method onInit takes nothing returns nothing
            local trigger t = CreateTrigger()
            call TriggerRegisterVariableEvent(t, "dontEdit", NOT_EQUAL, 9001)
            call TriggerAddCondition(t, Condition(function thistype.run))
            set t = null
        endmethod
    endstruct
endlibrary

edit

Fixed. ^-^
 
Last edited:
Mag, that is EPIC WIN!

108859d1323611044-user-year-who-do-you-vote-1.jpg
 
Status
Not open for further replies.
Top