<config>

//////////////
//
//  Pulse Protection v0.8a by Pri (2nd of April 2011)
//
//////////////
//
//  Commands Included that you can use:
//  !PulseGeo On/Off - Turn the Geolocate feature on/off (Finds where users are based on IP) (Default: On)
//  !PulseRooms - View all the rooms using the same Password as you
//
//////////////
//
//  In this version only multi-room alias tracking is included
//  What this script basically does is report your users IP and current Username to my Server
//  Once my Server has that data it reports back to you all the usernames known to be in use by that IP
//  If it has not seen the username your user has used, it will add that name to the list
//  In version 0.8 the server now also reports back the Location (Country & City) of the users in its reply
//
//  Version 0.8a: Adds an error message that displays to the Admins in Opmsg if the bot doesn't have a high enough access level to see IP Addresses
//                Adds country and city (if known) of the user who entered the room (!PulseGeo On/Off)
//                Adds ability to lookup the names of rooms that are using the same Pulse password as you (!PulseRooms)
//                Now says if a user is new or not so you can see if your bot has died (Only in use when Geolocation is on)
//                
//  Version 0.7a: Fixes a bug where if a user had a # symbol in their name their data would not be sent to the Pulse Server correctly
//                This bug could have resulted in incorrect usernames being reported for users who had a # in their name
//
//  Version 0.6a: Includes Passwords which enables you to secure the data you are reporting to the server
//                What this means is the IPs and Usernames of your users will only be accessible to rooms using the same password as you
//                Which means if you want you can use it just in your own room and not share data with anyone or you can share with your friends
//
//////////////

<usergroup name="Pulse_Admin_Users" case="0">
// This usergroup is only for your admins so that they can control some of the special commands.
// Those commands include !PulseGeo On/Off - !PulseRooms is open to all users
*  ®ÊN  Pri  *
</usergroup>

