<config>


////////////// This software is Alpha and not feature complete
//
//  Link Saver v0.2 by Pri (9th of October 2011)
//  This script requires Metis v2.80 & RoboMX v2.08
//  Please use Metis v2.82 for the smoothest experience: http://bit.ly/ldk6C3
//  Website: http://www.renmx.com
//  Forum: http://www.mxpulse.com/board
//
///////  COMMANDS
//
//  !Links [#] - Browse Links Page by Page (Newest at the top)
//  !FindLink [Query] - Search for specific links (Newest at the top)
//  !RemoveLink [Query] - Remove specific links from the index (Requires Admin Usergroup)
//  !UndoRemove - Undo the removal of your previous links (Only the very last ones you removed)
//  !PrivateLinks - Typing this will set Link Saver Menus to only give results privately to those who use the command (Default)
//  !PublicLinks - Typing this will set Link Saver Menus to give results to the entire room when someone uses the command
//  !SetLinkColour [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
//
///////  KNOWN ISSUES
//
//  In the Customisation Settings File there is an option to restrict how many links can be deleted at one time
//  This setting currently does nothing and an unlimited amount of links can be removed by an admin.
//  However the !UndoRemove command functions fine so if you delete more links than you meant to simply undo it.
//  I intend to use this setting in the next version of the script so don't delete it out of the config file!
//
//  Some page titles may contain encodings that the script is unable to interperate this may result in garbled text
//  If you find any of this don't worry it won't break anything it will just make things look a little funky
//  
//  This script is completely Alpha meaning it is not feature complete. I am planning new additions to the code
//  but I wanted to see how people respond to it in its current form before I continue with development.
//
//  If you have any suggestions or feature requests don't hesitate to contact me in the Renegades Chat Room on WinMX
//  or through this scripts topic on my forum: http://www.mxpulse.com/board/viewtopic.php?f=9&t=231
//
//////////////


<usergroup name="Link_Saver_Admin_Users" case="0">
// This usergroup is only for your admins so that they can control some of the special commands.
// Only users in this group will be able to Delete links. Anyone however can post links to be saved.
*  ®ÊN  Pri  *
</usergroup>


