<config>


//////////////
//
//  Dynamic Room Adder v0.1a by Pri (9th of October 2011)
//  This script requires Metis v2.82 & 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
//
//  !ListRoom - Foribly re-send your room to the WPNLister (The script will keep you listed automatically so you shouldn't need to use this)
//  !SetTopic [Topic] - Set your room topic that will appear on the WPNLister
//  !SetUsers [#] - Set the amount of users who are in your room that will appear on the WPNLister
//
///////  SERVER SUPPORT
//
//  WCS, RCS, ZCS, RSWCS, FXServer and Ouka are all supported out of the box
//  Technically this should work with all servers including WinMX
//
//////////////


<usergroup name="DRA_Admin_Users" case="0">
// This usergroup is only for your admins so that they can control the settings
// You must enter atleast one admin here for this script to work!
*  ®ÊN  Pri  *
</usergroup>

<command type="script">
<in>!listroom</in>
// Check that the scripts folder and settings files have been setup. If they haven't then do so.
<out type="push" extdata="DRA_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Dynamic.Room.Adder.Install.Signature.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Dynamic.Room.Adder</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="sleep" extdata="3000"></out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Dynamic.Room.Adder.Install.Signature.ini" mode="t">1</out>
// If this is the first time the script has been run then inform the admins what steps they have to take to make the script function
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#This script has not yet been configured.</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#1. #c9#You need to edit the #c62#Dynamic.Room.Adder.by.Pri.xml #c9#file to add your username so that you can edit settings</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#2. #c9#You then need to type #c62#!SetTopic [Topic] #c9#and tell the bot what your rooms topic is</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#3. #c9#You then need to type #c62#!SetUsers [#] #c9#and tell the bot how many users you want to be shown on the WPNList Page</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#4. #c9#Once the three above steps are done the script will automatically begin listing your room for you, so check the website!</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#5. #c9#Check this page to see if your rooms been listed#c63#: #c62#http://winmxunlimited.net/tools/chat-room-list/winmx-chat-manager/</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#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#You appear to be running an outdated version of Metis.</out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#You can download the latest one here#c63#: #c62#http://bit.ly/ldk6C3</out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#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>
// The Dynamic Room Adder requires version 2.82 of Metis, if the user is not using this version tell the admins and break
<out condition="!=" lvalue="%VERSION%" rvalue="2.82">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#This script requires Metis v2.82, please upgrade from v%VERSION%#c63#: #c62#http://bit.ly/ldk6C3</out>
<out type="break" condition="!=" lvalue="%VERSION%" rvalue="2.82"></out>
// Check for an updated version of this script
<out type="push" extdata="Version_Info">v0.1a</out>
<out type="pop" extdata="Version_Release_Message"/>
<out type="push" extdata="Version_Check_Date"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.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://dynamic.room.adder.mxpulse.com/version.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Version_Release_Message" condition="!=" lvalue="%USERVAR[Version_Info]%" rvalue="v0.1a"><operator type="readweb" nvalue="http://dynamic.room.adder.mxpulse.com/version.ini" lvalue="l" rvalue="2"/></out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#%USERVAR[Version_Release_Message]%</out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Version.Check.Date.txt" mode="t">%DATE%</out>
// Read in the rooms Topic and User Count from files in the Database
<out type="push" extdata="ROOMTOPIC"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Topic.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="ROOMCOUNT"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Users.ini" lvalue="l" rvalue="1"/></out>
// Check if the data required to add a room has been supplied by the rooms Admins, if it hasn't break
<out type="break" condition="==" lvalue="$ROOMTOPIC$" rvalue=""></out>
<out type="break" condition="==" lvalue="$ROOMCOUNT$" rvalue=""></out>
// Locate the hosts IP Address
<out type="push" extdata="IP_Address"><operator type="readweb" nvalue="http://whatsmyip.net/" lvalue="l" rvalue="5"/></out>
<out type="push" extdata="IP_Address" condition="!_?" lvalue="$IP_Address$" rvalue="<title>"><operator type="readweb" nvalue="http://whatsmyip.net/" lvalue="l" rvalue="4"/></out>
<out type="push" extdata="IP_Address" condition="!_?" lvalue="$IP_Address$" rvalue="<title>"><operator type="readweb" nvalue="http://whatsmyip.net/" lvalue="l" rvalue="6"/></out>
<out condition="!_?" lvalue="$IP_Address$" rvalue="<title>">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#Your room couldn't be added at this time because your IP Address couldn't be resolved, Contact Pri!</out>
<out type="break" condition="!_?" lvalue="$IP_Address$" rvalue="<title>"></out>
<out type="push" extdata="IP_Address"><operator type="strrem" lvalue="$IP_Address$" rvalue="<title>What's My IP - Your IP is: "/></out>
<out type="push" extdata="IP_Address"><operator type="strrem" lvalue="$IP_Address$" rvalue="</title>"/></out>
<out condition="!_?" lvalue="$IP_Address$" rvalue=".">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#Your room couldn't be added at this time because your IP Address couldn't be resolved, Contact Pri!</out>
<out type="break" condition="!_?" lvalue="$IP_Address$" rvalue="."></out>
// Encode the hosts IP Address (Service provided by WinMXUnlimited.net, check it out! - Lots of good API's)
<out type="push" extdata="Hashcode"><operator type="readweb" nvalue="http://winmxunlimited.net/utilities/api/hashcode/convert.php?input=%USERVAR[IP_Address]%&amp;output=xml" lvalue="l" rvalue="2"/></out>
<out condition="!_?" lvalue="$Hashcode$" rvalue="<hashcode>">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#Your room couldn't be added at this time because your IP Address couldn't be converted in to its Hash Value, Contact Pri!</out>
<out type="break" condition="!_?" lvalue="$Hashcode$" rvalue="<hashcode>"></out>
<out type="push" extdata="Hashcode"><operator type="strrem" lvalue="$Hashcode$" rvalue="<hashcode>"/></out>
<out type="push" extdata="Hashcode"><operator type="strrem" lvalue="$Hashcode$" rvalue="</hashcode>"/></out>
// Locate and take the Port Number from the roomname
<out type="push" extdata="String_Length"><operator type="strlen" lvalue="%ROOMNAME%"/></out>
<out type="push" extdata="String_Length_Deduction"><operator type="-" lvalue="%USERVAR[String_Length]%" rvalue="4"/></out>
<out type="push" extdata="Port_Number"><operator type="strright" lvalue="%ROOMNAME%" rvalue="%USERVAR[String_Length_Deduction]%"/></out>
// Remove the entire Hash from the room name
<out type="push" extdata="String_Length_Deduction"><operator type="-" lvalue="%USERVAR[String_Length]%" rvalue="12"/></out>
<out type="push" extdata="Room_Name_Hash"><operator type="strright" lvalue="%ROOMNAME%" rvalue="%USERVAR[String_Length_Deduction]%"/></out>
<out type="push" extdata="Room_Name_Without_Hash"><operator type="strrem" lvalue="%ROOMNAME%" rvalue="$Room_Name_Hash$"/></out>
// Create the final encoding
<out type="push" extdata="ROOMNAME">%USERVAR[Room_Name_Without_Hash]%%USERVAR[Hashcode]%%USERVAR[Port_Number]%</out>
// Replace some characters that are not http friendly
<out type="push" extdata="ROOMNAME"><operator type="strrep" nvalue="%USERVAR[ROOMNAME]%" lvalue="&amp;" rvalue="%26"/></out>
<out type="push" extdata="ROOMNAME"><operator type="strrep" nvalue="%USERVAR[ROOMNAME]%" lvalue="#" rvalue="%23"/></out>
// Send the room to the WPN List
<out type="push" extdata="ReadRequestResult"><operator type="readweb" nvalue="http://winmxunlimited.net/tools/chat-room-list/winmx-chat-manager?roomname=%USERVAR[ROOMNAME]%&amp;usercount=%USERVAR[ROOMCOUNT]%&amp;userlimit=600&amp;topic=%USERVAR[ROOMTOPIC]%&amp;action=add" lvalue="l" rvalue="1"/></out>
// Tell the admin that their room was foribly sent to the WPNList server
<out>/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c1#Your room has been sent to the WPNLister#c63#:</out>
<out>/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c62#http://winmxunlimited.net/tools/chat-room-list/</out>
// Push the current hour in to a variable so that we wait a maximum of 60 minutes before trying to relist this room
<out type="push" extdata="Previous_Room_Add_Time">%HOUR%</out>
</command>

