<config>

//////////////////////////////
//
//  Asciidex v0.1a by Pri (26th of August 2010)
//  This script requires Metis v2.80 & RoboMX v2.08
//  Website: www.mxpulse.com/board
//
///////  COMMANDS
//
//  !Pic [Name] or [Number] - Display a picture
//  !Pics [Page #] - View which art is available for displaying
//  !FindPic [Query] - Search your Picture Index for a specific piece of art
//  !Indexart - Trash the current Art Index and create a new batch file for the user to launch and index their art
//  !PrivateAsciidex - Typing this will set Asciidex to only give results privately to those who use the commands
//  !PublicAsciidex - Typing this will set Asciidex to give results to the entire room when someone uses the commands
//  !SetAsciidexColour [Number] - Set the menu colours to something other than the default Green (#c4#) to better fit your room
//
///////  SERVER SUPPORT
//
//  WCS, RCS, ZCS, RSWCS, FXServer and Ouka are all supported out of the box
//
//////////////////////////////


<usergroup name="Asciidex_Admin_Users" case="0">
// This usergroup is only for your admins so that they can control some of the special commands.
// Everyone even if they are not in this usergroup will be able to type !FindPic [Query], !Pic [Name] & !Pics [Page #]
*  ®ÊN  Pri  *
</usergroup>