<command type="script">
<in>http://%PARAM%</in>
<in>https://%PARAM%</in>
// This script can detect a URL in any part of a sentence, but we don't want it to do that if the sentence begins with ! or /
<out type="push" extdata="CMD_REQ">%TRIGGER%</out>
<out type="push" extdata="CMD_REQ"><operator type="strleft" lvalue="$CMD_REQ$" rvalue="1"/></out>
<out type="break" condition="==" lvalue="$CMD_REQ$" rvalue="!"></out>
<out type="break" condition="==" lvalue="$CMD_REQ$" rvalue="/"></out>
// Check that the scripts folder and settings files have been setup. If they haven't then do so.
<out type="push" extdata="Link_Saver_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.Link.Saver.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Link_Saver_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Link.Saver\Cache</out>
<out condition="==" lvalue="$Link_Saver_Setup_Check$" rvalue="" type="sleep" extdata="3000"></out>
<out condition="==" lvalue="$Link_Saver_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Link.Saver.ini" mode="t">1</out>
<out condition="==" lvalue="$Link_Saver_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Link.Index.File.ini" mode="t">Link.Index.Content.1.txt</out>
// If this is the first setup write the massive customisation settings file
<out condition="==" lvalue="$Link_Saver_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\Customisation.Settings.File.ini" mode="t">### This is the Link Saver settings file, you can customise many aspects of the Link Saver from here ###\n### Using this file is simple, Just change the output text to what you want, you can use colour codes too! ###\n\n### Change these formats below to alter how things appear in-room, Changes happen as soon as you save this file ###\n\nLink Posted Format: #c4#[Link Saver Name/Version] #c1#[Bitly URL] #c9#- #c63#"#c62#[Page Title]#c63#" #c9#(#c4#[Save Message]#c9#)\nLink Browsing Format: #c1# [Original Link] #c63# | #c62# [Bitly URL]\nLink Searching Format: #c1# [Original Link] #c63# | #c62# [Bitly URL]\nLink Removal Format: #c4#[Link Saver Name/Version] #c1#[Original Link] #c62#Has been removed from the index\n\n### Basic Variable Changes below ###\n\nMaximum Amount Links per Browse Page: 20\nMaximum Amount of !findlink Results: 20\nMaximum Amount of Deletions: 3\n\n### You can use any of these variables below in your custom formats ###\n\n- [Link Saver Name/Version] [Bitly URL] [Page Title] [Save Message] [Original Link] [Short Name]\n- [Raw Name] [Link Number] [Date] [Time]\n\n### The variable [Save Message] is only used when links are posted in the room. It may say (Saved) or (Loaded from Cache) ###\n### In the variable [Short Name] colour codes are removed from the users name to make it look nicer, use [Raw Name] if you want these kept in ###</out>
// If the user selected PrivateLinkSaver, work out which server is in use
// Skip if this isnt a new install
<out type="goto" extdata="8" condition="!=" lvalue="$Link_Saver_Setup_Check$" rvalue=""></out>
<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\Link.Saver\.Public.Private.Server.Settings.ini">1\n%USERVAR[Server_Private_Command]%</out>
// Check that the user has the correct version of Metis to run this script by querying my server and checking for a file, if this file doesn't display right tell the user to update
// The reason this code has Pulse in it is because it's just copy and pasted from the Pulse script and it uses less web queries to share the same variable name this way
<out type="push" extdata="Pulse_Metis_Check" condition="==" lvalue="%USERVAR[Pulse_Metis_Check]%" rvalue=""><operator type="readweb" nvalue="http://pulse.protection.mxpulse.com/metis.check.ini" lvalue="l" rvalue="1"/></out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Link Saver #c63#(#c62#v0.2#c63#): #c9#You appear to be running an outdated version of Metis.</out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Link Saver #c63#(#c62#v0.2#c63#): #c9#You can download the latest one here#c63#: #c62#http://www.mxpulse.com/metis/Metis.r2x</out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Link Saver #c63#(#c62#v0.2#c63#): #c9#To install this file replace your old Metis.r2x file located in your script plugins folder</out>
<out type="break" condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849"></out>
// Check if the user is using Metis v2.82, if not suggest version v2.82 - Only make this recommendation once
<out type="push" extdata="ReminderCount" condition="!=" lvalue="%VERSION%" rvalue="2.82"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.Metis.Version.Reminder.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="ReminderCount" condition="!=" lvalue="%VERSION%" rvalue="2.82"><operator type="+" lvalue="$ReminderCount$" rvalue="1"/></out>
<out condition="!=" lvalue="%VERSION%" rvalue="2.82" type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Metis.Version.Reminder.ini" mode="t">$ReminderCount$</out>
<out type="goto" extdata="3" condition=">" lvalue="$ReminderCount$" rvalue="1"></out> 
<out condition="!=" lvalue="%VERSION%" rvalue="2.82">/opmsg #c4#Link Saver #c63#(#c62#v0.2#c63#): #c9##c9#This script works best with Metis v2.82, please upgrade from v%VERSION%#c63#: #c62#http://bit.ly/ldk6C3</out>
<out condition="!=" lvalue="%VERSION%" rvalue="2.82">/opmsg #c4#Link Saver #c63#(#c62#v0.2#c63#): #c9#Reminder #c62#1#c9# of 1</out>
// Pop some variables 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\Link.Saver\.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\Link.Saver\.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\Link.Saver\.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 for an updated version of this script
<out type="push" extdata="Version_Info">v0.2</out>
<out type="pop" extdata="Version_Release_Message"/>
<out type="push" extdata="Version_Check_Date"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.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://link.saver.mxpulse.com/version.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Version_Release_Message" condition="!=" lvalue="%USERVAR[Version_Info]%" rvalue="v0.2"><operator type="readweb" nvalue="http://link.saver.mxpulse.com/version.ini" lvalue="l" rvalue="2"/></out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c9#%USERVAR[Version_Release_Message]%</out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Version.Check.Date.txt" mode="t">%DATE%</out>
// Check which index file is currently in use
<out type="push" extdata="Link_Index_File"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.Link.Index.File.ini" lvalue="l" rvalue="1"/></out>
// Load in the Customisation Settings File to get the format that the user selected
<out type="push" extdata="SETTINGS_LINE">0</out>
<out type="push" extdata="SETTINGS_LINE"><operator type="+" lvalue="$SETTINGS_LINE$" rvalue="1"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Customisation.Settings.File.ini" lvalue="l" rvalue="$SETTINGS_LINE$"/></out>
<out type="goto" extdata="2" condition="?" lvalue="$Custom_Output_Format$" rvalue="Link Posted Format: "></out>
<out type="goto" extdata="-3" condition="!=" lvalue="$SETTINGS_LINE$" rvalue="20"></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrem" lvalue="$Custom_Output_Format$" rvalue="Link Posted Format: "/></out>
// Clear some variables
<out type="pop" extdata="QUERY"></out>
// Display the Bit.ly Shorturl + Page Title using /notice if it's possible
<out type="push" extdata="Server_Notice_Command"></out>
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="WCS">/hidecmd /notice #c4#</out>
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="RCS">/hidecmd /notice #c4#</out>
// Metis thinks that ZCS and WCS v1.8.8 are WinMX Hosted Chatrooms 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 #c4#</out>
// Push the Trigger to a variable that we can process
<out type="push" extdata="Users_Link">%TRIGGER%</out>
// Push the entire trigger to a text file then read back only the link in to Users_Link variable.
// The reason there are so many duplicate replaces here is due to users who post links surrounded by ungodly amount of spaces
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="  " rvalue=" "/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="  " rvalue=" "/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="  " rvalue=" "/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="  " rvalue=" "/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="  " rvalue=" "/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="  " rvalue=" "/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue=" " rvalue="\n"/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="\n\n" rvalue="\n"/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="\n\n" rvalue="\n"/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="\n\n" rvalue="\n"/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="\n\n" rvalue="\n"/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="$Users_Link$" lvalue="\n\n" rvalue="\n"/></out>
<out type="file" mode="t" extdata="C:\Pri.Script.Dependencies\Link.Saver\Cache\URL_Filtering.txt">%USERVAR[Users_Link]%\n</out>
// Now read only the link back
<out type="push" extdata="LINECOUNT">0</out>
<out type="push" extdata="LINECOUNT"><operator type="+" lvalue="$LINECOUNT$" rvalue="1"/></out>
<out type="push" extdata="READFILTERLINE"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\URL_Filtering.txt" lvalue="l" rvalue="$LINECOUNT$"/></out>
<out type="push" extdata="Users_Link" condition="_?" lvalue="%USERVAR[READFILTERLINE]%" rvalue="http">%USERVAR[READFILTERLINE]%</out>
<out type="goto" extdata="-3" condition="!=" lvalue="%USERVAR[READFILTERLINE]%" rvalue=""></out>
<out type="break" condition="!_?" lvalue="$Users_Link$" rvalue="http"></out>
// Check the Cache for this URL, but first remove some characters that cannot be saved to the hard disk such as / ? and :
<out type="push" extdata="searchrequest">%USERVAR[Users_Link]%</out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="/"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="?"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=":"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=";"/></out>
<out type="push" extdata="URLDATE"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="URLCACHE" condition="==" lvalue="$URLDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="2"/></out>
// If line 8 says this link was deleted then pop URLDATE so that a new cache is created
<out type="push" extdata="Entry_Deleted_Or_Not"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="8"/></out>
<out type="pop" extdata="URLDATE" condition="==" lvalue="$Entry_Deleted_Or_Not$" rvalue="Deleted"></out>
// Output the Cache to the user if the date is within 1 month
<out type="goto" extdata="9" condition="!=" lvalue="$URLDATE$" rvalue="%MONTH%"></out>
<out type="push" extdata="Title_Content"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="3"/></out>
// Use the Custom Format read in earlier to create the final output that appears in the room
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Link Saver Name/Version]" rvalue="Link Saver #c63#(#c62#v0.2#c63#):"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Bitly URL]" rvalue="%USERVAR[URLCACHE]%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Page Title]" rvalue="%USERVAR[Title_Content]%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Save Message]" rvalue="Loaded from Cache"/></out>
// Depending on if a Title is cached or not show that
<out condition="!=" lvalue="$Title_Content$" rvalue="">%USERVAR[Server_Notice_Command]%%USERVAR[Custom_Output_Format]%</out>
<out condition="==" lvalue="$Title_Content$" rvalue="">%USERVAR[Server_Notice_Command]%%USERVAR[Custom_Output_Format]%</out>
<out type="break" condition="==" lvalue="$URLDATE$" rvalue="%MONTH%"></out>
// Replace some symbols in the URL that won't work in a httpget request
<out type="push" extdata="Original_Link">%USERVAR[Users_Link]%</out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="%USERVAR[Users_Link]%" lvalue="&amp;lowast;" rvalue="[star]"/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="%USERVAR[Users_Link]%" lvalue="&amp;" rvalue="[and]"/></out>
<out type="push" extdata="Users_Link"><operator type="strrep" nvalue="%USERVAR[Users_Link]%" lvalue="#" rvalue="[hash]"/></out>
// Query the API to get the Bit.ly short-url and the Title of the page (Please do not use this in your own software, get your own API key from bit.ly - It's free!)
<out type="push" extdata="QUERY">http://link.saver.mxpulse.com/?url=%USERVAR[Users_Link]%</out>
<out type="push" extdata="Title_Content"><operator type="readweb" nvalue="%USERVAR[QUERY]%" lvalue="l" rvalue="2"/></out>
<out type="push" extdata="Bitly_URL"><operator type="readweb" nvalue="%USERVAR[QUERY]%" lvalue="l" rvalue="1"/></out>
// Bitly_URL variable should contain some API conditions such as [ON], [OFF] or [MAINTENANCE]
// The script uses these to guage the API's Health and report on its status to the Admins of the room (If required)
<out type="push" extdata="API_Health_Message">An unknown error has occurred trying to contact the Link Saver online API</out>
<out type="push" extdata="API_Health_Message" condition="?" lvalue="$Bitly_URL$" rvalue="[MAINTENANCE]">The Link Saver online API is currently undergoing maintenance and will be temporarily unavailable</out>
<out type="push" extdata="API_Health_Message" condition="?" lvalue="$Bitly_URL$" rvalue="[OFF]">The Link Saver online API is currently off, please check RenMX.com for more information</out>
<out condition="!?" lvalue="$Bitly_URL$" rvalue="[ON]">#c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c9#%USERVAR[API_Health_Message]%</out>
<out type="break" condition="!?" lvalue="$Bitly_URL$" rvalue="[ON]"></out>
// Remove the [ON] message from the API response so it doesn't get output to the room or saved in a cache
<out type="push" extdata="Bitly_URL"><operator type="strrem" lvalue="%USERVAR[Bitly_URL]%" rvalue="[ON]"/></out>
// Replace some un-metis friendly characters. The API will do most replace work, this is "just in case"
<out type="push" extdata="Title_Content"><operator type="strrem" lvalue="%USERVAR[Title_Content]%" rvalue="\t"/></out>
<out type="push" extdata="Title_Content"><operator type="strrem" lvalue="%USERVAR[Title_Content]%" rvalue="    "/></out>
<out type="push" extdata="Title_Content"><operator type="strrem" lvalue="%USERVAR[Title_Content]%" rvalue="       "/></out>
<out type="push" extdata="Title_Content"><operator type="strrem" lvalue="%USERVAR[Title_Content]%" rvalue="x202a"/></out>
<out type="push" extdata="Title_Content"><operator type="strrem" lvalue="%USERVAR[Title_Content]%" rvalue="x202crlm  "/></out>
<out type="push" extdata="Title_Content"><operator type="strrem" lvalue="%USERVAR[Title_Content]%" rvalue="x202crlm"/></out>
<out type="push" extdata="Title_Content"><operator type="strrep" nvalue="%USERVAR[Title_Content]%" lvalue="YouTube- " rvalue="YouTube - "/></out>
// Filter the title a bit for special characters
<out type="push" extdata="Title_Content"><operator type="strrep" nvalue="$Title_Content$" lvalue="&amp;nbsp;" rvalue=" - "/></out>
<out type="push" extdata="Title_Content"><operator type="strrep" nvalue="$Title_Content$" lvalue="&amp;#124;" rvalue="|"/></out>
<out type="push" extdata="Title_Content"><operator type="strrep" nvalue="$Title_Content$" lvalue="&amp;laquo;" rvalue="«"/></out>
// Break if Title Content includes http or https
<out type="break" condition="_?" lvalue="$Title_Content$" rvalue="http"></out>
<out type="push" extdata="Bitly_URL" condition="!_?" lvalue="$Bitly_URL$" rvalue="http">http://%USERVAR[Original_Link]%</out>
// Remove some junk that may have got in to the output for whatever reason
<out type="push" extdata="Bitly_URL"><operator type="strrep" nvalue="%USERVAR[Bitly_URL]%" lvalue="http://http://" rvalue="http://"/></out>
<out type="push" extdata="Bitly_URL"><operator type="strrep" nvalue="%USERVAR[Bitly_URL]%" lvalue="\n" rvalue=" "/></out>
// Read in the Link Counter and Add to it by 1
<out type="push" extdata="Link_Counter"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Link.Index.Counter.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Link_Counter"><operator type="+" lvalue="$Link_Counter$" rvalue="1"/></out>
// Use the Custom Format read in earlier to create the final output that appears in the room
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Link Saver Name/Version]" rvalue="Link Saver #c63#(#c62#v0.2#c63#):"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Bitly URL]" rvalue="%USERVAR[Bitly_URL]%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Page Title]" rvalue="%USERVAR[Title_Content]%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Save Message]" rvalue="Saved"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Original Link]" rvalue="%USERVAR[Original_Link]%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Short Name]" rvalue="%NAME%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Raw Name]" rvalue="%RAWNAME%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Link Number]" rvalue="%USERVAR[Link_Counter]%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Date]" rvalue="%DATE%"/></out>
<out type="push" extdata="Custom_Output_Format"><operator type="strrep" nvalue="$Custom_Output_Format$" lvalue="[Time]" rvalue="%LOCALTIME%"/></out>
// Output the URL + Title to the room
<out condition="!=" lvalue="$Title_Content$" rvalue="">%USERVAR[Server_Notice_Command]%%USERVAR[Custom_Output_Format]%</out>
<out condition="==" lvalue="$Title_Content$" rvalue="">%USERVAR[Server_Notice_Command]%%USERVAR[Custom_Output_Format]%</out>
// Remove colour code from this users name before saving it to the cache[s]
<out type="push" extdata="Cleaned_Name">%NAME%</out>
<out type="push" extdata="Cleaned_Name"><operator type="strrem" lvalue="%USERVAR[Cleaned_Name]%" rvalue="#c?#"/></out>
<out type="push" extdata="Cleaned_Name"><operator type="strrem" lvalue="%USERVAR[Cleaned_Name]%" rvalue="#c!#"/></out>
<out type="push" extdata="Cleaned_Name_LINE">0</out>
<out type="push" extdata="Cleaned_Name_LINE"><operator type="+" lvalue="$Cleaned_Name_LINE$" rvalue="1"/></out>
<out type="push" extdata="Cleaned_Name"><operator type="strrem" lvalue="%USERVAR[Cleaned_Name]%" rvalue="#c%USERVAR[Cleaned_Name_LINE]%#"/></out>
<out type="goto" extdata="3" condition="==" lvalue="$Cleaned_Name_LINE$" rvalue="255"></out> 
<out type="goto" extdata="2" condition="!?" lvalue="%USERVAR[Cleaned_Name]%" rvalue="#c"></out> 
<out type="goto" extdata="-4" condition="?" lvalue="%USERVAR[Cleaned_Name]%" rvalue="#c"></out>
// Create a Cache for this URL
<out type="break" condition="==" lvalue="$URLDATE$" rvalue="%MONTH%"></out>
<out type="push" extdata="searchrequest">%USERVAR[Original_Link]%</out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="/"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="?"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=":"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=";"/></out>
<out type="file" mode="t" extdata="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt">%MONTH%\n%USERVAR[Bitly_URL]%\n%USERVAR[Title_Content]%\n%USERVAR[Cleaned_Name]%\n%RAWNAME%\n%DATE%\n%LOCALTIME%\n</out>
// Create another cache using the Bitly_URL as the cache name
<out type="push" extdata="filtered_short_url">%USERVAR[Bitly_URL]%</out>
<out type="push" extdata="filtered_short_url"><operator type="strrem" lvalue="$filtered_short_url$" rvalue="/"/></out>
<out type="push" extdata="filtered_short_url"><operator type="strrem" lvalue="$filtered_short_url$" rvalue="?"/></out>
<out type="push" extdata="filtered_short_url"><operator type="strrem" lvalue="$filtered_short_url$" rvalue=":"/></out>
<out type="file" mode="t" extdata="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[filtered_short_url]%.txt">%MONTH%\n%USERVAR[Bitly_URL]%\n%USERVAR[Title_Content]%\n%USERVAR[Cleaned_Name]%\n%RAWNAME%\n%DATE%\n%LOCALTIME%\n</out>
// Break if this entry is already in the index
<out type="break" condition="!=" lvalue="$URLDATE$" rvalue=""></out>
// Load in the current amount of entries in the index file
<out type="push" extdata="Link_Counter"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Link.Index.Counter.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Link_Content" condition="!=" lvalue="$Title_Content$" rvalue="">%USERVAR[Original_Link]%</out>
// Add to the count by 1
<out type="push" extdata="Link_Counter"><operator type="+" lvalue="$Link_Counter$" rvalue="1"/></out>
// Save the Count
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\Link.Index.Counter.txt" mode="t">$Link_Counter$</out>
// Save the new Link entry to the index
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Link_Index_File]%" mode="a">$Link_Content$\n</out>
</command>