<command type="script" usergroup="DRA_Admin_Users">
<in>!SetTopic %PARAM%</in>
<in>!SetUsers %PARAM%</in>
// Check if the command was typed at the start of a sentence, if not break
<out type="push" extdata="CMD_REQ">%TRIGGER%</out>
<out type="push" extdata="CMD_REQ"><operator type="strleft" lvalue="$CMD_REQ$" rvalue="4"/></out>
<out type="break" condition="!_?" lvalue="$CMD_REQ$" rvalue="!Set"></out>
// Check that the scripts folder and settings files have been setup. If they haven't then do so.
<out type="push" extdata="DRA_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Dynamic.Room.Adder.Install.Signature.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Dynamic.Room.Adder</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="sleep" extdata="3000"></out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Dynamic.Room.Adder.Install.Signature.ini" mode="t">1</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#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#You appear to be running an outdated version of Metis.</out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#You can download the latest one here#c63#: #c62#http://bit.ly/ldk6C3</out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#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>
// The Dynamic Room Adder requires version 2.82 of Metis, if the user is not using this version tell the admins and break
<out condition="!=" lvalue="%VERSION%" rvalue="2.82">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#This script requires Metis v2.82, please upgrade from v%VERSION%#c63#: #c62#http://bit.ly/ldk6C3</out>
<out type="break" condition="!=" lvalue="%VERSION%" rvalue="2.82"></out>
// Save the setting that the admin set
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="!SetTopic " extdata="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Topic.ini">%PARAM%\n</out>
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="!SetUsers " extdata="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Users.ini">%PARAM%\n</out>
// Send a confirmation message to the admins that their setting has been applied successfully
<out condition="_?" lvalue="%TRIGGER%" rvalue="!SetTopic ">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c1#Your Topic has been set.</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!SetUsers ">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c1#Your User Count has been set.</out>
// Send a self command activating the service
<out type="self">!listroom</out>
</command>


