EQWatcher Evolution > Scripting  > EQWatcher Functions


List of commands


BecomePublic, BreakPoint, charname, ChatFilter, Debug, EQPath, EQWatcherPath, Execute, FilterMap, GetFilterMap, GetPublic, GetScriptList, LastLog, LastNote, LoadCommands, LoadScript, servernumber, UnloadScript



The "BecomePublic" Command

This command allows a local (function-scope) variable to be masqueraded as a public variable.  This is similar to GetPublic, except that instead of just retrieving a copy of the data, this allows the variable to be used in place of the public variable -- with the ability to modify the public variable.  This could be used to use a public variable without knowing which variable.  If the public variable did not previously exist, it is created and will be used as the local variable's type.  If the variable name used is an empty string, this will fail and reset the local variable to 0 or "".

Syntax:

BecomePublic([Name])


Name:  The name of the public variable to masquerade as.


Return Value:

This command modifies the local variable used to catch the return value, in order to masquerade.  It is safe to re-masquerade the variable (a second time, as another variable, etc) if needed.


The "BreakPoint" Command

This command is used for debugging.  See the breakpoint window for more information.

Syntax:

BreakPoint()

Example:


function main()
{
// You can disable ALL of EQWatcher Evolution's TTS by using:
// DisableTTS();
// You may disable the core script's Text-to-Speech here, by
// replacing IsTTS() with the word false.

ttsactive=IsTTS();
SpeakSync("E Q Watcher Core Script Loaded");
/* Module Initialization */
CombatInitialize();
ChannelsInitialize();
LootInitialize();
NavigationInitialize();
SpellsInitialize();

BreakPoint();
/* Channel Preferences */

/* Verbose/Brief preference */
verbose=true; // Set to false to get commands to hush up!

AddTrigger("CORE: camp aborted","[@trash@] You abandon your preparations to camp.",SND_SYNCTTS,"Camp aborted");

}



The "charname" Command

This command returns the current character name (which is derived from the current log file name).

Syntax:

charname()

Return Value:

This command returns the current character name (which is derived from the current log file name), as a string type.

Example:


alias("who am i?")

  SpeakSync
(charname());
}



The "ChatFilter" Command

This command filters a string using the "character filter map", replacing characters with their filtered version.  For example, potentially removing instances of : and ) so that :) doesn't get spoken by the Text-to-Speech engine.

Syntax:

ChatFilter([Data])


Data: The string you wish to filter.


Return Value:

This command returns a string filtered version of Data.


The "Debug" Command

This command adds a line to the EQWatcher debugging log (eqwa.log)

Syntax:

Debug([Text])


Text:  The text to add to the debugging log



The "EQPath" Command

This command returns the full game path (depending on the current plugin)

Syntax:

EQPath()

Return Value:

This command returns the full game path (EverQuest, for example), as a string type.


The "EQWatcherPath" Command

This command returns the full EQWatcher Evolution path

Syntax:

EQWatcherPath()

Return Value:

This command returns the full EQWatcher Evolution path, as a string type.

Example:


// Example taken from loot2.eas by WhereDragon (an early version)

function LootInitialize()
{
  LootSoundSelf=false;
  LootSoundOther=true;
  LootSpeechSelf=true;
  LootSpeechOther=false;
  MoneyIn=false;
  MoneyOut=false;
  MoneyTotal=true;
  LootWavSelf=EQWatcherPath();
  strcat(LootWavSelf,"Sounds\\bang.wav");
  LootWavOther=EQWatcherPath();
  strcat(LootWavOther,"Sounds\\hey.wav");

  LoadMoney();
}
 



The "Execute" Command

This command executes an EQWatcher command (alias) immediately

Syntax:

Execute([EQWatcher Command])


EQWatcher Command:  The full text to execute


Example:


// Set sounds for silent mode.  Taken from a post by Braad on the message board
alias("set silent on")
{
  SpeakSync("Silent on");

  Execute("quiet");
  Execute("guild speech off");
  Execute("ooc speech off");
  Execute("shout speech off");
  Execute("say total on");
  Execute("say dps on");
  Execute("say speech off");
  Execute("say sound off");
  Execute("tell speech on");
  Execute("tell sound off");
  Execute("group speech on");
  Execute("loot other speech off");
  Execute("loot self speech off");
  Execute("verbose");
}
 



The "FilterMap" Command

This command sets a specified character in the filter map, causing ChatFilter to use this new character instead.  When the return string from ChatFilter is created, this map is used to replace the characters in the string.  For example, if you map 'a' to 'b', when an 'a' is encountered in the string to be filtered, 'b' is used instead.

Syntax:

FilterMap([Replace],[With])


Replace:  The character to be replaced by the filter, such as ')' or 41.

With:  The character to replace that character when building the filtered string, such as ' ' or 32.  If this value is 0, any matching character will simply be left out of the new string.


Return Value:

None


The "GetFilterMap" Command

This command retrieves the current mapping of a specified character, from the filter map (the filter map is used directly by ChatFilter).

Syntax:

GetFilterMap([Character])


Character:  The character's mapping to retrieve, such as 'a' or 97


Return Value:

This command returns the char value the specified character is mapped to.


The "GetPublic" Command

This command retrieves the data from a public variable (perhaps one in another script :)

Syntax:

GetPublic([Name])


Name:  The name of the public variable which contains the desired data


Return Value:

This command returns the data from the public variable called Name


The "GetScriptList" Command

This command creates a list of all currently loaded scripts.

Syntax:

GetScriptList()

Return Value:

This command returns a string containing a dynarray formatted list of currently loaded scripts.


The "LastLog" Command

This command returns the last line processed from the log file.

Syntax:

LastLog()

Return Value:

This command returns the last line processed from the log file, as a string type.


The "LastNote" Command

This command returns the last EQWatcher command processed (usually the last notes file line, but the last line run through aliases).

Syntax:

LastNote()

Return Value:

This command returns the last EQWatcher command processed (usually the last notes file line, but the last line run through aliases), as a string type.


The "LoadCommands" Command

This command processes a commands file, immediately.

Syntax:

LoadCommands([Command Filename])


Command Filename: The filename of the commands file to execute.  The .EWS extension is not automatically appended, it must always be given.



The "LoadScript" Command

This command loads a compiled script, and runs its main function, immediately.  If the script already has an instance loaded, it is not loaded.

Syntax:

LoadScript([Script Filename])


Script Filename: The filename of the script to load.  The .EAC extension is not automatically appended, it must always be given.



The "servernumber" Command

This command returns the current server number (which is derived from the current log file name).

Syntax:

servernumber()

Return Value:

This command returns the current server number (which is derived from the current log file name), as an integer type.

Example:


alias("what server am I on?")
{
  SpeakSync(itoa(servernumber()));
}




The "UnloadScript" Command

This command un-loads a compiled script, immediately.  All remnants of the script are removed, including all variables (public and otherwise), timers, triggers, and aliases.  If the script is not in memory, there is nothing to remove and nothing will happen.

Syntax:

UnloadScript([Script Filename])


Script Filename: The filename of the script to unload.  The .EAC extension is not automatically appended, it must always be given.