<command type="script">
<in type="exact">!links</in>
<in type="exact">!Links</in>
<in>!links %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="6"/></out>
<out type="break" condition="!_?" lvalue="$req$" rvalue="!links"></out>
// Pop a variable 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\Link.Saver\.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\Link.Saver\.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\Link.Saver\.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 which index file is currently in use
<out type="push" extdata="Link_Index_File"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.Link.Index.File.ini" lvalue="l" rvalue="1"/></out>
// Check if the Index File exsists or not
<out type="push" extdata="FILECHECK"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Link_Index_File]%" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c9#You don't have any links saved yet, try posting a link now :)</out>
<out type="break" condition="==" lvalue="$FILECHECK$" rvalue=""></out>
// Load in the Customisation Settings File to get the format that the user selected
<out type="push" extdata="SETTINGS_LINE">0</out>
<out type="push" extdata="SETTINGS_LINE"><operator type="+" lvalue="$SETTINGS_LINE$" rvalue="1"/></out>
<out type="push" extdata="Custom_Format"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Customisation.Settings.File.ini" lvalue="l" rvalue="$SETTINGS_LINE$"/></out>
<out type="push" extdata="Custom_Browse_Format" condition="?" lvalue="$Custom_Format$" rvalue="Link Browsing Format: ">$Custom_Format$</out>
<out type="push" extdata="Custom_Result_Amount" condition="?" lvalue="$Custom_Format$" rvalue="Maximum Amount Links per Browse Page: ">$Custom_Format$</out>
<out type="goto" extdata="2" condition="?" lvalue="$Custom_Result_Amount$" rvalue="Maximum Amount Links per Browse Page: "></out>
<out type="goto" extdata="-5" condition="!=" lvalue="$SETTINGS_LINE$" rvalue="20"></out>
<out type="push" extdata="Custom_Browse_Format"><operator type="strrem" lvalue="$Custom_Browse_Format$" rvalue="Link Browsing Format: "/></out>
<out type="push" extdata="Custom_Result_Amount"><operator type="strrem" lvalue="$Custom_Result_Amount$" rvalue="Maximum Amount Links per Browse Page: "/></out>
// Replace some of the chosen format options with their real values (Static)
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Link Saver Name/Version]" rvalue="Link Saver #c63#(#c62#v0.2#c63#):"/></out>
<out type="push" extdata="Custom_Browse_Format_Saved">$Custom_Browse_Format$</out>
// Send the user the top of the menu
<out>%USERVAR[Server_Private_Command]% #c62#&lt;· #c4#%USERVAR[Menu_Colour]%Your Submitted Links#c63#:</out>
// +1 the Param for the next Log Command
<out type="push" extdata="NextNum"><operator type="+" lvalue="%PARAM%" rvalue="1"/></out>
<out type="push" extdata="NextNum" condition="==" lvalue="%TRIGGER%" rvalue="!links">2</out>
<out type="push" extdata="NextNum" condition="==" lvalue="%TRIGGER%" rvalue="!Links">2</out>
// Take the Parameter and Multiply it by the room owners chosen link amount (Default is 20)
<out type="push" extdata="number">%PARAM%</out>
<out type="push" extdata="number" condition="==" lvalue="%TRIGGER%" rvalue="!links">1</out>
<out type="push" extdata="number" condition="==" lvalue="%TRIGGER%" rvalue="!Links">1</out>
<out type="push" extdata="number"><operator type="*" lvalue="$number$" rvalue="$Custom_Result_Amount$"/></out>
// Read in the current amount of Log Entries
<out type="push" extdata="Link_Count"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Link.Index.Counter.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Link_Page_Next"><operator type="-" lvalue="$Link_Count$" rvalue="$number$"/></out>
<out type="push" extdata="Processed_Link_Count"><operator type="+" lvalue="$Link_Page_Next$" rvalue="$Custom_Result_Amount$"/></out>
// Start reading through the Log and stop when a maximum of 20 links are found or no links are found
<out type="push" extdata="Index_Line_Result"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Link_Index_File]%" lvalue="l" rvalue="$Processed_Link_Count$"/></out>
// Load in some information about this entry under the circumstance that the user wishes them to be loaded in their custom format
<out type="push" extdata="searchrequest">%USERVAR[Index_Line_Result]%</out>
<out type="push" extdata="Custom_Browse_Format">$Custom_Browse_Format_Saved$</out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="/"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="?"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=":"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=";"/></out>
<out type="push" extdata="Bitly_URL" condition="_?" lvalue="$Custom_Browse_Format$" rvalue="[Bitly URL]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="2"/></out>
<out type="push" extdata="Title_Content" condition="_?" lvalue="$Custom_Browse_Format$" rvalue="[Page Title]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="3"/></out>
<out type="push" extdata="Short_Name" condition="_?" lvalue="$Custom_Browse_Format$" rvalue="[Short Name]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="4"/></out>
<out type="push" extdata="Raw_Name" condition="_?" lvalue="$Custom_Browse_Format$" rvalue="[Raw Name]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="5"/></out>
<out type="push" extdata="Date_Posted" condition="_?" lvalue="$Custom_Browse_Format$" rvalue="[Date]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="6"/></out>
<out type="push" extdata="Time_Posted" condition="_?" lvalue="$Custom_Browse_Format$" rvalue="[Time]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="7"/></out>
// Replace some of the chosen format options with their real values (Dynamic)
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Original Link]" rvalue="%USERVAR[Index_Line_Result]%"/></out>
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Bitly URL]" rvalue="%USERVAR[Bitly_URL]%"/></out>
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Page Title]" rvalue="%USERVAR[Title_Content]%"/></out>
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Short Name]" rvalue="%USERVAR[Short_Name]%"/></out>
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Raw Name]" rvalue="%USERVAR[Raw_Name]%"/></out>
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Link Number]" rvalue="%USERVAR[Processed_Link_Count]%"/></out>
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Date]" rvalue="%USERVAR[Date_Posted]%"/></out>
<out type="push" extdata="Custom_Browse_Format"><operator type="strrep" nvalue="$Custom_Browse_Format$" lvalue="[Time]" rvalue="%USERVAR[Time_Posted]%"/></out>
// Output the custom format with the link
<out condition="!=" lvalue="$Index_Line_Result$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c1# #c4#%USERVAR[Menu_Colour]% · %USERVAR[Custom_Browse_Format]%</out>
<out type="push" extdata="Processed_Link_Count"><operator type="-" lvalue="$Processed_Link_Count$" rvalue="1"/></out>
<out type="goto" extdata="2" condition="==" lvalue="$Processed_Link_Count$" rvalue="$Link_Page_Next$"></out>
<out type="goto" extdata="-24" condition=">" lvalue="$Processed_Link_Count$" rvalue="0"></out>
// Let the user know that the ending has completed, Display to the user the next command prompt to view [n] more
<out condition="==" lvalue="$Processed_Link_Count$" rvalue="0">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c4#%USERVAR[Menu_Colour]%Type #c63#"#c62#!FindLink [Link Name]#c63#" #c4#%USERVAR[Menu_Colour]% to search for a link #c62#·&gt;</out>
<out condition="!=" lvalue="$Processed_Link_Count$" rvalue="0">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c4#%USERVAR[Menu_Colour]%Type #c63#"#c62#!Links %USERVAR[NextNum]%#c63#" #c4#%USERVAR[Menu_Colour]%to view %USERVAR[Custom_Result_Amount]% more #c62#·&gt;</out>
</command>

