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

Creating JASS Trigger Conditions

Status
Not open for further replies.
Level 5
Joined
Dec 12, 2011
Messages
116
It's just a simple question. I think I heard somewhere that there are some restrictions of functions you can call or things you can do in general, when you are inside a Trigger Condition:

JASS:
call TriggerAddCondition( gg_trg_MyTrigger, Filter( function Trig_MyTrigger_Conditions ) )

So, is there, in fact, some restriction inside:

JASS:
function Trig_MyTrigger_Conditions takes nothing returns boolean

Or I am just crazy?

Thanks

hamsterpellet
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
restriction:
you cant use wait in triggercondition

Thats about it

It doesnt even need to return anything using this:
JASS:
function aaa takes nothing returns nothing
//blablabla
endfunction

function aab takes nothing returns nothing
    local trigger t = CreateTrigger()
    local code c = function aaa
    call TriggerAddCondition(t, Condition(c))
    set t = null
It doesnt matter if you use Filter or Condition, it does the same thing

This way returns false by default

Also you should ever return false in the function marked as condition for trigger(triggercondition) because if you return true he will try to execute his Actions(only if all triggerconditions returns true) and it takes a very little bit time to realise that he doesnt have any
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
its not good to have triggeractions in Jass, everything is done in triggercondition because they are way faster then triggeractions

if you dont believe me test it yourself, add a triggercondition using the code trick to trigger abd add triggeraction to trigger and print something in them and you will see

actually Magtheridon's TriggerRegister idk what :D uses this method of adding a function to a trigger so you dont need to worry about returning booleans
 
Status
Not open for further replies.
Top