<command type="script">
<in>!pic %PARAM%</in>
// Check that the command was used at the beginning of a sentance
<out type="push" extdata="req">%TRIGGER%</out>
<out type="push" extdata="req"><operator type="strleft" lvalue="$req$" rvalue="5"/></out>
<out type="break" condition="!?" lvalue="$req$" rvalue="!pic "></out>
// Load in the menucolour selected by the admins, if nothing found default is #c4#
<out type="push" extdata="Menu_Colour"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Menu.Colour.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Menu_Colour" condition="!?" lvalue="$Menu_Colour$" rvalue="#c"></out>
// Push PARAM to a variable because the readfile doesn't like mixing PARAM and Varibles together for some reason
<out type="push" extdata="Requested_Art">%PARAM%</out>
// Check that the scripts folder and settings file has been setup. If it hasn't do it.
<out type="push" extdata="Asciidex_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Asciidex.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Asciidex</out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\.Asciidex.ini" mode="t">1</out>
// Read in the Ascii Art Folder
<out type="push" extdata="Ascii_Folder"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Please specify your art folder in the file below</out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Saved in#c63#: #c62#C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt</out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt" mode="t">\nPlace the Directory in the line above this one. Example C:\Fast Ascii\FastASCII Add-Ons</out>
<out type="break" condition="==" lvalue="$Ascii_Folder$" rvalue=""></out>
// Check for an updated version of this script
<out type="push" extdata="Version_Info">v0.1a</out>
<out type="pop" extdata="Version_Release_Message"/>
<out type="push" extdata="Version_Check_Date"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Version.Check.Date.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Version_Info" condition="!=" lvalue="%USERVAR[Version_Check_Date]%" rvalue="%DATE%"><operator type="readweb" nvalue="http://asciidex.mxpulse.com/version.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Version_Release_Message" condition="!=" lvalue="%USERVAR[Version_Info]%" rvalue="v0.1a"><operator type="readweb" nvalue="http://asciidex.mxpulse.com/version.ini" lvalue="l" rvalue="2"/></out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#%USERVAR[Version_Release_Message]%</out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\.Version.Check.Date.txt" mode="t">%DATE%</out>
// Check the Index incase they user specified the number of the art in the index and not the name of the art.
<out type="push" extdata="LINERESULT"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt" lvalue="l" rvalue="%PARAM%"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".ini"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".txt"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".INI"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".TXT"/></out>
<out type="push" extdata="Requested_Art" condition="!=" lvalue="$LINERESULT$" rvalue="">$LINERESULT$</out>
// Check if the Ascii Art File exsists or not, It will by default look for .ini files, if one isn't present it will check for .txt
// Also some files start with a blank line so read in lines 1-3 looking for the start of the ascii
<out type="push" extdata="LINECOUNT">0</out>
<out type="push" extdata="FILETYPE">.ini</out>
<out type="push" extdata="FILECHECK"><operator type="readfile" nvalue="%USERVAR[Ascii_Folder]%\%USERVAR[Requested_Art]%%USERVAR[FILETYPE]%" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="LINECOUNT" condition="==" lvalue="$FILECHECK$" rvalue="">1</out>
<out type="push" extdata="FILECHECK" condition="==" lvalue="$FILECHECK$" rvalue=""><operator type="readfile" nvalue="%USERVAR[Ascii_Folder]%\%USERVAR[Requested_Art]%%USERVAR[FILETYPE]%" lvalue="l" rvalue="2"/></out>
<out type="push" extdata="LINECOUNT" condition="==" lvalue="$FILECHECK$" rvalue="">2</out>
<out type="push" extdata="FILECHECK" condition="==" lvalue="$FILECHECK$" rvalue=""><operator type="readfile" nvalue="%USERVAR[Ascii_Folder]%\%USERVAR[Requested_Art]%%USERVAR[FILETYPE]%" lvalue="l" rvalue="3"/></out>
<out type="push" extdata="FILETYPE" condition="==" lvalue="$FILECHECK$" rvalue="">.txt</out>
<out type="push" extdata="FILECHECK" condition="==" lvalue="$FILECHECK$" rvalue=""><operator type="readfile" nvalue="%USERVAR[Ascii_Folder]%\%USERVAR[Requested_Art]%%USERVAR[FILETYPE]%" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="LINECOUNT" condition="==" lvalue="$FILECHECK$" rvalue="">1</out>
<out type="push" extdata="FILECHECK" condition="==" lvalue="$FILECHECK$" rvalue=""><operator type="readfile" nvalue="%USERVAR[Ascii_Folder]%\%USERVAR[Requested_Art]%%USERVAR[FILETYPE]%" lvalue="l" rvalue="2"/></out>
<out type="push" extdata="LINECOUNT" condition="==" lvalue="$FILECHECK$" rvalue="">2</out>
<out type="push" extdata="FILECHECK" condition="==" lvalue="$FILECHECK$" rvalue=""><operator type="readfile" nvalue="%USERVAR[Ascii_Folder]%\%USERVAR[Requested_Art]%%USERVAR[FILETYPE]%" lvalue="l" rvalue="3"/></out>
// Display an error if no art was found matching this query
<out condition="==" lvalue="$FILECHECK$" rvalue="">#c1# · #c9#Art not found, make sure you have spelled it correctly, type #c62#!Pics #c9#to view an Index of images</out>
<out type="break" condition="==" lvalue="$FILECHECK$" rvalue=""></out>
// Try to display the art without the bot name in front so it looks cleaner, this requires a little server detection
<out type="push" extdata="Server_Notice_Command"></out>
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="WCS">/hidecmd /notice</out>
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="RCS">/hidecmd /notice</out>
// ZCS and WCS v1.8.8 both report themselves as WinMX and they both support /hidecmd /notice so we will use that if WinMX is reported as the server
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="WinMX">/hidecmd /notice</out>
//  Open the file and start reading through it
<out type="push" extdata="LINECOUNT"><operator type="+" lvalue="$LINECOUNT$" rvalue="1"/></out>
<out type="push" extdata="LINERESULT"><operator type="readfile" nvalue="%USERVAR[Ascii_Folder]%\%USERVAR[Requested_Art]%%USERVAR[FILETYPE]%" lvalue="l" rvalue="$LINECOUNT$"/></out>
<out condition="!=" lvalue="%USERVAR[LINERESULT]%" rvalue="">%USERVAR[Server_Notice_Command]% %USERVAR[LINERESULT]%</out>
<out type="goto" extdata="-3" condition="!=" lvalue="" rvalue="%USERVAR[LINERESULT]%"></out>
</command>