<command type="script">
<in>!findlink %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="10"/></out>
<out type="break" condition="!_?" lvalue="$req$" rvalue="!findlink "></out>
// Pop a variable 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\Link.Saver\.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\Link.Saver\.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\Link.Saver\.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 which index file is currently in use
<out type="push" extdata="Link_Index_File"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.Link.Index.File.ini" lvalue="l" rvalue="1"/></out>
// Check if the Index File exsists or not
<out type="push" extdata="FILECHECK"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Link_Index_File]%" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c9#You don't have any links saved yet, try posting a link now :)</out>
<out type="break" condition="==" lvalue="$FILECHECK$" rvalue=""></out>
// Load in the Customisation Settings File to get the format that the user selected
<out type="push" extdata="SETTINGS_LINE">0</out>
<out type="push" extdata="SETTINGS_LINE"><operator type="+" lvalue="$SETTINGS_LINE$" rvalue="1"/></out>
<out type="push" extdata="Custom_Format"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Customisation.Settings.File.ini" lvalue="l" rvalue="$SETTINGS_LINE$"/></out>
<out type="push" extdata="Custom_Searching_Format" condition="?" lvalue="$Custom_Format$" rvalue="Link Searching Format: ">$Custom_Format$</out>
<out type="push" extdata="Custom_Result_Amount" condition="?" lvalue="$Custom_Format$" rvalue="Maximum Amount of !findlink Results: ">$Custom_Format$</out>
<out type="goto" extdata="2" condition="?" lvalue="$Custom_Result_Amount$" rvalue="Maximum Amount of !findlink Results: "></out>
<out type="goto" extdata="-5" condition="!=" lvalue="$SETTINGS_LINE$" rvalue="20"></out>
<out type="push" extdata="Custom_Searching_Format"><operator type="strrem" lvalue="$Custom_Searching_Format$" rvalue="Link Searching Format: "/></out>
<out type="push" extdata="Custom_Result_Amount"><operator type="strrem" lvalue="$Custom_Result_Amount$" rvalue="Maximum Amount of !findlink Results: "/></out>
// Replace some of the chosen format options with their real values (Static)
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Link Saver Name/Version]" rvalue="Link Saver #c63#(#c62#v0.2#c63#):"/></out>
<out type="push" extdata="Custom_Searching_Format_Saved">$Custom_Searching_Format$</out>
// Send the user the top of the menu
<out>%USERVAR[Server_Private_Command]% #c62#&lt;· #c4#%USERVAR[Menu_Colour]%Results for your Query#c63#: #c62#%PARAM%</out>
// Read in the current amount of Log Entries
<out type="push" extdata="Index_Line_Count"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Link.Index.Counter.txt" lvalue="l" rvalue="1"/></out>
// Start reading through the Log and sending the user data and making a count so that the search stops at 20 results maximum
<out type="push" extdata="SENTLINE">0</out>
<out type="push" extdata="Index_Line_Result"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Link_Index_File]%" lvalue="l" rvalue="$Index_Line_Count$"/></out>
<out type="goto" extdata="21" condition="!_?" lvalue="$Index_Line_Result$" rvalue="%PARAM%"></out>
// Load in some information about this entry under the circumstance that the user wishes them to be loaded in their custom format
<out type="push" extdata="searchrequest">%USERVAR[Index_Line_Result]%</out>
<out type="push" extdata="Custom_Searching_Format">$Custom_Searching_Format_Saved$</out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="/"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="?"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=":"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=";"/></out>
<out type="push" extdata="Bitly_URL" condition="_?" lvalue="$Custom_Searching_Format$" rvalue="[Bitly URL]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="2"/></out>
<out type="push" extdata="Title_Content" condition="_?" lvalue="$Custom_Searching_Format$" rvalue="[Page Title]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="3"/></out>
<out type="push" extdata="Short_Name" condition="_?" lvalue="$Custom_Searching_Format$" rvalue="[Short Name]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="4"/></out>
<out type="push" extdata="Raw_Name" condition="_?" lvalue="$Custom_Searching_Format$" rvalue="[Raw Name]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="5"/></out>
<out type="push" extdata="Date_Posted" condition="_?" lvalue="$Custom_Searching_Format$" rvalue="[Date]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="6"/></out>
<out type="push" extdata="Time_Posted" condition="_?" lvalue="$Custom_Searching_Format$" rvalue="[Time]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="7"/></out>
// Replace some of the chosen format options with their real values (Dynamic)
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Original Link]" rvalue="%USERVAR[Index_Line_Result]%"/></out>
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Bitly URL]" rvalue="%USERVAR[Bitly_URL]%"/></out>
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Page Title]" rvalue="%USERVAR[Title_Content]%"/></out>
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Short Name]" rvalue="%USERVAR[Short_Name]%"/></out>
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Raw Name]" rvalue="%USERVAR[Raw_Name]%"/></out>
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Link Number]" rvalue="%USERVAR[Index_Line_Count]%"/></out>
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Date]" rvalue="%USERVAR[Date_Posted]%"/></out>
<out type="push" extdata="Custom_Searching_Format"><operator type="strrep" nvalue="$Custom_Searching_Format$" lvalue="[Time]" rvalue="%USERVAR[Time_Posted]%"/></out>
// Output the custom format with the link
<out condition="_?" lvalue="$Index_Line_Result$" rvalue="%PARAM%">%USERVAR[Server_Private_Command]%#c1# #c1# #c4#%USERVAR[Menu_Colour]% · %USERVAR[Custom_Searching_Format]%</out>
<out type="push" extdata="Index_Line_Count"><operator type="-" lvalue="$Index_Line_Count$" rvalue="1"/></out>
<out type="push" extdata="SENTLINE" condition="_?" lvalue="$Index_Line_Result$" rvalue="%PARAM%"><operator type="+" lvalue="$SENTLINE$" rvalue="1"/></out>
<out type="goto" extdata="2" condition="==" lvalue="$SENTLINE$" rvalue="$Custom_Result_Amount$"></out>
<out type="goto" extdata="-26" condition=">" lvalue="$Index_Line_Count$" rvalue="0"></out>
// Output to the user the next Log command to view more entries
<out condition="==" lvalue="$SENTLINE$" rvalue="1">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c4#%USERVAR[Menu_Colour]%You received #c62#%USERVAR[SENTLINE]% #c4#Result #c62#·&gt;</out>
<out condition="!=" lvalue="$SENTLINE$" rvalue="1">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c4#%USERVAR[Menu_Colour]%You received #c62#%USERVAR[SENTLINE]% #c4#Results #c62#·&gt;</out>
</command>

