<config>

//////////////////////////////////////////////
// READ CAREFULLY ALL COMMENT LINES !!!
//////////////////////////////////////////////
//  Any Line with // infront is a Comment line, this means it won't be Executed but it will contain information for you (The User) to read
//////////////////////////////////////////////


//////////////////////////////////////////////
//  Ascii Output v0.3 by Pri Written on the 3rd of February 2009 (Updated 4th of February)
//  Recommended Metis Version for this Script: 2.70 Test 6 -or- 2.80
//  You may Edit this Code in any way you want. If you distribute this Copy or a Modified copy you must credit Pri in the XML file
//////////////////////////////////////////////
//  This script cannot be used until you (The User) modifies it.
//  You need to Modify 2 Things, First you must create a file inside your Ascii folder called index.of.ascii.ini
//  You will also need to edit the Code below to point to that folder which contains that file
//  Inside that file (index.of.ascii.ini) you will place the filenames of any Ascii drawings you wish your users to know about and have access to.
//  You will then need to look in this code for the 4 lines which contain the line 'C:\YOUR-ASCII-FOLDER\' and change that to your AScii Folder, Example 'C:\Ascii\Drawings\'
//////////////////////////////////////////////



//  The following Command will be what your Users type to display a Picture in-room
//  You can Alter this Trigger to suit your needs, it will not adversely effect anything
<command type="script" mode="thread">
<in>!pic %PARAM%</in>
//  This part of the Code is used to check if the user has chosen a file that uses .txt or .ini (If Nothing is Present Default = .ini)
<out type="push" extdata="FILETYPE" condition="!_?" lvalue="%PARAM%" rvalue=".txt">.ini</out>
<out type="push" extdata="FILETYPE" condition="_?" lvalue="%PARAM%" rvalue=".txt">.txt</out>
<out type="push" extdata="FILENAME">%PARAM%</out>
<out type="push" extdata="FILENAME"><operator type="strrem" lvalue="$FILENAME$" rvalue=".txt"/></out>
<out type="push" extdata="FILENAME"><operator type="strrem" lvalue="$FILENAME$" rvalue=".TXT"/></out>
<out type="push" extdata="FILENAME"><operator type="strrem" lvalue="$FILENAME$" rvalue=".ini"/></out>
<out type="push" extdata="FILENAME"><operator type="strrem" lvalue="$FILENAME$" rvalue=".INI"/></out>
//  This part of the Code is used to check if the Ascii Art File exsists or not
<out type="pop" extdata="FILECHECK"/>
<out type="push" extdata="FILECHECK"><operator type="readfile" nvalue="C:\YOUR-ASCII-FOLDER\$FILENAME$$FILETYPE$" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">#c1#Art not found, make sure you have spelled it correctly (Capital Sensitive) type #c10#!ascii #c1#or #c10#!pics #c1#to view an Index of images</out>
<out type="break" condition="==" lvalue="$FILECHECK$" rvalue=""></out>
//  This part of the code is used to open the file and begin going through the image line by line outputting what is found to the Room
<out type="push" extdata="LINECOUNT">0</out>
<out type="push" extdata="LINECOUNT"><operator type="+" lvalue="$LINECOUNT$" rvalue="1"/></out>
<out type="push" extdata="LINERESULT"><operator type="readfile" nvalue="C:\YOUR-ASCII-FOLDER\$FILENAME$$FILETYPE$" lvalue="l" rvalue="$LINECOUNT$"/></out>
<out condition="!=" lvalue="" rvalue="$LINERESULT$">$LINERESULT$</out>
<out type="goto" extdata="-3" condition="!=" lvalue="" rvalue="$LINERESULT$"></out>
</command>

//  The following command is for users of your room to locate what Images are present in your Ascii folder (To be displayed in-room)
//  You can Alter any of these Triggers to suit your needs, it will not adversely effect anything
<command type="script" mode="thread">
<in>!ascii</in>
<in>!listpics</in>
<in>!pics</in>
//  This part of the Code is used to check if the Index File exsists or not
<out type="pop" extdata="FILECHECK"/>
<out type="push" extdata="FILECHECK"><operator type="readfile" nvalue="C:\YOUR-ASCII-FOLDER\index.of.ascii.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c1#Sorry admin but no Index file of your Art has yet been found, Please go to your Art folder and create the file #c4#index.of.ascii.ini</out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c1#Once you have created the file fill each individual line with the filename of a piece of art. It is recommended you do this Alphabetically</out>
<out type="break" condition="==" lvalue="$FILECHECK$" rvalue=""></out>
//  This part of the code is used to open the Index file and begin outputting what is found to the user. 
//  It is recommended that you add '/hidecmd /privnotice %NAME%' to the Output lines (For WCS or RSWCS) or '/message %NAME%' (For FXServer) if you care about room Spam
<out>List of Ascii Art:</out>
<out type="push" extdata="LINECOUNT">0</out>
<out type="push" extdata="LINECOUNT"><operator type="+" lvalue="$LINECOUNT$" rvalue="1"/></out>
<out type="push" extdata="LINERESULT"><operator type="readfile" nvalue="C:\YOUR-ASCII-FOLDER\index.of.ascii.ini" lvalue="l" rvalue="$LINECOUNT$"/></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 condition="!=" lvalue="" rvalue="$LINERESULT$">$LINERESULT$</out>
<out type="goto" extdata="-5" condition="!=" lvalue="" rvalue="$LINERESULT$"></out>
</command>

//////////////////////////////////////////////
//  Need Help?
//////////////////////////////////////////////
//  FAQ (Frequently Asked Questions)
//  Q: I want to Customise the Output lines but I don't know which line of code that is?
//  A: This is the Line you probably want to Customise, it is in the code Twice (In Both Command Scripts) '<out condition="!=" lvalue="" rvalue="$LINERESULT$">$LINERESULT$</out>'
//
//  Q: Why do I have to create an Index File for my Art?
//  A: You don't, but if you want users to be able to see the Art avalible then its a good idea
//
//  Q: Why cant the Bot automatically detect what files are in the Folder and Display those to the User?
//  A: This can be accomplished using the Windows Command Prompt however you may have Images or Files in the Ascii Folder that you don't want people to use. So by default you need to populate an Index to save users from themselves
//
//  Q: What if my Art is in .txt instead of .ini files?
//  A: Then type the name of the file + the word .txt at the end example !pic kitten.txt
//
//  Q: Why do you Recommend Metis 2.70 and 2.80 for this Script?
//  A: Anything Older may have difficulty with the complexity in this script, these are the only versions that this is guaranteed to work under.
//////////////////////////////////////////////

//////////////////////////////////////////////
//  List of Custom Parameters used and what information they store:
//  FILECHECK  - Contains First line of Data on any Files loaded to Check if they actually contain anything or not
//  LINECOUNT  - Contains the current number of the line that the Bot is currently reading on any Text files
//  LINERESULT - Contains information that has been read from the current line in the file based on the Number from LINECOUNT
//  FILETYPE   - Contains either .txt or .ini based on what the User has selected for the filetype of the image (If nothing is supplied the default will always be .ini)
//  FILENAME   - Contains the Filename of the Ascii Art that the user has picked (without the Filetype which is held above)
//////////////////////////////////////////////

</config>