<command type="script">
<in type="exact">!pics</in>
<in type="exact">!Pics</in>
<in>!pics %PARAM%</in>
// Check that the command was used at the beginning of a sentance
<out type="push" extdata="req">%TRIGGER%</out>
<out type="push" extdata="req"><operator type="strleft" lvalue="$req$" rvalue="5"/></out>
<out type="break" condition="!?" lvalue="$req$" rvalue="!pics"></out>
// Pop a varible for later use
<out type="pop" extdata="Server_Private_Command"/>
// Load in the menucolour selected by the admins, if nothing found default is #c4#
<out type="push" extdata="Menu_Colour"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Menu.Colour.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Menu_Colour" condition="!?" lvalue="$Menu_Colour$" rvalue="#c"></out>
// Check if the script has been set to Public or Private Mode
<out type="push" extdata="Private_Public_Setting"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Server_Private_Command" condition="==" lvalue="$Private_Public_Setting$" rvalue="1"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini" lvalue="l" rvalue="2"/></out>
// If the user has selected to use private commands formulate how it should look for this query
<out type="push" extdata="Server_Private_Command"><operator type="strrep" nvalue="$Server_Private_Command$" lvalue=":@:RAWNAME:@:" rvalue="%RAWNAME%"/></out>
<out type="push" extdata="Server_Private_Command"><operator type="strrep" nvalue="$Server_Private_Command$" lvalue=":@:SPACE:@:" rvalue=" "/></out>
// Check that the scripts folder and settings file has been setup. If it hasn't do it.
<out type="push" extdata="Asciidex_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Asciidex.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Asciidex</out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="sleep" extdata="3000"></out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\.Asciidex.ini" mode="t">1</out>
// Read in the Ascii Art Folder
<out type="push" extdata="Ascii_Folder"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Please specify your art folder in the file below</out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Saved in#c63#: #c62#C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt</out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="" type="sleep" extdata="3000"></out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt" mode="t">\nPlace the Directory in the line above this one. Example C:\Fast Ascii\FastASCII Add-Ons</out>
<out type="break" condition="==" lvalue="$Ascii_Folder$" rvalue=""></out>
// Check if the Index File exsists or not
<out type="push" extdata="FILECHECK"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt" lvalue="l" rvalue="1"/></out>
<out type="file" extdata="%USERVAR[Ascii_Folder]%\Index_My_Ascii.bat" mode="t" condition="==" lvalue="$FILECHECK$" rvalue="">CD "%USERVAR[Ascii_Folder]%"\ndir /b > C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt</out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#A file called Index_My_Ascii.bat has been created in #c62#%USERVAR[Ascii_Folder]% #c9#Launch it to index your art.</out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#The index will be saved in#c63#: #c62#C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt</out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#You can re-index at any time and you can edit the index file above manually.</out>
<out type="break" condition="==" lvalue="$FILECHECK$" rvalue=""></out>
// +1 the Param for the next 'Page' Command
<out type="push" extdata="NextNum"><operator type="+" lvalue="%PARAM%" rvalue="1"/></out>
<out type="push" extdata="NextNum" condition="==" lvalue="%TRIGGER%" rvalue="!pics">2</out>
<out type="push" extdata="NextNum" condition="==" lvalue="%TRIGGER%" rvalue="!Pics">2</out>
// Take the Parameter and Multiply it by 20 so we know when to stop
<out type="push" extdata="start_number">%PARAM%</out>
<out type="push" extdata="start_number" condition="==" lvalue="$start_number$" rvalue="0">1</out>
<out type="push" extdata="start_number" condition="==" lvalue="%TRIGGER%" rvalue="!pics">1</out>
<out type="push" extdata="start_number" condition="==" lvalue="%TRIGGER%" rvalue="!Pics">1</out>
<out type="push" extdata="start_number" condition="!=" lvalue="$start_number$" rvalue="1"><operator type="*" lvalue="$start_number$" rvalue="20"/></out>
<out type="push" extdata="start_number" condition="!=" lvalue="$start_number$" rvalue="1"><operator type="-" lvalue="$start_number$" rvalue="20"/></out>
<out type="push" extdata="end_number"><operator type="+" lvalue="$start_number$" rvalue="20"/></out>
<out type="push" extdata="end_number" condition="==" lvalue="$start_number$" rvalue="1">20</out>
// Tell the user that the limit for pages of art is 99999
<out condition=">" lvalue="$start_number$" rvalue="99999">%USERVAR[Server_Private_Command]%#c1# · #c9#I'm sorry the listing only goes up to 99999 pages.</out>
<out type="break" condition=">" lvalue="$start_number$" rvalue="99999"></out>
// Check if this page even contains any art
<out type="push" extdata="LINERESULT"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt" lvalue="l" rvalue="$start_number$"/></out>
<out condition="==" lvalue="$LINERESULT$" rvalue="">%USERVAR[Server_Private_Command]%#c1# · #c9#No art found on this page, try a lower page number.</out>
<out type="break" condition="==" lvalue="$LINERESULT$" rvalue=""></out>
// Begin outputting the list of art to the user
<out>%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%List of Ascii Art#c63#:</out>
//  Open the file and start reading through it
<out type="push" extdata="LINECOUNT">$start_number$</out>
<out type="push" extdata="LINECOUNT" condition="==" lvalue="$LINECOUNT$" rvalue="1">0</out>
<out type="push" extdata="LINECOUNT"><operator type="+" lvalue="$LINECOUNT$" rvalue="1"/></out>
<out type="push" extdata="LINERESULT"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt" lvalue="l" rvalue="$LINECOUNT$"/></out>
// If .ini or .txt is found, allow it to be displayed, if not, skip
<out type="push" extdata="Valid_Filetype">0</out>
<out type="push" extdata="Valid_Filetype" condition="_?" lvalue="%USERVAR[LINERESULT]%" rvalue=".ini">1</out>
<out type="push" extdata="Valid_Filetype" condition="_?" lvalue="%USERVAR[LINERESULT]%" rvalue=".txt">1</out>
// Remove the filetype from the display so it looks neater
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".ini"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".txt"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".INI"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".TXT"/></out>
// Add a 0 to the linecount if its below 10 so the display looks neater
<out type="push" extdata="LINECOUNT" condition="<" lvalue="$LINECOUNT$" rvalue="10">0$LINECOUNT$</out>
<out condition="==" lvalue="%USERVAR[Valid_Filetype]%" rvalue="1">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# #c1#%USERVAR[LINECOUNT]% #c4#%USERVAR[Menu_Colour]% · #c1# %USERVAR[LINERESULT]%</out>
<out type="goto" extdata="2" condition="==" lvalue="%USERVAR[end_number]%" rvalue="%USERVAR[LINECOUNT]%"></out>
<out type="goto" extdata="-12" condition="!=" lvalue="%USERVAR[LINERESULT]%" rvalue=""></out>
// Let the user know that the ending has completed, if there are more to display give the user the next command prompt to view 20 more
<out condition="!=" lvalue="%USERVAR[end_number]%" rvalue="%USERVAR[LINECOUNT]%">%USERVAR[Server_Private_Command]%#c4# #c4# #c4# #c4# #c4# #c4#%USERVAR[Menu_Colour]%Type #c63#"#c62#!Pic ##c63#" #c4#%USERVAR[Menu_Colour]%to view a Picture #c62#·&gt;</out>
<out condition="==" lvalue="%USERVAR[end_number]%" rvalue="%USERVAR[LINECOUNT]%">%USERVAR[Server_Private_Command]%#c4# #c4# #c4# #c4# #c4# #c4#%USERVAR[Menu_Colour]%Type #c63#"#c62#!Pics %USERVAR[NextNum]%#c63#" #c4#%USERVAR[Menu_Colour]%to view 20 more #c62#·&gt;</out>
<out condition="==" lvalue="%USERVAR[end_number]%" rvalue="%USERVAR[LINECOUNT]%">%USERVAR[Server_Private_Command]%#c4# #c4# #c4# #c4# #c4# #c4#%USERVAR[Menu_Colour]%Type #c63#"#c62#!Pic ##c63#" #c4#%USERVAR[Menu_Colour]%to view a Picture #c62#·&gt;</out>
</command>