<command type="script" usergroup="Link_Saver_Admin_Users">
<in>!undoremove</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="11"/></out>
<out type="break" condition="!_?" lvalue="$req$" rvalue="!undoremove"></out>
// Display the removal message[s] using /notice if it's possible
<out type="push" extdata="Server_Notice_Command"></out>
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="WCS">/hidecmd /notice #c4#</out>
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="RCS">/hidecmd /notice #c4#</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 #c4#</out>
// Check which index file is currently in use
<out type="push" extdata="Link_Index_File"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.Link.Index.File.ini" lvalue="l" rvalue="1"/></out>
// If the index file is Link.Index.Content.1.txt then write to Link.Index.Content.2.txt and vice versa
<out type="push" extdata="Write_To" condition="==" lvalue="$Link_Index_File$" rvalue="Link.Index.Content.1.txt">Link.Index.Content.2.txt</out>
<out type="push" extdata="Write_To" condition="==" lvalue="$Link_Index_File$" rvalue="Link.Index.Content.2.txt">Link.Index.Content.1.txt</out>
// Save the new Index File Name
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Link.Index.File.ini" mode="t">$Write_To$</out>
// Read back in the old count (before the erase) and put it back in to the new counter
<out type="push" extdata="Original_Link_Count"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.Undo.Assist.ini" lvalue="l" rvalue="1"/></out>
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\Link.Index.Counter.txt" mode="t">$Original_Link_Count$</out>
// Tell the user that the previously removed links have been put back
<out>%USERVAR[Server_Notice_Command]%Link Saver #c63#(#c62#v0.2#c63#): #c62#Your previously erased link[s] have been restored back</out>
</command>