<OnEnter type="script" mode="thread">
// Clear variable "Private_IP_Detected" for a clean run
<out type="pop" extdata="Private_IP_Detected"/>
// Break if the IP is private (127.0.0.1, 192.168.x.x, 10.0.x.x and so on)
<out type="push" extdata="Joined_IP">:%IP%</out>
<out type="push" extdata="Private_IP_Detected" condition="==" lvalue="%IP%" rvalue="127.0.0.1">1</out>
<out type="push" extdata="Private_IP_Detected" condition="==" lvalue="%IP%" rvalue="0.0.0.0">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":169.254.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.16.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.17.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.18.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.19.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.20.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.21.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.22.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.23.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.24.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.25.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.26.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.27.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.28.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.29.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.30.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":172.31.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":192.168.">1</out>
<out type="push" extdata="Private_IP_Detected" condition="?" lvalue="%USERVAR[Joined_IP]%" rvalue=":10.">1</out>
<out type="break" condition="==" lvalue="%USERVAR[Private_IP_Detected]%" rvalue="1"></out>
// Check that the scripts folder and settings file has been setup. If it hasn't do it.
<out type="push" extdata="Pulse_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Pulse.Protection\.Pulse.Protection.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Pulse_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Pulse.Protection</out>
<out condition="==" lvalue="$Pulse_Setup_Check$" rvalue="" type="sleep" extdata="3000"></out>
<out condition="==" lvalue="$Pulse_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.Pulse.Protection.ini" mode="t">1</out>
// Check if the Geolocate file has been made, if it hasnt make it and then tell the admins about it too
<out type="push" extdata="Pulse_Plus_Geo_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Pulse.Protection\.Geolocate.Setting.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$Pulse_Plus_Geo_Check$" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#This version of Pulse Protection includes built in Geolocation #c63#(#c62#Country, City of users#c63#)#c9# If you don't like this feature you can turn it off by typing #c4#!PulseGeo Off #c9#But remember you need to edit the Pulse Protection XML file to list your name in the usergroup before you can use that command.</out>
<out condition="==" lvalue="$Pulse_Plus_Geo_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.Geolocate.Setting.ini" mode="t">1</out>
// Download some special characters required for this to function (Metis by itself doesn't allow these characters inside the code so they have to be loaded as varibles)
<out type="push" extdata="Special_1" condition="==" lvalue="%USERVAR[Special_1]%" rvalue=""><operator type="readweb" nvalue="http://pulse.protection.mxpulse.com/metis.assistant.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Special_3" condition="==" lvalue="%USERVAR[Special_3]%" rvalue=""><operator type="readweb" nvalue="http://pulse.protection.mxpulse.com/metis.assistant.txt" lvalue="l" rvalue="3"/></out>
// If the IP supplied to the bot is blank then load in the Access Level reminder counter (should be blank at first, then goes up to 3+)
<out type="push" extdata="ReminderCount" condition="==" lvalue="%IP%" rvalue=""><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Pulse.Protection\.Bot.Access.Level.Reminder.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="ReminderCount" condition="==" lvalue="%IP%" rvalue=""><operator type="+" lvalue="$ReminderCount$" rvalue="1"/></out>
<out condition="==" lvalue="%IP%" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.Bot.Access.Level.Reminder.ini" mode="t">$ReminderCount$</out>
// Break if the IP is blank then tell the Admins that they need to give their Bot high enough access to see IP Addresses
<out type="goto" extdata="3" condition=">" lvalue="$ReminderCount$" rvalue="3"></out> 
<out condition="==" lvalue="%IP%" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#Your bot doesn't have a high enough access level to see the IP's of people who enter your room, Try logging it in as Admin or Host to correct this, or make your bot its own password with the necessary access level</out>
<out condition="==" lvalue="%IP%" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#Reminder #c62#%RANDOMNUM[ReminderCount]%#c9# of 3</out>
<out type="break" condition="==" lvalue="%IP%" rvalue=""></out>
// Check for an updated version of this script
<out type="push" extdata="Version_Info">v0.8a</out>
<out type="pop" extdata="Version_Release_Message"/>
<out type="push" extdata="Version_Check_Date"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Pulse.Protection\.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://pulse.protection.mxpulse.com/version.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Version_Release_Message" condition="!=" lvalue="%USERVAR[Version_Info]%" rvalue="v0.8a"><operator type="readweb" nvalue="http://pulse.protection.mxpulse.com/version.ini" lvalue="l" rvalue="2"/></out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#%USERVAR[Version_Release_Message]%</out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.Version.Check.Date.txt" mode="t">%DATE%\n%USERVAR[Version_Info]%</out>
// Check if a custom Password has been set by the admins of the room for use with Pulse Protections authentication system
<out type="push" extdata="Pulse_Prot_Password"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Pulse.Protection\.password.ini" lvalue="l" rvalue="1"/></out>
// If no password was found use the default
<out type="push" extdata="Pass_generator" condition="==" lvalue="$Pulse_Prot_Password$" rvalue="">%RANDOMNUM[251]%%RANDOMNUM[252]%%RANDOMNUM[253]%%RANDOMNUM[254]%%RANDOMNUM[255]%</out>
// If a random password was generated let the user know what it is
<out condition="==" lvalue="$Pulse_Prot_Password$" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#A Random Password has been generated for the data you supply to the Server</out>
<out condition="==" lvalue="$Pulse_Prot_Password$" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#Generated Password#c63#: #c62#%USERVAR[Pass_generator]%</out>
<out condition="==" lvalue="$Pulse_Prot_Password$" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#Saved in#c63#: #c62#C:\Pri.Script.Dependencies\Pulse.Protection\.password.ini</out>
<out condition="==" lvalue="$Pulse_Prot_Password$" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#You and your friends can use the same password to share the same database</out>
// Save the Random Password (But of course only if a password isn't present already)
<out condition="==" lvalue="$Pulse_Prot_Password$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.password.ini" mode="t">%USERVAR[Pass_generator]%\nWhen making a password you can use uppercase and lowercase letters and also numbers, for example H1b0A9sD8mSd8 is an acceptible password.\nTo change your password simply erase the code at the top of this file, change it to something else, and save it.</out>
<out type="push" extdata="Pulse_Prot_Password" condition="==" lvalue="$Pulse_Prot_Password$" rvalue="">%USERVAR[Pass_generator]%</out>
// Sometimes the creation of the Folder for the Setup Check is to slow causing the install check file to not save, so let's just re-attempt that if this is a first time install
<out condition="==" lvalue="$Pulse_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.Pulse.Protection.ini" mode="t">1</out>
// Remove colour codes from username
<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>
// Replace some symbols from the name that just don't work in a httpget request to the web server, and other characters we just don't want saved
<out type="push" extdata="Cleaned_Name"><operator type="strrep" nvalue="%USERVAR[Cleaned_Name]%" lvalue="%USERVAR[Special_1]%lowast;" rvalue="[star]"/></out>
<out type="push" extdata="Cleaned_Name"><operator type="strrep" nvalue="%USERVAR[Cleaned_Name]%" lvalue="%USERVAR[Special_1]%" rvalue="[and]"/></out>
<out type="push" extdata="Cleaned_Name"><operator type="strrep" nvalue="%USERVAR[Cleaned_Name]%" lvalue="\" rvalue="[bslash]"/></out>
<out type="push" extdata="Cleaned_Name"><operator type="strrep" nvalue="%USERVAR[Cleaned_Name]%" lvalue="/" rvalue="[fslash]"/></out>
<out type="push" extdata="Cleaned_Name"><operator type="strrep" nvalue="%USERVAR[Cleaned_Name]%" lvalue="%USERVAR[Special_3]%" rvalue="[dollar]"/></out>
<out type="push" extdata="Cleaned_Name"><operator type="strrep" nvalue="%USERVAR[Cleaned_Name]%" lvalue="#" rvalue="[hash]"/></out>
// Replace some symbols from the Roomname that don't work in httpget requests
<out type="push" extdata="Cleaned_Room">%ROOMNAME%</out>
<out type="push" extdata="Cleaned_Room"><operator type="strrep" nvalue="%USERVAR[Cleaned_Room]%" lvalue="%USERVAR[Special_1]%lowast;" rvalue="[star]"/></out>
<out type="push" extdata="Cleaned_Room"><operator type="strrep" nvalue="%USERVAR[Cleaned_Room]%" lvalue="%USERVAR[Special_1]%" rvalue="[and]"/></out>
<out type="push" extdata="Cleaned_Room"><operator type="strrep" nvalue="%USERVAR[Cleaned_Room]%" lvalue="\" rvalue="[bslash]"/></out>
<out type="push" extdata="Cleaned_Room"><operator type="strrep" nvalue="%USERVAR[Cleaned_Room]%" lvalue="/" rvalue="[fslash]"/></out>
<out type="push" extdata="Cleaned_Room"><operator type="strrep" nvalue="%USERVAR[Cleaned_Room]%" lvalue="%USERVAR[Special_3]%" rvalue="[dollar]"/></out>
<out type="push" extdata="Cleaned_Room"><operator type="strrep" nvalue="%USERVAR[Cleaned_Room]%" lvalue="#" rvalue="[hash]"/></out>
// Check if the user wants to use Pulse with the Geolocating API or just Pulse on its own, default is with Geolocate
<out type="push" extdata="Pulse_Plus_Geo_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Pulse.Protection\.Geolocate.Setting.ini" lvalue="l" rvalue="1"/></out>
// If for some reason the geolocate setting is missing just consider it set to 1 and also save this setting
<out condition="==" lvalue="%USERVAR[Pulse_Plus_Geo_Check]%" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.Geolocate.Setting.ini" mode="t">1</out>
<out type="push" extdata="Pulse_Plus_Geo_Check" condition="==" lvalue="%USERVAR[Pulse_Plus_Geo_Check]%" rvalue="">1</out>
// Create a query for checking what usernames this IP is matched to and query mxpulse
<out type="push" extdata="Result" condition="==" lvalue="%USERVAR[Pulse_Plus_Geo_Check]%" rvalue="1"><operator type="readweb" nvalue="http://pulse.protection.mxpulse.com/v06/Pulse.With.Geo.php?ip=%IP%&amp;name=%USERVAR[Cleaned_Name]%&amp;pass=%USERVAR[Pulse_Prot_Password]%&amp;room=%USERVAR[Cleaned_Room]%" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Result" condition="==" lvalue="%USERVAR[Pulse_Plus_Geo_Check]%" rvalue="0"><operator type="readweb" nvalue="http://pulse.protection.mxpulse.com/v06/?ip=%IP%&amp;name=%USERVAR[Cleaned_Name]%&amp;pass=%USERVAR[Pulse_Prot_Password]%&amp;room=%USERVAR[Cleaned_Room]%" lvalue="l" rvalue="2"/></out>
// If the users current name is present remove it, unless using Geolocate in which case keep name there
<out type="push" extdata="Result" condition="==" lvalue="%USERVAR[Pulse_Plus_Geo_Check]%" rvalue="0"><operator type="strrem" lvalue="$Result$" rvalue="%USERVAR[Cleaned_Name]%[:@:]"/></out>
// Make the output a little nicer to read / Put some symbols back that were removed for HTTPGET to server
<out type="push" extdata="Result"><operator type="strrem" lvalue="$Result$" rvalue="\"/></out>
<out type="push" extdata="Result"><operator type="strrem" lvalue="$Result$" rvalue="/"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[:@:]" rvalue="#c63#,#c62# "/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[star]" rvalue="%USERVAR[Special_1]%lowast;"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[and]" rvalue="%USERVAR[Special_1]%"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[bslash]" rvalue="\"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[fslash]" rvalue="/"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[dollar]" rvalue="%USERVAR[Special_3]%"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[hash]" rvalue="#"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[;@;]" rvalue="#c9# Also known as#c63#: #c62#"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue=", -#c9# Also" rvalue="#c9# Also"/></out>
// Skip the default output if the user has chosen Geolocate (default behavior) to be on
<out type="goto" extdata="2" condition="==" lvalue="%USERVAR[Pulse_Plus_Geo_Check]%" rvalue="1"></out> 
// Output to the room the users aliases unless they don't have any
<out condition="!=" lvalue="$Result$" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#Also known as#c63#: #c62#%USERVAR[Result]%</out>
<out type="break" condition="==" lvalue="%USERVAR[Pulse_Plus_Geo_Check]%" rvalue="0"></out>
<out condition="!=" lvalue="$Result$" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#From#c63#: #c62#%USERVAR[Result]%</out>
</OnEnter>