<command type="script">
<in>!findpic %PARAM%</in>
// Check that the command was used at the beginning of a sentance
<out type="push" extdata="req">%TRIGGER%</out>
<out type="push" extdata="req"><operator type="strleft" lvalue="$req$" rvalue="9"/></out>
<out type="break" condition="!?" lvalue="$req$" rvalue="!findpic "></out>
// Pop a varible for later use
<out type="pop" extdata="Server_Private_Command"/>
// Load in the menucolour selected by the admins, if nothing found default is #c4#
<out type="push" extdata="Menu_Colour"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Menu.Colour.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Menu_Colour" condition="!?" lvalue="$Menu_Colour$" rvalue="#c"></out>
// Check if the script has been set to Public or Private Mode
<out type="push" extdata="Private_Public_Setting"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Server_Private_Command" condition="==" lvalue="$Private_Public_Setting$" rvalue="1"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini" lvalue="l" rvalue="2"/></out>
// If the user has selected to use private commands formulate how it should look for this query
<out type="push" extdata="Server_Private_Command"><operator type="strrep" nvalue="$Server_Private_Command$" lvalue=":@:RAWNAME:@:" rvalue="%RAWNAME%"/></out>
<out type="push" extdata="Server_Private_Command"><operator type="strrep" nvalue="$Server_Private_Command$" lvalue=":@:SPACE:@:" rvalue=" "/></out>
// Check that the scripts folder and settings file has been setup. If it hasn't do it.
<out type="push" extdata="Asciidex_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Asciidex.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Asciidex</out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\.Asciidex.ini" mode="t">1</out>
// Read in the Ascii Art Folder
<out type="push" extdata="Ascii_Folder"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Please specify your art folder in the file below</out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Saved in#c63#: #c62#C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt</out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt" mode="t">\nPlace the Directory in the line above this one. Example C:\Fast Ascii\FastASCII Add-Ons</out>
<out type="break" condition="==" lvalue="$Ascii_Folder$" rvalue=""></out>
// Check if the Index File exsists or not
<out type="push" extdata="FILECHECK"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt" lvalue="l" rvalue="1"/></out>
<out type="file" extdata="%USERVAR[Ascii_Folder]%\Index_My_Ascii.bat" mode="t" condition="==" lvalue="$FILECHECK$" rvalue="">CD "%USERVAR[Ascii_Folder]%"\ndir /b > C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt</out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#A file called Index_My_Ascii.bat has been created in #c62#%USERVAR[Ascii_Folder]% #c9#Launch it to index your art.</out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#The index will be saved in#c63#: #c62#C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt</out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#You can re-index at any time and you can edit the index file above manually.</out>
<out type="break" condition="==" lvalue="$FILECHECK$" rvalue=""></out>
// Work out how many letters the user wants to search by
<out type="push" extdata="ISIT3">%PARAM%asdfm.</out>
<out type="push" extdata="InputAmount"><operator type="strrfind" lvalue="$ISIT3$" rvalue="asdfm."/></out>
// Send Menu Header
<out>%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Art matching your Query #c63#(#c62#%PARAM%#c63#)</out>
// Find and send results
<out type="push" extdata="Result_Amount">0</out>
<out type="push" extdata="LINECOUNT">0</out>
<out type="push" extdata="Result_Amount" condition="_?" lvalue="$result$" rvalue="%PARAM%"><operator type="+" lvalue="$Result_Amount$" rvalue="1"/></out>
<out type="push" extdata="LINECOUNT"><operator type="+" lvalue="$LINECOUNT$" rvalue="1"/></out>
<out type="push" extdata="LINERESULT"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt" lvalue="l" rvalue="$LINECOUNT$"/></out>
<out type="goto" extdata="14" condition="==" lvalue="$Result_Amount$" rvalue="20"></out>
<out type="goto" extdata="13" condition="==" lvalue="$LINERESULT$" rvalue=""></out>
// If .ini or .txt is found, allow it to be displayed, if not, skip
<out type="push" extdata="Valid_Filetype">0</out>
<out type="push" extdata="Valid_Filetype" condition="_?" lvalue="%USERVAR[LINERESULT]%" rvalue=".ini">1</out>
<out type="push" extdata="Valid_Filetype" condition="_?" lvalue="%USERVAR[LINERESULT]%" rvalue=".txt">1</out>
// Remove the filetype from the display so it looks neater
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".ini"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".txt"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".INI"/></out>
<out type="push" extdata="LINERESULT"><operator type="strrem" lvalue="$LINERESULT$" rvalue=".TXT"/></out>
<out type="goto" extdata="-11" condition="!=" lvalue="%USERVAR[Valid_Filetype]%" rvalue="1"></out>
<out type="push" extdata="result"><operator type="strleft" lvalue="$LINERESULT$" rvalue="$InputAmount$"/></out>
// Add a 0 to the linecount if its below 10 so the display looks neater
<out type="push" extdata="LINECOUNT" condition="<" lvalue="$LINECOUNT$" rvalue="10">0$LINECOUNT$</out>
<out condition="_?" lvalue="$result$" rvalue="%PARAM%">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# #c1#%USERVAR[LINECOUNT]% #c4#%USERVAR[Menu_Colour]% · #c1# %USERVAR[LINERESULT]%</out>
<out type="goto" extdata="-16" condition="!=" lvalue="%USERVAR[LINERESULT]%" rvalue=""></out>
// Send menu end
<out>%USERVAR[Server_Private_Command]%#c4# #c4# #c4# #c4# #c4# #c4#%USERVAR[Menu_Colour]%Type #c63#"#c62#!Pic ##c63#" #c4#%USERVAR[Menu_Colour]%to view a Picture #c62#·&gt;</out>
</command>


