General EQWatcher Concepts > Venturing into the Unknown  > Triggers


List of commands

AddTrigger(string name, string text, soundtype, string soundinfo)

RemoveTrigger(string name)


AddTrigger(string name, string text, soundtype, string soundinfo) Command

Adds a trigger with specified information.

Return value

boolean value true if successful, false if not

Parameters

name

The name can be basically any name, this will be used to identify this specific trigger.  This name should be unique to this trigger.

text

The text here is the search string for this trigger.  This can include variable processing but must account for the entire line seen in the log file, including the time stamp.  Ignoring the time stamp is generally done by preceding this text with "[@trash@] ".

soundtype

The soundtype parameter is not given a data type because it CANNOT be a value other than the constants defined for this purpose.  SND_WAVE, SND_CD, SND_TTS, SND_MP3, SND_SYNCWAVE, SND_SYNCTTS.  This must be hard-coded and may not use a variable value.

soundinfo

The soundinfo parameter goes along with the sound type.  For SND_WAVE and SND_SYNCWAVE you must supply a filename.  For SND_TTS and SND_SYNCTTS you must supply text to speak.  For SND_CD you must supply a track number to play.  For SND_MP3 you must supply a search string.

Example

// This alias adds a SND_WAVE trigger, automatically ignoring the time stamp

public string TriggerName;
public string TriggerText;
public string TriggerSound;
alias("trigger wav \"@TriggerName@\" \"@TriggerText@\" \"@TriggerSound@\"")
{
  string text;
  strcat(text,"[@trash@] ",TriggerName);
  if (AddTrigger(TriggerName,text,SND_WAVE,TriggerSound))
  {
    SpeakSync("Trigger added");
  }
  else
  {
    SpeakSync("Trigger not added");
  }
}
 


RemoveTrigger(string name) command

Removes trigger with the specified name

Return value

boolean value true if successful, false if not

Parameters

name

Name of the trigger to remove.

Example

// This alias removes a trigger given the name

public string TriggerName;
alias("trigger remove \"@TriggerName@\"")
{
  if (RemoveTrigger(TriggerName))
  {
    SpeakSync("Trigger removed");
  }
  else
  {
    SpeakSync("Trigger did not exist");
  }
}