General EQWatcher Concepts > The Basics > Converting to EQWatcher Advanced


NOTE: This section has changed greatly since Beta 5.  Most timers and triggers can be done quite a bit easier now.

As most of you have already noticed, EQWatcher Advanced differs largely from EQWatcher 1.76.  Timer and trigger files no longer exist as you knew them.  Although it is quite possible for an EQWatcher Advanced script to read the old format and convert them (and either this or a separate program will be created for final release), there is no over-simplified way to do it right now.  Instead, I will document right here what is required of you to use your old triggers and timers.

Triggers will be much easier to convert, since the information each trigger uses is practically the same.  Here is an example of an EQWatcher 1.76 trigger file (TRIGGERS.EQG):

-----------
rslow;] @slowmob@ is slowed by the embracing earth.;!%slowmob% slowed
invis;] You feel yourself starting to appear.;sounds\danger.wav
skills;] You have become better at @skill@! (@!skillvalue@);!%skill% %skillvalue%
snared;~b @snaremob@ has been ensnared.;!%snaremob% snared
-----------

Note that the "invis" trigger is built into the EQWatcher Advanced core script, and so are slows (including ranger, shaman, enchanter).  For demonstration purposes I will show how to convert them anyway.

There are two ways to create triggers.  One is within a compiled script, and the other is to use the built-in trigger adding commands.  Ones that must be done in compiled scripts I will refer to as complex triggers, and ones that can be done using the simple commands I will refer to as simple triggers.  To be a simple trigger, it must not require use of new variables (if you don't actually need or use the data from the variable, such as using "@trash@", then it does not require use of a new variable.  Also note that since many triggers (such as the ones above) use a variable that is ONLY used once, I have pre-defined some variables for use in your triggers and timers.), and must directly play a sound (rather than running compiled code) or execute an EQWatcher Advanced command (just like typing /note [command]).

In the example file used, there is exactly one trigger that uses no variables (i.e. there is no variation in the line) -- the "invis" trigger.  The others require use of variables, but can easily use the ones already defined for this purpose.  Because it is easier, I will start with the "invis" trigger.  This trigger can simply be created in a commands file (such as STARTUP.EWS) with the following format: trigger wav "invis" "You feel yourself starting to appear." sounds\danger.wav ...  Information on formatting simple triggers such as this one can be found in the triggers section.  Please note that unlike EQWatcher 1.76, all EQWatcher Advanced triggers MUST account for the ENTIRE line.  Simple triggers automatically take care of the time/date stamp from the log file for you, so everything seen in the chat window must be accounted for in your trigger, by using the actual text or variables (trash or otherwise).

Now for the other triggers.  First you must understand that a variable here can be either a string (contains generic text), or a number (there are other types that can be used, but for the sake of simplicity...).  There are 2 pre-defined string and 2 pre-defined number variables that are safe for you to use.  I made them specifically for this purpose, so you would not need to make yourself an actual script (which scares people off).  The string variables are "PSTR1" and "PSTR2".  The integer (number) variables are "PINT1" and "PINT2" -- these are defined as signed long for those wondering.  These can be used to make your triggers work as follows:

trigger TTS "rslow" "@PSTR1@ is slowed by the embracing earth." %PSTR1% slowed
trigger TTS "skills" "You have become better at @PSTR1@! (@PINT1@)" %PSTR1% %PINT1%
trigger TTS "snared" "@PSTR1@ has been ensnared." %PSTR1% snared

Now for timers.  Timers in EQWatcher Advanced are not like EQWatcher 1.76 timers.  The timers themselves do not have triggers, and they are not permanent.  Feel free to see the timers section for more information.  There are two types of timers, simple and complex.  The great majority of timers used in 1.76 can now be  considered simple triggers in Beta 6, with the exception of using placeholder triggers.

Here is a sample EQWatcher 1.76 timer taken from this message board thread http://pub78.ezboard.com/feqwatcherfrm5.showMessage?topicID=28.topic

1;mend;!Mend is available.;360200;mend your wounds;worsened your wounds;]no placeholder

This timer is named "mend", and says "Mend is available" approximately 6 minutes after this monk used his mend ability.  In EQWatcher Advanced, you can now create this timer using two triggers:

trigger alias "mendsuccess" "@trash@mend your wounds@trash@" timer TTS "mend" 6:00 "Mend is available"
trigger alias "mendfail" "@trash@worsened your wounds@trash@" timer TTS "mend" 6:00 "Mend is available"

This is all that is needed to create most of your old EQWatcher 1.76 triggers.  Below is an example of a timer using a placeholder trigger, which requires writing a script.

Complex timers are the ones you associated with placeholder triggers in EQWatcher 1.76.  Here is one timer example from an old TIMERS.EQM:

----------------
1;chief;*1;1440000;] You have slain Chief RokGus!;] Chief RokGus died.;] Your faction standing with
----------------
 

This timer plays a CD track based on one of three triggers hitting (the third being placeholder).  Here is the script code used for this timer, with the explanation below.

------------
boolean placeholder;

function main()
{
  placeholder=false;
}

trigger("[@trash@] You have slain Chief RokGus!")
{
  AddTimer("ChiefRokGus",1440000,SND_CD,"1");
  placeholder=false;
}

trigger("[@trash@] Chief RokGus died.")
{
  AddTimer("ChiefRokGus",1440000,SND_CD,"1");
  placeholder=false;
}

trigger("[@trash@] Your faction standing with @trash@")
{
  if(placeholder==true)
  {
    AddTimer("ChiefRokGus",1440000,SND_CD,"1");
    placeholder=false;
  }
}

alias("ph")
{
  placeholder=true;
  PlayWAVSync("sounds\\ph.wav");
}

alias("not ph")
{
  placeholder=false;
  PlayWAVSync("sounds\\ph.wav");
  PlayWAVSync("sounds\\off.wav");
}
------------

This code makes the timer function exactly the way it would have in EQWatcher 1.76.  As you can see, it required using three (3) triggers, and two (2) aliases.  I have also thrown a curve at you with a variable type you might not recognize.  "boolean" variables are "true" or "false", and generally used to turn things on or off.  The boolean variable used is not made public, since it is not for use in trigger or alias texts.  Aliases, as you see, are defined much the same way triggers are (and ALL EQWatcher commands are aliases, so if you understand how to do everything so far, you will know how to change any and all EQWatcher commands).

This example also shows how to set the value of variables, and basically how "if" statements work.  You can save the sample code and modify it as needed to re-create your old timers.  You will need to refer to the timers in scripting section to see how to format the "AddTimer" script command and how to use different types of sounds.  It should become clear after one or two uses, but SND_CD is for CD tracks, SND_MP3 is for MP3's, SND_WAV is for .WAV's, and SND_TTS is for Text-to-Speech (note that SND_SYNCWAV and SND_SYNCTTS are synchronous versions of SND_WAV and SND_TTS).

All of your scripting questions can be answered in the scripting section "Venturing into the Unknown", or feel free to email me or post on the message board, no matter how small, large, simple, or complex your question is.