<OnLeave type="script">
// Break here if the room has already been sent this hour (Limited to 24 queries per day this way)
<out type="break" condition="==" lvalue="%HOUR%" rvalue="%USERVAR[Previous_Room_Add_Time]%"></out>
// Check that the scripts folder and settings files have been setup. If they haven't then do so.
<out type="push" extdata="DRA_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Dynamic.Room.Adder.Install.Signature.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\Dynamic.Room.Adder</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="sleep" extdata="3000"></out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Dynamic.Room.Adder.Install.Signature.ini" mode="t">1</out>
// If this is the first time the script has been run then inform the admins what steps they have to take to make the script function
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#This script has not yet been configured.</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#1. #c9#You need to edit the #c62#Dynamic.Room.Adder.by.Pri.xml #c9#file to add your username so that you can edit settings</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#2. #c9#You then need to type #c62#!SetTopic [Topic] #c9#and tell the bot what your rooms topic is</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#3. #c9#You then need to type #c62#!SetUsers [#] #c9#and tell the bot how many users you want to be shown on the WPNList Page</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#4. #c9#Once the three above steps are done the script will automatically begin listing your room for you, so check the website!</out>
<out condition="==" lvalue="$DRA_Setup_Check$" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c4#5. #c9#Check this page to see if your rooms been listed#c63#: #c62#http://winmxunlimited.net/tools/chat-room-list/winmx-chat-manager/</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#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#You appear to be running an outdated version of Metis.</out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#You can download the latest one here#c63#: #c62#http://bit.ly/ldk6C3</out>
<out condition="!=" lvalue="$Pulse_Metis_Check$" rvalue="6042117849">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#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>
// The Dynamic Room Adder requires version 2.82 of Metis, if the user is not using this version tell the admins and break
<out condition="!=" lvalue="%VERSION%" rvalue="2.82">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#This script requires Metis v2.82, please upgrade from v%VERSION%#c63#: #c62#http://bit.ly/ldk6C3</out>
<out type="break" condition="!=" lvalue="%VERSION%" rvalue="2.82"></out>
// Check for an updated version of this script
<out type="push" extdata="Version_Info">v0.1a</out>
<out type="pop" extdata="Version_Release_Message"/>
<out type="push" extdata="Version_Check_Date"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.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://dynamic.room.adder.mxpulse.com/version.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Version_Release_Message" condition="!=" lvalue="%USERVAR[Version_Info]%" rvalue="v0.1a"><operator type="readweb" nvalue="http://dynamic.room.adder.mxpulse.com/version.ini" lvalue="l" rvalue="2"/></out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#%USERVAR[Version_Release_Message]%</out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Version.Check.Date.txt" mode="t">%DATE%</out>
// Read in the rooms Topic and User Count from files in the Database
<out type="push" extdata="ROOMTOPIC"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Topic.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="ROOMCOUNT"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\Dynamic.Room.Adder\.Users.ini" lvalue="l" rvalue="1"/></out>
// Check if the data required to add a room has been supplied by the rooms Admins, if it hasn't break
<out type="break" condition="==" lvalue="$ROOMTOPIC$" rvalue=""></out>
<out type="break" condition="==" lvalue="$ROOMCOUNT$" rvalue=""></out>
// Locate the hosts IP Address
<out type="push" extdata="IP_Address"><operator type="readweb" nvalue="http://whatsmyip.net/" lvalue="l" rvalue="5"/></out>
<out type="push" extdata="IP_Address" condition="!_?" lvalue="$IP_Address$" rvalue="<title>"><operator type="readweb" nvalue="http://whatsmyip.net/" lvalue="l" rvalue="4"/></out>
<out type="push" extdata="IP_Address" condition="!_?" lvalue="$IP_Address$" rvalue="<title>"><operator type="readweb" nvalue="http://whatsmyip.net/" lvalue="l" rvalue="6"/></out>
<out condition="!_?" lvalue="$IP_Address$" rvalue="<title>">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#Your room couldn't be added at this time because your IP Address couldn't be resolved, Contact Pri!</out>
<out type="break" condition="!_?" lvalue="$IP_Address$" rvalue="<title>"></out>
<out type="push" extdata="IP_Address"><operator type="strrem" lvalue="$IP_Address$" rvalue="<title>What's My IP - Your IP is: "/></out>
<out type="push" extdata="IP_Address"><operator type="strrem" lvalue="$IP_Address$" rvalue="</title>"/></out>
<out condition="!_?" lvalue="$IP_Address$" rvalue=".">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#Your room couldn't be added at this time because your IP Address couldn't be resolved, Contact Pri!</out>
<out type="break" condition="!_?" lvalue="$IP_Address$" rvalue="."></out>
// Encode the hosts IP Address (Service provided by WinMXUnlimited.net, check it out! - Lots of good API's)
<out type="push" extdata="Hashcode"><operator type="readweb" nvalue="http://winmxunlimited.net/utilities/api/hashcode/convert.php?input=%USERVAR[IP_Address]%&amp;output=xml" lvalue="l" rvalue="2"/></out>
<out condition="!_?" lvalue="$Hashcode$" rvalue="<hashcode>">/opmsg #c4#Dynamic Room Adder #c63#(#c62#v0.1a#c63#): #c9#Your room couldn't be added at this time because your IP Address couldn't be converted in to its Hash Value, Contact Pri!</out>
<out type="break" condition="!_?" lvalue="$Hashcode$" rvalue="<hashcode>"></out>
<out type="push" extdata="Hashcode"><operator type="strrem" lvalue="$Hashcode$" rvalue="<hashcode>"/></out>
<out type="push" extdata="Hashcode"><operator type="strrem" lvalue="$Hashcode$" rvalue="</hashcode>"/></out>
// Locate and take the Port Number from the roomname
<out type="push" extdata="String_Length"><operator type="strlen" lvalue="%ROOMNAME%"/></out>
<out type="push" extdata="String_Length_Deduction"><operator type="-" lvalue="%USERVAR[String_Length]%" rvalue="4"/></out>
<out type="push" extdata="Port_Number"><operator type="strright" lvalue="%ROOMNAME%" rvalue="%USERVAR[String_Length_Deduction]%"/></out>
// Remove the entire Hash from the room name
<out type="push" extdata="String_Length_Deduction"><operator type="-" lvalue="%USERVAR[String_Length]%" rvalue="12"/></out>
<out type="push" extdata="Room_Name_Hash"><operator type="strright" lvalue="%ROOMNAME%" rvalue="%USERVAR[String_Length_Deduction]%"/></out>
<out type="push" extdata="Room_Name_Without_Hash"><operator type="strrem" lvalue="%ROOMNAME%" rvalue="$Room_Name_Hash$"/></out>
// Create the final encoding
<out type="push" extdata="ROOMNAME">%USERVAR[Room_Name_Without_Hash]%%USERVAR[Hashcode]%%USERVAR[Port_Number]%</out>
// Replace some characters that are not http friendly
<out type="push" extdata="ROOMNAME"><operator type="strrep" nvalue="%USERVAR[ROOMNAME]%" lvalue="&amp;" rvalue="%26"/></out>
<out type="push" extdata="ROOMNAME"><operator type="strrep" nvalue="%USERVAR[ROOMNAME]%" lvalue="#" rvalue="%23"/></out>
// Send the room to the WPN List
<out type="push" extdata="ReadRequestResult"><operator type="readweb" nvalue="http://winmxunlimited.net/tools/chat-room-list/winmx-chat-manager?roomname=%USERVAR[ROOMNAME]%&amp;usercount=%USERVAR[ROOMCOUNT]%&amp;userlimit=600&amp;topic=%USERVAR[ROOMTOPIC]%&amp;action=add" lvalue="l" rvalue="1"/></out>
// Push the current hour in to a variable so that we wait a maximum of 60 minutes before trying to relist this room
<out type="push" extdata="Previous_Room_Add_Time">%HOUR%</out>
</OnLeave>


</config>