<command type="script" usergroup="Link_Saver_Admin_Users">
<in>!removelink %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="12"/></out>
<out type="break" condition="!_?" lvalue="$req$" rvalue="!removelink "></out>
// Pop a variable 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\Link.Saver\.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\Link.Saver\.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\Link.Saver\.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 which index file is currently in use
<out type="push" extdata="Link_Index_File"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\.Link.Index.File.ini" lvalue="l" rvalue="1"/></out>
// If the index file is Link.Index.Content.1.txt then write to Link.Index.Content.2.txt and vice versa
<out type="push" extdata="Write_To" condition="==" lvalue="$Link_Index_File$" rvalue="Link.Index.Content.1.txt">Link.Index.Content.2.txt</out>
<out type="push" extdata="Write_To" condition="==" lvalue="$Link_Index_File$" rvalue="Link.Index.Content.2.txt">Link.Index.Content.1.txt</out>
// Wipe the Write_To file
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Write_To]%" mode="t"></out>
// Check if the Index File exsists or not
<out type="push" extdata="FILECHECK"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Link_Index_File]%" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$FILECHECK$" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c9#You don't have any links saved yet, try posting a link now :)</out>
<out type="break" condition="==" lvalue="$FILECHECK$" rvalue=""></out>
// Load in the Customisation Settings File to get the format that the user selected
<out type="push" extdata="SETTINGS_LINE">0</out>
<out type="push" extdata="SETTINGS_LINE"><operator type="+" lvalue="$SETTINGS_LINE$" rvalue="1"/></out>
<out type="push" extdata="Custom_Format"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Customisation.Settings.File.ini" lvalue="l" rvalue="$SETTINGS_LINE$"/></out>
<out type="push" extdata="Custom_Removed_Format" condition="?" lvalue="$Custom_Format$" rvalue="Link Removal Format: ">$Custom_Format$</out>
<out type="push" extdata="Custom_Removed_Amount" condition="?" lvalue="$Custom_Format$" rvalue="Maximum Amount of Deletions: ">$Custom_Format$</out>
<out type="goto" extdata="2" condition="?" lvalue="$Custom_Removed_Amount$" rvalue="Maximum Amount of Deletions: "></out>
<out type="goto" extdata="-5" condition="!=" lvalue="$SETTINGS_LINE$" rvalue="20"></out>
<out type="push" extdata="Custom_Removed_Format"><operator type="strrem" lvalue="$Custom_Removed_Format$" rvalue="Link Removal Format: "/></out>
<out type="push" extdata="Custom_Removed_Amount"><operator type="strrem" lvalue="$Custom_Removed_Amount$" rvalue="Maximum Amount of Deletions: "/></out>
// Replace some of the chosen format options with their real values (Static)
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Link Saver Name/Version]" rvalue="Link Saver #c63#(#c62#v0.2#c63#):"/></out>
<out type="push" extdata="Custom_Removed_Format_Saved">$Custom_Removed_Format$</out>
// Display the removal message[s] using /notice if it's possible
<out type="push" extdata="Server_Notice_Command"></out>
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="WCS">/hidecmd /notice #c4#</out>
<out type="push" extdata="Server_Notice_Command" condition="?" lvalue="%SERVER%" rvalue="RCS">/hidecmd /notice #c4#</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 #c4#</out>
// Read in the current amount of Log Entries
<out type="push" extdata="Original_Link_Count"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Link.Index.Counter.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Total_Link_Count">$Original_Link_Count$</out>
<out type="push" extdata="Index_Line_Count">0</out>
// Start reading through the Index File to locate the link[s] the user wants removed
<out type="push" extdata="Index_Line_Count"><operator type="+" lvalue="$Index_Line_Count$" rvalue="1"/></out>
<out type="push" extdata="Index_Line_Result"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Link_Index_File]%" lvalue="l" rvalue="$Index_Line_Count$"/></out>
// If this entry isn't one we want to delete then forward it to the new index file
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\%USERVAR[Write_To]%" mode="a" condition="!_?" lvalue="$Index_Line_Result$" rvalue="%PARAM%">%USERVAR[Index_Line_Result]%\n</out>
<out type="push" extdata="Total_Link_Count" condition="_?" lvalue="$Index_Line_Result$" rvalue="%PARAM%"><operator type="-" lvalue="$Total_Link_Count$" rvalue="1"/></out>
<out type="goto" extdata="22" condition="!_?" lvalue="$Index_Line_Result$" rvalue="%PARAM%"></out>
// Load in some information about this entry under the circumstance that the user wishes them to be loaded in their custom format
<out type="push" extdata="searchrequest">%USERVAR[Index_Line_Result]%</out>
<out type="push" extdata="Custom_Removed_Format">%USERVAR[Custom_Removed_Format_Saved]%</out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="/"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue="?"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=":"/></out>
<out type="push" extdata="searchrequest"><operator type="strrem" lvalue="$searchrequest$" rvalue=";"/></out>
<out type="push" extdata="Bitly_URL" condition="_?" lvalue="$Custom_Removed_Format$" rvalue="[Bitly URL]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="2"/></out>
<out type="push" extdata="Title_Content" condition="_?" lvalue="$Custom_Removed_Format$" rvalue="[Page Title]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="3"/></out>
<out type="push" extdata="Short_Name" condition="_?" lvalue="$Custom_Removed_Format$" rvalue="[Short Name]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="4"/></out>
<out type="push" extdata="Raw_Name" condition="_?" lvalue="$Custom_Removed_Format$" rvalue="[Raw Name]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="5"/></out>
<out type="push" extdata="Date_Posted" condition="_?" lvalue="$Custom_Removed_Format$" rvalue="[Date]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="6"/></out>
<out type="push" extdata="Time_Posted" condition="_?" lvalue="$Custom_Removed_Format$" rvalue="[Time]"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="7"/></out>
// Replace some of the chosen format options with their real values (Dynamic)
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Original Link]" rvalue="%USERVAR[Index_Line_Result]%"/></out>
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Bitly URL]" rvalue="%USERVAR[Bitly_URL]%"/></out>
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Page Title]" rvalue="%USERVAR[Title_Content]%"/></out>
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Short Name]" rvalue="%USERVAR[Short_Name]%"/></out>
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Raw Name]" rvalue="%USERVAR[Raw_Name]%"/></out>
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Link Number]" rvalue="%USERVAR[Processed_Link_Count]%"/></out>
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Date]" rvalue="%USERVAR[Date_Posted]%"/></out>
<out type="push" extdata="Custom_Removed_Format"><operator type="strrep" nvalue="$Custom_Removed_Format$" lvalue="[Time]" rvalue="%USERVAR[Time_Posted]%"/></out>
// Write a delete marker on the cache file
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\Link.Saver\Cache\%USERVAR[searchrequest]%.txt" condition="_?" lvalue="$Index_Line_Result$" rvalue="%PARAM%">Deleted\n</out>
// Output the custom format with the link
<out condition="_?" lvalue="$Index_Line_Result$" rvalue="%PARAM%">%USERVAR[Server_Notice_Command]%%USERVAR[Custom_Removed_Format]%</out>
<out type="goto" extdata="-27" condition="<" lvalue="$Index_Line_Count$" rvalue="$Original_Link_Count$"></out>
// If no links were found to be removed tell the admins that and break
<out condition="==" lvalue="$Total_Link_Count$" rvalue="$Original_Link_Count$">%USERVAR[Server_Notice_Command]%#c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c9#Unable to find any links which matched your remove query</out>
<out type="break" condition="==" lvalue="$Total_Link_Count$" rvalue="$Original_Link_Count$"></out>
// Save the new Link Count
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\Link.Index.Counter.txt" mode="t">$Total_Link_Count$</out>
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Undo.Assist.ini" mode="t">$Original_Link_Count$</out>
// Save the new Index File Name
<out type="file" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Link.Index.File.ini" mode="t">$Write_To$</out>
</command>