<command type="script" usergroup="Asciidex_Admin_Users">
<in>!indexart</in>
// Check that the scripts folder and settings file has been setup. If it hasn't do it.
<out type="push" extdata="Asciidex_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\.Asciidex.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Asciidex</out>
<out condition="==" lvalue="$Asciidex_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\.Asciidex.ini" mode="t">1</out>
// Read in the Ascii Art Folder
<out type="push" extdata="Ascii_Folder"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Please specify your art folder in the file below</out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Saved in#c63#: #c62#C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt</out>
<out condition="==" lvalue="$Ascii_Folder$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Asciidex\Your_Ascii_Directory.txt" mode="t">\nPlace the Directory in the line above this one. Example C:\Fast Ascii\FastASCII Add-Ons</out>
<out type="break" condition="==" lvalue="$Ascii_Folder$" rvalue=""></out>
// A batch file is going to be used to index the users Ascii to save time having the user do it manually.
// Because of some problems with Metis executing .bat files in certain directories we are going to tell the user to run the Batch File instead
<out type="file" extdata="%USERVAR[Ascii_Folder]%\Index_My_Ascii.bat" mode="t">CD "%USERVAR[Ascii_Folder]%"\ndir /b > C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt</out>
<out>/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#A file called Index_My_Ascii.bat has been created in #c62#%USERVAR[Ascii_Folder]% #c9#Launch it to index your art.</out>
<out>/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#The index will be saved in#c63#: #c62#C:\Pri.Script.Dependencies\Asciidex\List_Of_Your_Ascii.txt</out>
<out>/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#You can re-index at any time and you can edit the index file above manually.</out>
</command>


