FurySession:AddTrigger (Command)

From Lavish Software Wiki
Jump to navigation Jump to search

Syntax

Command Difficulty Rating
AddTrigger
Usage ?
Level of Understanding ?
Computer Savvy ?
Logic ?

AddTrigger <function> <match text>

Description

Adds a trigger using the specified match text. When the trigger hits, a command will be queued to Call the function name given. The full matched line will be passed as the first parameter. Each variable value in the trigger will be passed as additional parameters to the function, in the order given in the text.

Examples

function main()
{ 
  AddTrigger MyTrigger "@WHO@ kills YOU."
  AddTrigger YouHit "You hit @WHO@ for @DAMAGE@ point@s@ of damage"
   
  do
  {
    if !${QueuedCommands}
      WaitFrame
    else
      ExecuteQueued
  }
  while 1
  ; loops indefinitely (until the EndScript command is used)
}

function MyTrigger(string Line, string Who)
{
  Speak -sync You have been killed by ${Who}
}

; Note that this function only has 3 parameters. the "s" value from the trigger will be ignored!
function YouHit(string Line, string Who, int Damage)
{
  Speak You hit ${Who} for ${Damage} damage
}

See Also