Difference between revisions of "Command:AddTrigger"
Jump to navigation
Jump to search
m (ISKernel:AddTrigger (Command) moved to Command:AddTrigger) |
|||
(One intermediate revision by the same user not shown) | |||
Line 40: | Line 40: | ||
== See Also == | == See Also == | ||
− | *[[ | + | *[[LavishScript:Triggers|Triggers]] |
*[[LavishScript:Commands|LavishScript Commands]] | *[[LavishScript:Commands|LavishScript Commands]] | ||
− | |||
− | |||
{{Command-Stub}} | {{Command-Stub}} | ||
− | [[Category: | + | [[Category:LavishScript]] |
− | [[Category: | + | [[Category:LavishScript Commands]] |
− |
Latest revision as of 15:40, 7 May 2012
Contents
Syntax
AddTrigger <function> <match text>
Forms
- AddTrigger <function> <match text*> - Script only command, will execute <function> when <text> is matched. Default reads console text, reading specific text from games requires help from extensions.
Examples
function RegisterEvents() { ; Add each event AddTrigger MyTrigger "@WHO@ kills YOU." AddTrigger YouHit "You hit @WHO@ for @DAMAGE@ point@s@ of damage" }
function main() { call RegisterEvents do { if !${QueuedCommands} WaitFrame else ExecuteQueued } while 1 }
;AddTrigger MyTrigger "@WHO@ kills YOU." function MyTrigger(string Line, string Who) { Speak -sync You have been killed by ${Who} }
;AddTrigger YouHit "You hit @WHO@ for @DAMAGE@ point@s@ of damage" function YouHit(string Line, string Who, int Damage) { ; Note that this function only has 3 parameters. the "s" value from the trigger will be ignored! Speak You hit ${Who} for ${Damage} damage }
See Also