<command type="script" usergroup="Asciidex_Admin_Users">
<in>!privateasciidex</in>
<in>!publicasciidex</in>
// Check if the command was typed at the start of a sentence, if not break
<out type="push" extdata="Asciidex_CMD_REQ">%TRIGGER%</out>
<out type="push" extdata="Asciidex_CMD_REQ"><operator type="strleft" lvalue="$Asciidex_CMD_REQ$" rvalue="1"/></out>
<out type="break" condition="!_?" lvalue="$Asciidex_CMD_REQ$" rvalue="!"></out>
// Process which command the user typed
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="!privateAsciidex" extdata="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini">1\n</out>
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="!publicAsciidex" extdata="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini">0</out>
// Output to the Admins if it was set to Public Mode
<out condition="_?" lvalue="%TRIGGER%" rvalue="!publicAsciidex">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c1#Asciidex Has been set to Public Mode</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!publicAsciidex">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c62#When this is set to Public, all Asciidex results will be shown to the entire room</out>
// Break if the user selected to use Public
<out type="break" condition="_?" lvalue="%TRIGGER%" rvalue="!publicAsciidex"></out>
// If the user selected PrivateAsciidex, work out which server is in use
<out type="push" extdata="Server_Private_Command">0</out>
<out type="push" extdata="Server_Private_Command" condition="?" lvalue="%SERVER%" rvalue="WCS">/hidecmd /privnotice :@:RAWNAME:@::@:SPACE:@:</out>
<out type="push" extdata="Server_Private_Command" condition="?" lvalue="%SERVER%" rvalue="RCS">/hidecmd /privnotice :@:RAWNAME:@::@:SPACE:@:</out>
<out type="push" extdata="Server_Private_Command" condition="?" lvalue="%SERVER%" rvalue="FXServer">/message :@:RAWNAME:@::@:SPACE:@:</out>
<out type="push" extdata="Server_Private_Command" condition="?" lvalue="%SERVER%" rvalue="Ouka">#private :@:RAWNAME:@: #message:@:SPACE:@:</out>
// Because ZCS does not report itself as ZCS and instead as WinMX we are just going to assume that WinMX = ZCS
<out type="push" extdata="Server_Private_Command" condition="?" lvalue="%SERVER%" rvalue="WinMX">/privnotice :@:RAWNAME:@::@:SPACE:@:</out>
// Save the command for later use
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini">%USERVAR[Server_Private_Command]%</out>
// Server not recognised Message
<out condition="==" lvalue="$Server_Private_Command$" rvalue="0">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#Asciidex cannot be set to Private in your room as the Server #c63#(#c62#%SERVER%#c63#)#c9# is not supported by the script currently</out>
<out type="file" mode="t" condition="==" lvalue="$Server_Private_Command$" rvalue="0" extdata="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini">0</out>
<out type="break" condition="==" lvalue="$Server_Private_Command$" rvalue="0"></out>
// Output to the Admins if it was set to Private Mode
<out condition="_?" lvalue="%TRIGGER%" rvalue="!privateAsciidex">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c1#Asciidex Has been set to Private Mode</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!privateAsciidex">/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c62#When this is set to Private, only those who use the !Pics &amp; !Findpic commands will see results</out>
// Check that WCS 1.8.8 is in use if the Server is reporting itself as WinMX
<out type="push" extdata="Asciidex_Checking_For_WCS" condition="?" lvalue="%SERVER%" rvalue="WinMX">1</out>
<out condition="?" lvalue="%SERVER%" rvalue="WinMX">/stats</out>
</command>


