Metis Scripting Part 2
Contents:*About Variables And The Variables
*Pushing And Popping A VariableStoring Info In A Variable
Welcome back to part 2.
Right this time we shall learn about variables and storing information in them so what is a variable, well there are 2 types of variables.
1. Dynamic Variable
2. Static VariableDynamic Variables
Dynamic Variables are variables you can both write and read data to/from. You can write data to them by using the push in commands. You may have as many uservariables as you want to read data from these variables you can use
$variable-name$ - where
variable-name is a unique name of the variable you want to read. variable-name may be any string or number you choose. For backward compatibility with old Metis versions you can also use
%USERVAR[variable-name]% to access the variables.
Static Variables
Static Variables are variables you can only read data from. Metis stores information in them such as Usernames, System time, and so on. Here is a list of all static Variables Metis offers, and in which commands you may use them.
Variable And What It Does%NAME% Username without the digits (ID) at the end of user that trigger the command
%RAWNAME% Complete name with ID of user that triggered the command
%RAWNAME[name]% Gets the corresponding rawname for a name or namepart (you can use this along with %PARAM% for example: %RAWNAME[%PARAM%]%)
%NICK% Name of the user truncated after the first underscore, space or dot in the name
%OLDNAME% Name of user without ID before renaming
%NEWNAME% Name of user without ID after renaming
%OLDRAWNAME% Name of user with ID before renaming
%NEWRANAME% Name of user with ID before renaming
%LOCALTIME% System time of your Computer in 24h format
%INETBEATS% Time in Internet beats (see www.swatch.com). This is an international standard time based on CET
%SYSTEMUPTIME% Time your Computer (Windows) has been running in hours/minutes/seconds/milliseconds
%TICKCOUNT% Time your Computer (Windows) has been running in milliseconds
%BOTUPTIME% Time the bot has been running.
%RANDOMNUM% A random number between 0 an 2000
%RANDOMNUM[nMax]% A random number between 0 an nMax
%FILES% Number of files, user has shared
%LINE% Connection type user is connected via (Cable, DSL, ISDN etc)
%IP% IP of user (WinMX 3.53 or compatible servers. Bot must have sufficient privileges to See IPs) x
%HOSTNAME% Hostname of user (WinMX 3.53 or compatible servers. Bot must have sufficient privileges to See IPs) x
%HOSTNAME[IP]% Resolves the hostname belonging to IP if any. Example: %HOSTNAME[127.0.0.1]%, %HOSTNAME[%PARAM%]%, %HOSTNAME[%USERVAR[n]%]%. Returns the IP if the hostname could not be resolved x
%USERVAR[n]% Uservariable. n may be between 0 and 49. You can store your own stuff in these variables
%PARAMETER% [or %PARAM%] A parameter forwarded from the trigger. must be present in both trigger and response. NOTE: %PARAM% MUST be at the end of the trigger: "!test %PARAM%". BAD: "!test %PARAM% some more text" will NOT work.
%TRIGGER% This variable contains the complete text of the message that triggered a <command>. If a one of your commands has the trigger "Hello, bot" and the user sends "Hello, bot my old pal", %TRIGGER% will contain "Hello, bot my old pal" ;-) This might be usefull to parse the trigger for more information (if %PARAM% is not sufficient...)
%VERSION% Release Version number of the Bot
%BOTNAME% Username of the bot uses in the channel
%BOTRAWNAME% Username of the bot uses in the channel including the userid
%SERVER% Name of the server brand the channel is hosted on (example: Ouka)
%SERVERVERSION% Versionnumber of the server the channel is hosted on (example: 3.53)
%WA-ARTIST% Artist of audiofile currently playing (requires Winamp 2.x or 5.x)
%WA-SONG% Songtitle of audiofile currently playing (requires Winamp 2.x or 5.x)
%WA-ELATIME% Elapsed time of file that is currently playing (requires Winamp 2.x or 5.x)
%WA-REMTIME% Remaining time of file that is currently playing (requires Winamp 2.x or 5.x)
%WA-TOTALTIME% Total time of file that is currently playing (requires Winamp 2.x or 5.x)
%WA-SAMPLERATE% Samplerate of audio file that is currently playing (requires Winamp 2.x or 5.x)
%WA-BITRATE% Bitrate of audio file that is currently playing (requires Winamp 2.x or 5.x)
%WA-CHANNELS% Number of Channels of audio file that is currently playing (requires Winamp 2.x or 5.x)
%WA-STATUS% Status of Winamp. Either "playing", "paused" or "stopped" (requires Winamp 2.x or 5.x)
%WA-ISVIDEO% "0" if Winamp plays an audio file "2" when Winamp plays a video, "1" if you are using Winamp 2.x (not supported) (requires Winamp 5.01/02)
%WA-VERSION% Version number of Winamp (2.91 i.e.) (requiresWinamp 2.x or 5.x)
%WA-ALBUM% Album of the song currently playing in winamp (requires Winamp 2.x or 5.x, installed RoboMX Winamp report plugin and a correctly tagged file)
%WA-TRACK% Tracknumber of the song currently playing in Winamp (requires Winamp 2.x or 5.x, installed RoboMX Winamp report plugin and a correctly tagged file)
%WA-COMMENT% Comment tag of the song currently playing in winamp (requires Winamp 2.x or 5.x, installed RoboMX Winamp report plugin and a correctly tagged file)
%WA-YEAR% Release year of the song currently playing in winamp (requires Winamp 2.x or 5.x, installed RoboMX Winamp report plugin and a correctly tagged file)
%WA-GENRE% Genre of the song currently playing in winamp (requires Winamp 2.x or 5.x, installed RoboMX Winamp report plugin and a correctly tagged file)
%RMX-CH-NUMCHANNELS% Number of channels on the WinMX Peernetwork (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-CH-NUMFILTERCHANNELS% Number of channels filtered out by RoboMX because they violated your filter settings (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-CH-NUMWINMX% Number of channels hosted on WinMX on the WinMX Peernetwork (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-CH-NUMROSE% Number of channels hosted on roboServe on the WinMX Peernetwork (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-CH-NUMRCMS% Number of channels using RCMS on the WinMX Peernetwork (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-CH-NUMMCMA% Number of channels using MCMA on the WinMX Peernetwork (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-CH-NUMMCS% Number of channels hosted with MCS on the WinMX Peernetwork (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-CH-NUMWCS% Number of channels hosted with WCS on the WinMX Peernetwork (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-CH-NUMWPNUSERS% Total number of users in all channels on the WinMX Peernetwork (requires RoboMX to be connected to the WPN and channellist to be loaded in RoboMX
%RMX-RM-AVERAGELAG% Average lag in the channel Metis runs in
%RMX-RM-RECVMSGS% Number of messages recieved by Metis since it entered the channel
%RMX-RM-SENTMSGS% Number of messages sent by Metis since it entered the channel
%EXEC_ERROR% If you use <out type="exec"> Metis will store the result of the ShellExecute call in this variable. (0 on success, other on failure. Check Windows API documentation for more details)
%OUT_EXEC_CODE% <out type="exec"> in blocking mode (extdata="1") Metis will store the exit code of the program you launched in this variable.
Pushing And Popping A Variable
Ok so you know the basic structure of a code now.
<command>
<in>Trigger</in>
<out>What Metis Says</out>
</command> << closing of the code.
Ok now lets look at
pushing a variable to store data / info.
So start of with a simple command but this time instead of just
<command> put this
<command type="script"> you will soon get into a habbit of putting the
type="script" in every code you make so by know you should have.
<command type="script">now the
<in><in>!store %PARAM%</in> ok so this tells metis what to do more or less it tells metis to do something with
%PARAM% this is the something, the
<out>, in previous scripts you just put
<out> now this is where it gets fun use this.
<out type="push" extdata="Store"">%PARAM%</out> > ok so now what ever %PARAM% was is now stored in the variable Store to signify a variable you use
$.
ok now close that command with your
</command>.
so now you should have a command that looks like this
<command type="script">
<in>!store %PARAM%</in>
<out type="push" extdata="Store">%PARAM%</out>
</command> ok now for the next bit
you need another command so
<command type="script">the <in> with be
<in>!show The Variable</in>the out will be the stored variable
<out>$Store$</out>close the command
</command>you should have a command that looks like this
<command type="script">
<in>!show The Variable</in>
<out>$Store$</out>
</command>To test your command in your room make sure you have turned your bot on and its in /bot mode
then type !store testThen Type !show the variableThats it For This Session Hope you learnt a lot from it.
Contact me with any suggestions.
MrScruff123@hotmail.co.uk
Thanks MrScruff
©2005-2024 WinMXWorld.com. All rights reserved. Page last updated Wed Mar 22 2006