<command type="script" usergroup="Link_Saver_Admin_Users">
<in>!privatelinks</in>
<in>!publiclinks</in>
// Check if the command was typed at the start of a sentence, if not break
<out type="push" extdata="Link_Saver_CMD_REQ">%TRIGGER%</out>
<out type="push" extdata="Link_Saver_CMD_REQ"><operator type="strleft" lvalue="$Link_Saver_CMD_REQ$" rvalue="1"/></out>
<out type="break" condition="!_?" lvalue="$Link_Saver_CMD_REQ$" rvalue="!"></out>
// Process which command the user typed
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="!privatelinks" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Public.Private.Server.Settings.ini">1\n</out>
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="!publiclinks" extdata="C:\Pri.Script.Dependencies\Link.Saver\.Public.Private.Server.Settings.ini">0</out>
// Output to the Admins if it was set to Public Mode
<out condition="_?" lvalue="%TRIGGER%" rvalue="!publiclinks">/opmsg #c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c1#Link Saver Has been set to Public Mode</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!publiclinks">/opmsg #c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c62#When this is set to Public, all Link Saver Browse/Search results will be shown to the entire room</out>
// Break if the user selected to use Public
<out type="break" condition="_?" lvalue="%TRIGGER%" rvalue="!publiclinks"></out>
// If the user selected PrivateLinkSaver, 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\Link.Saver\.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]%Link Saver #c63#(#c62#v0.2#c63#): #c9#Link Saver 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\Link.Saver\.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="!privatelinks">/opmsg #c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c1#Link Saver Has been set to Private Mode</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!privatelinks">/opmsg #c4#%USERVAR[Menu_Colour]%Link Saver #c63#(#c62#v0.2#c63#): #c62#When this is set to Private, only those who use the Link Searching/Browsing 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="Link_Saver_Checking_For_WCS" condition="?" lvalue="%SERVER%" rvalue="WinMX">1</out>
<out condition="?" lvalue="%SERVER%" rvalue="WinMX">/stats</out>
</command>