<command type="script">
<in>!pulserooms</in>
// Check that the command was used at the beginning of a sentence
<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="!pulserooms"></out>
// Load in the users password, if they don't have a password yet tell them they need to set one
<out type="push" extdata="Pulse_Prot_Password"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Pulse.Protection\.password.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="%USERVAR[Pulse_Prot_Password]%" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#You have not yet set a password for Pulse Protection to use. Have a user enter your room to have one created automatically.</out>
<out type="break" condition="==" lvalue="%USERVAR[Pulse_Prot_Password]%" rvalue=""></out>
// Create a query including this rooms Pulse Password to retrieve a list of rooms using the same password back from the server
<out type="push" extdata="Result"><operator type="readweb" nvalue="http://pulse.protection.mxpulse.com/v06/Syncing.Rooms.php?pass=%USERVAR[Pulse_Prot_Password]%" lvalue="l" rvalue="1"/></out>
// If the result is blank then say an error occured
<out condition="==" lvalue="%USERVAR[Result]%" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#An error occured, please try again later.</out>
<out type="break" condition="==" lvalue="%USERVAR[Result]%" rvalue=""></out>
// Make the output a little nicer to read / Put some symbols back that were removed for HTTPGET to server
<out type="push" extdata="Result"><operator type="strrem" lvalue="$Result$" rvalue="\"/></out>
<out type="push" extdata="Result"><operator type="strrem" lvalue="$Result$" rvalue="/"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[:@:]" rvalue="\n"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[star]" rvalue="%USERVAR[Special_1]%lowast;"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[and]" rvalue="%USERVAR[Special_1]%"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[bslash]" rvalue="\"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[fslash]" rvalue="/"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[dollar]" rvalue="%USERVAR[Special_3]%"/></out>
<out type="push" extdata="Result"><operator type="strrep" nvalue="$Result$" lvalue="[hash]" rvalue="#"/></out>
// Write this answer to a temporary cache in the Pulse folder so we can split the results up and read them back
<out type="file" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\Syncing.Rooms.Cache.txt" mode="t">%USERVAR[Result]%</out>
// Tell the user the listing is going to start
<out>/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#Rooms using the same Pulse password as you#c63#:</out>
// Now read back the cache one line at a time
<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:\Pri.Script.Dependencies\Pulse.Protection\Syncing.Rooms.Cache.txt" lvalue="l" rvalue="$LINECOUNT$"/></out>
<out condition="!=" lvalue="%USERVAR[LINERESULT]%" rvalue="">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c62#%USERVAR[LINERESULT]%</out>
<out type="goto" extdata="-3" condition="!=" lvalue="" rvalue="%USERVAR[LINERESULT]%"></out>
// Tell the user the listing is complete
<out>/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#Listing complete.</out>
</command>

<command type="script" usergroup="Pulse_Admin_Users">
<in>!PulseGeo on</in>
<in>!PulseGeo off</in>
// Check if the command was typed at the start of a sentence, if not break
<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="!pulsegeo "></out>
// Process which command the user typed
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="on" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.Geolocate.Setting.ini">1</out>
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="off" extdata="C:\Pri.Script.Dependencies\Pulse.Protection\.Geolocate.Setting.ini">0</out>
// Output message to Opmsg explaining which setting was chosen and what it does
<out condition="_?" lvalue="%TRIGGER%" rvalue="off">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#The #c63#"#c1#Gelocation Feature#c63#"#c9# has been turned #c8#OFF</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="off">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c62#When this Setting is Off the Bot will Not display a users location when they enter your room</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="on">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c9#The #c63#"#c1#Gelocation Feature#c63#"#c9# has been turned #c4#ON</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="on">/opmsg #c4#Pulse #c63#(#c62#v0.8a#c63#): #c62#When this Setting is On the Bot will display users locations as they enter your room</out>
</command>

</config>