<command type="script" condition="==" lvalue="$Asciidex_Checking_For_WCS$" rvalue="1">
<in>WCS Version: %PARAM%</in>
// Tell the user that WCS was detected and that they may have seen some temporary garbled text
<out>/opmsg #c4#%USERVAR[Menu_Colour]%Asciidex #c63#(#c62#v0.1a#c63#): #c9#WCS %PARAM% has been detected, You may have seen some /privnotice commands above this is normal during WCS %PARAM% detection due to a bug in the server</out>
// If WCS was detected then save that
<out type="file" mode="t" extdata="C:\Pri.Script.Dependencies\Asciidex\.Public.Private.Server.Settings.ini">1\n/hidecmd /privnotice :@:RAWNAME:@::@:SPACE:@:</out>
// Push 0 to Checking for WCS
<out type="push" extdata="Asciidex_Checking_For_WCS">0</out>
</command>


<command type="script" usergroup="Asciidex_Admin_Users">
<in>!setasciidexcolour %PARAM%</in>
<in>!setasciidexcolor %PARAM%</in>
// Check if the command was typed at the start of a sentence, if not break
<out type="push" extdata="Asciidex_CMD_REQ">%TRIGGER%</out>
<out type="push" extdata="Asciidex_CMD_REQ"><operator type="strleft" lvalue="$Asciidex_CMD_REQ$" rvalue="16"/></out>
<out type="break" condition="!_?" lvalue="$Asciidex_CMD_REQ$" rvalue="!setasciidexcolo"></out>
// Encapsulate parameter with colour tags if none are present and save to file
<out type="file" mode="t" condition="?" lvalue="%PARAM%" rvalue="#c" extdata="C:\Pri.Script.Dependencies\Asciidex\.Menu.Colour.ini">%PARAM%\n</out>
<out type="file" mode="t" condition="!?" lvalue="%PARAM%" rvalue="#c" extdata="C:\Pri.Script.Dependencies\Asciidex\.Menu.Colour.ini">#c%PARAM%#\n</out>
// Output to the Admins what colour it has been set to
<out condition="?" lvalue="%PARAM%" rvalue="#c">/opmsg #c4#%PARAM%Asciidex #c63#(#c62#v0.1a#c63#): #c1#Asciidex Has set its colours to#c63#: %PARAM% |||||</out>
<out condition="!?" lvalue="%PARAM%" rvalue="#c">/opmsg #c4##c%PARAM%#Asciidex #c63#(#c62#v0.1a#c63#): #c1#Asciidex Has set its colours to#c63#: #c%PARAM%# |||||</out>
</command>



</config>