<command type="script" condition="==" lvalue="$Link_Saver_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]%Link Saver #c63#(#c62#v0.2#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\Link.Saver\.Public.Private.Server.Settings.ini">1\n/hidecmd /privnotice :@:RAWNAME:@::@:SPACE:@:</out>
// Push 0 to Checking for WCS
<out type="push" extdata="Link_Saver_Checking_For_WCS">0</out>
</command>

<command type="script" usergroup="Link_Saver_Admin_Users">
<in>!setlinkscolour %PARAM%</in>
<in>!setlinkscolor %PARAM%</in>
// Check if the command was typed at the start of a sentence, if not break
<out type="push" extdata="Link_Saver_CMD_REQ">%TRIGGER%</out>
<out type="push" extdata="Link_Saver_CMD_REQ"><operator type="strleft" lvalue="$Link_Saver_CMD_REQ$" rvalue="12"/></out>
<out type="break" condition="!_?" lvalue="$Link_Saver_CMD_REQ$" rvalue="!setlinkscolo"></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\Link.Saver\.Menu.Colour.ini">%PARAM%\n</out>
<out type="file" mode="t" condition="!?" lvalue="%PARAM%" rvalue="#c" extdata="C:\Pri.Script.Dependencies\Link.Saver\.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%Link Saver #c63#(#c62#v0.2#c63#): #c1#Link Saver Has set its colours to#c63#: %PARAM% |||||</out>
<out condition="!?" lvalue="%PARAM%" rvalue="#c">/opmsg #c4##c%PARAM%#Link Saver #c63#(#c62#v0.2#c63#): #c1#Link Saver Has set its colours to#c63#: #c%PARAM%# |||||</out>
</command>

</config>