Azlier
Old World Ghost
- Reaction score
- 461
I don't know about you guys, but I am tired of writing the exact same Init function twenty times.
EDIT: Why did I give this the [System] tag?
EDIT: Why did I give this the [System] tag?
JASS:
library TriggerRegisterOnChat
//TriggerRegisterOnChat takes these arguments:
// Which trigger you are registering for, the string you are registering,
// and whether the string should be an exact match.
//TriggerRegisterOnChatEx takes these arguments:
// Which trigger you are registering for, the string you are registering,
// whether the string should be an exact match, your condition function (if any),
// and your actions function (if any).
//Also returns the supplied trigger if you want to use crazy syntax.
function TriggerRegisterOnChatEx takes trigger t, string s, boolean b, code cond, code act returns trigger
local integer i = 11
loop
call TriggerRegisterPlayerChatEvent(t, Player(i), s, b)
exitwhen i == 0
set i = i - 1
endloop
if cond != null then
call TriggerAddCondition(t, Condition(cond))
endif
if act != null then
call TriggerAddAction(t, act)
endif
return t
endfunction
function TriggerRegisterOnChat takes trigger t, string s, boolean b returns trigger
return TriggerRegisterOnChatEx(t, s, b, null, null)
endfunction
endlibrary