<config>

//////////////
//
//  IMDB v1.0 by Pri (19th of March 2011)
//  This script requires Metis v2.80 & RoboMX v2.08
//  Website: http://www.renmx.com
//  Forum: http://www.mxpulse.com/board
//
///////  COMMANDS
//
//  !IMDB [Film Name] - Perform a query to locate information about a film from IMDB
//  !PrivateIMDB - Typing this will set IMDB to only give results privately to those who use the command
//  !PublicIMDB - Typing this will set IMDB to give results to the entire room when someone uses the command
//  !SetIMDBColour [Number] - Set the menu colours to something other than the default Green (#c4#) to better fit your room
//
//  Dev commands:
//  /APIIMDB [Film Name] - This is for developers so that they can cache content from IMDB for later use by other scripts they make
//
///////  SERVER SUPPORT
//
//  WCS, RCS, ZCS, RSWCS, FXServer and Ouka are all supported out of the box
//
//////////////

<usergroup name="IMDB_Admin_Users" case="0">
// This usergroup is only for your admins so that they can control some of the special commands.
// Everyone even if they are not in this usergroup will be able to type !IMDB [Film Name] and see the results
*  ®ÊN  Pri  *
</usergroup>


<command type="script">
<in>!imdb %PARAM%</in>
<in>!imbd %PARAM%</in>
<in>/apiimdb %PARAM%</in>
// Check that the command[s] were used at the beginning of a sentance
<out type="goto" extdata="4" condition="_?" lvalue="%TRIGGER%" rvalue="/apiimdb "></out>
<out type="push" extdata="req">%TRIGGER%</out>
<out type="push" extdata="req"><operator type="strleft" lvalue="$req$" rvalue="3"/></out>
<out type="break" condition="!_?" lvalue="$req$" rvalue="!im"></out>
// Check that the scripts folder and settings file has been setup. If it hasn't do it.
<out type="push" extdata="IMDB_Setup_Check"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.IMDB.ini" lvalue="l" rvalue="1"/></out>
<out condition="==" lvalue="$IMDB_Setup_Check$" rvalue="" type="exec" extdata="1">cmd.exe /c MD C:\Pri.Script.Dependencies\IMDB\Ratings</out>
<out condition="==" lvalue="$IMDB_Setup_Check$" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\IMDB\.IMDB.ini" mode="t">1</out>
// Pop some varibles for later use
<out type="push" extdata="IMDBLIKEORHATE">1</out>
<out type="pop" extdata="QUERY"/>
<out type="pop" extdata="IMDB_LIKE"/>
<out type="pop" extdata="IMDB_HATE"/>
<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\IMDB\.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\IMDB\.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\IMDB\.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 if there is a Cache for this Movie already and if there is, output it to the room
<out type="push" extdata="searchrequest">%PARAM%</out>
<out type="push" extdata="searchrequest"> <operator type="strlwr" lvalue="%USERVAR[searchrequest]%" /> </out>
<out type="push" extdata="Cache_Version"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="LOOKEDUPTODAYDATE"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="2"/></out>
// If this cache was made with an earlier version of this script then don't use the cache and use a new query instead
<out type="push" extdata="LOOKEDUPTODAYDATE" condition="!=" lvalue="$Cache_Version$" rvalue="v1.0">00-00-00</out>
// Always bypass the cache if this lookup was triggered by the API command
<out type="goto" extdata="33" condition="_?" lvalue="%TRIGGER%" rvalue="/apiimdb "></out>
<out type="push" extdata="LOOKEDUPTODAY1" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="3"/></out>
<out type="push" extdata="LOOKEDUPTODAY2" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="4"/></out>
<out type="push" extdata="LOOKEDUPTODAY3" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="5"/></out>
<out type="push" extdata="LOOKEDUPTODAY4" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="6"/></out>
<out type="push" extdata="LOOKEDUPTODAY5" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="7"/></out>
<out type="push" extdata="LOOKEDUPTODAY6" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="8"/></out>
<out type="push" extdata="LOOKEDUPTODAY7" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="9"/></out>
<out type="push" extdata="LOOKEDUPTODAY8" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="10"/></out>
<out type="push" extdata="LOOKEDUPTODAY9" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="11"/></out>
<out type="push" extdata="LOOKEDUPTODAY10" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="12"/></out>
<out type="push" extdata="LOOKEDUPTODAY11" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="13"/></out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY1]% #c63#(#c62#Cache#c63#)</out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY2]%</out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY3]%</out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY4]%</out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY5]%</out>
<out type="goto" extdata="4" condition="==" lvalue="$LOOKEDUPTODAY6$" rvalue=""></out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY6]%</out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY7]%</out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY8]%</out>
<out type="goto" extdata="4" condition="==" lvalue="$LOOKEDUPTODAY9$" rvalue=""></out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY9]%</out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY10]%</out>
<out condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%">%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY11]%</out>
<out type="push" extdata="IMDB_LIKE" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\Ratings\%USERVAR[searchrequest]%.Like.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="IMDB_HATE" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\Ratings\%USERVAR[searchrequest]%.Hate.txt" lvalue="l" rvalue="1"/></out>
<out type="goto" extdata="2" condition="!=" lvalue="$IMDB_LIKE$" rvalue=""></out>
<out type="goto" extdata="5" condition="==" lvalue="$IMDB_HATE$" rvalue=""></out>
<out condition="==" lvalue="$IMDBLIKEORHATE$" rvalue="1">%USERVAR[Server_Private_Command]%#c1# #c62#</out>
<out condition="==" lvalue="$IMDBLIKEORHATE$" rvalue="1">%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Room Rating</out>
<out condition="!=" lvalue="$IMDB_LIKE$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# #c1#Liked By#c63#: #c10#%USERVAR[IMDB_LIKE]% #c62#·&gt;</out>
<out condition="!=" lvalue="$IMDB_HATE$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# #c1#Hated By#c63#: #c10#%USERVAR[IMDB_HATE]% #c62#·&gt;</out>
<out type="break" condition="==" lvalue="$LOOKEDUPTODAYDATE$" rvalue="%MONTH%"></out>
// Check for an updated version of this script
<out type="push" extdata="Version_Info">v1.0</out>
<out type="pop" extdata="Version_Release_Message"/>
<out type="push" extdata="Version_Check_Date"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.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://imdb.mxpulse.com/version.ini" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="Version_Release_Message" condition="!=" lvalue="%USERVAR[Version_Info]%" rvalue="v1.0"><operator type="readweb" nvalue="http://imdb.mxpulse.com/version.ini" lvalue="l" rvalue="2"/></out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="">/opmsg #c4#%USERVAR[Menu_Colour]%IMDB #c63#(#c62#v1.0#c63#): #c9#%USERVAR[Version_Release_Message]%</out>
<out condition="!=" lvalue="%USERVAR[Version_Release_Message]%" rvalue="" type="file" extdata="C:\Pri.Script.Dependencies\IMDB\.Version.Check.Date.txt" mode="t">%DATE%</out>
// Download Advertisement/Credit Message
<out type="push" extdata="Advertisement"><operator type="readweb" nvalue="http://imdb.mxpulse.com/advertisement.txt" lvalue="l" rvalue="1"/></out>
// Setline 0 for a loopback
<out type="push" extdata="API_Response_Line">0</out>
// Query the MXPulse IMDB API to get the films page ID  (This is the v4 of the API, you can try the experimental v5 API if you want but it isn't supported by this script)
<out type="push" extdata="PARAMTHING">%PARAM%</out>
<out type="push" extdata="QUERY">http://imdb.mxpulse.com/v4/query.php?film=%USERVAR[PARAMTHING]%</out>
// Increase API_Response_Line by 1
<out type="push" extdata="API_Response_Line"><operator type="+" lvalue="$API_Response_Line$" rvalue="1"/></out>
// Create a cache of the 20 responses that the MXPulse API sends to the bot, but only if the first response didn't match the users query
<out type="push" extdata="API_Response" condition="==" lvalue="$API_Response_Line$" rvalue="2"><operator type="readweb" nvalue="$QUERY$" lvalue="l" rvalue="20"/></out>
// Begin querying line 1
<out type="push" extdata="API_Response"><operator type="readweb" nvalue="$QUERY$" lvalue="l" rvalue="$API_Response_Line$"/></out>
// Skip the Blank check if we've moved on to response 2 or above
<out type="goto" extdata="3" condition="!=" lvalue="$API_Response_Line$" rvalue="1"></out>
// Send a message to the user in the event that the movie couldn't be located
<out condition="==" lvalue="%USERVAR[API_Response]%" rvalue="">%USERVAR[Server_Private_Command]%#c1# · #c9#Unable to locate this Movie at the IMDB, Please try again later.</out>
<out type="break" condition="==" lvalue="%USERVAR[API_Response]%" rvalue=""></out>
// Push the first result to API_Response if it has already reached a count of 21 on the reading
<out extdata="API_Response" condition="==" lvalue="$API_Response_Line$" rvalue="21"><operator type="readweb" nvalue="$QUERY$" lvalue="l" rvalue="1"/></out>
// Locate the ID from this movie
<out type="push" extdata="IMDB_ID_Code"><operator type="strleft" lvalue="$API_Response$" rvalue="7"/></out>
// Seperate the ID from the API's response and then compare the user query to the API's title response
<out type="push" extdata="IMDB_Title_And_Year"><operator type="strrem" lvalue="$API_Response$" rvalue="$IMDB_ID_Code$ :@: "/></out>
// The API makes avalible 20 logical suggestions of what the movie this user wants is, arranged in what the API believes is most likely at the top, least at the bottom
// If the first response doesn't contain the query the user sent within it, then it checks the 2nd response then the 3rd and so on until all 20. If no match is found it chooses the 1st response
<out type="goto" extdata="2" condition="==" lvalue="$API_Response_Line$" rvalue="21"></out>
<out type="goto" extdata="-10" condition="!_?" lvalue="$IMDB_Title_And_Year$" rvalue="$PARAMTHING$"></out>
// Create the URL to query using the IMDB number from MXPulse.com
<out type="push" extdata="OPENLYREADTHIS">http://www.imdb.com/title/tt%USERVAR[IMDB_ID_Code]%/</out>
// Query the first 1000 lines of the IMDB Page
<out type="push" extdata="string03"><operator type="readweb" nvalue="$OPENLYREADTHIS$" lvalue="c" rvalue="1500" /></out>
// Filter the results for reading back later on
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="<title>" rvalue="\n"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="</title>" rvalue="\n"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="Directed by " rvalue="\n"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue=". With" rvalue="\nWith"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue=".  " rvalue="\n"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="<h5>Plot:</h5>" rvalue="\n.\nPlot: "/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue=" <a class=" rvalue="\n.\n"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="<p><p>" rvalue="\n.\nPlot: "/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="</p>" rvalue="\n."/></out>
<out type="push" extdata="string03"><operator type="strrem" lvalue="$string03$" rvalue="<p>"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="</div></div><div class=&quot;meta&quot;><b>" rvalue="\n.\nRating: "/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="<div class=&quot;starbar-meta&quot;>        <b>" rvalue="\n.\nRating: "/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="</div>      </div>      <div class=&quot;meta&quot;>        <b>" rvalue="\n.\nRating: "/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="id=&quot;star-bar-user-rate&quot;><b>" rvalue="\n.\nRating: "/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="<a href=&quot;plotsummary&quot;>See full summary" rvalue=" #c9#&lt;···&gt;\n"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="</div><div class=" rvalue="\n.\n"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="</b>" rvalue="\n.\n"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="&amp;#x27;" rvalue="'"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="amp;#x27;" rvalue="[']"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="&amp;[']" rvalue="'"/></out>
<out type="push" extdata="string03"><operator type="strrem" lvalue="$string03$" rvalue="<p>"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="                                                                    </div>" rvalue="\n."/></out>
<out type="push" extdata="string03"><operator type="strrem" lvalue="$string03$" rvalue="<div class=&quot;info-content&quot;>"/></out>
<out type="push" extdata="string03"><operator type="strrem" lvalue="$string03$" rvalue="</div>"/></out>
// Save the filtered output to file for reading back
<out type="file" mode="t" extdata="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.txt">1\n$string03$\n</out>
// Locate the Movie rating (out of 10) from the IMDB Page
<out type="push" extdata="ESRLINE">0</out>
<out type="push" extdata="ESRLINE"><operator type="+" lvalue="$ESRLINE$" rvalue="1"/></out>
<out type="push" extdata="RATING"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.txt" lvalue="l" rvalue="$ESRLINE$"/></out>
<out type="goto" extdata="3" condition="==" lvalue="$RATING$" rvalue=""></out>
<out type="goto" extdata="2" condition="?" lvalue="$RATING$" rvalue="Rating: "></out>
<out type="goto" extdata="-4" condition="!?" lvalue="$RATING$" rvalue="Rating: "></out>
<out type="push" extdata="RATING"><operator type="strrem" lvalue="$RATING$" rvalue="Rating: "/></out>
<out type="push" extdata="RATING"><operator type="strrem" lvalue="$RATING$" rvalue="/10"/></out>
<out type="push" extdata="string02">$IMDB_Title_And_Year$</out>
<out type="push" extdata="string02"><operator type="strrem" lvalue="$string02$" rvalue="&amp;#x22;"/></out>
<out type="push" extdata="string02"><operator type="strrem" lvalue="$string02$" rvalue="/II"/></out>
<out type="push" extdata="string02"><operator type="strrem" lvalue="$string02$" rvalue="/I"/></out>
<out type="push" extdata="string04"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.txt" lvalue="l" rvalue="5"/></out>
<out type="push" extdata="string02"><operator type="strrep" nvalue="$string02$" lvalue="&amp;#x26;" rvalue="&amp;"/></out>
<out type="goto" extdata="3" condition="_?" lvalue="%TRIGGER%" rvalue="/apiimdb "></out>
// Filter the rating output for outputting to the room and saving
<out type="push" extdata="RATING"><operator type="strrem" lvalue="$RATING$" rvalue="#c9#/#c1#10"/></out>
<out type="push" extdata="RATING"><operator type="strrem" lvalue="$RATING$" rvalue="#c63#/#c1#10"/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="1." rvalue="#c8#1."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="2." rvalue="#c8#2."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="3." rvalue="#c8#3."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="4." rvalue="#c16#4."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="5." rvalue="#c16#5."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="6." rvalue="#c16#6."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="7." rvalue="#c4#7."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="8." rvalue="#c4#8."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="9." rvalue="#c4#9."/></out>
<out type="push" extdata="RATING"><operator type="strrep" nvalue="$RATING$" lvalue="10." rvalue="#c4#9."/></out>
<out type="push" extdata="RATING" condition="==" lvalue="$RATING$" rvalue="">#c8#0.0</out>
// Output the Movie Name, Rating and Page URL
<out>%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%%USERVAR[string02]% #c1#· %USERVAR[RATING]%#c63#/#c1#10 #c63#(#c62#Web#c63#)</out>
<out>%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# http://www.imdb.com/title/tt%USERVAR[IMDB_ID_Code]%/ #c62#·&gt;</out>
// Pop some Varibles for later use
<out type="pop" extdata="string04" condition="==" lvalue="$string04$" rvalue="."></out>
<out type="pop" extdata="string04" condition="_?" lvalue="$string04$" rvalue="IMDB"></out>
<out type="pop" extdata="string04" condition="_?" lvalue="$string04$" rvalue="="></out>
<out type="Push" extdata="string05" condition="?" lvalue="$string04$" rvalue="With "></out>
<out type="Pop" extdata="string05" condition="?" lvalue="$string04$" rvalue="With "></out>
<out type="goto" extdata="4" condition="_?" lvalue="%TRIGGER%" rvalue="/apiimdb "></out>
// Output the Director[s] of the Movie
<out condition="!=" lvalue="$string04$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c62#</out>
<out condition="!=" lvalue="$string04$" rvalue="">%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Direction</out>
<out condition="!=" lvalue="$string04$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# %USERVAR[string04]% #c62#·&gt;</out>
// Read in the previous temp cache, change some .'s to Newlines, and save again
<out type="push" extdata="string05"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.txt" lvalue="l" rvalue="6"/></out>
<out type="push" extdata="string05"><operator type="strrep" nvalue="$string05$" lvalue=". " rvalue="\n"/></out>
<out type="push" extdata="string05"><operator type="strrep" nvalue="$string05$" lvalue=".&quot; /&gt;        " rvalue="\n"/></out>
<out type="file" mode="t" extdata="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.2.txt">$string05$</out>
<out type="push" extdata="string05"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.2.txt" lvalue="l" rvalue="1"/></out>
// Filter some more stuff from the temp cache
<out type="pop" extdata="string05" condition="==" lvalue="$string05$" rvalue="."></out>
<out type="pop" extdata="string05" condition="_?" lvalue="$string05$" rvalue="IMDB"></out>
<out type="pop" extdata="string05" condition="_?" lvalue="$string05$" rvalue="="></out>
<out type="push" extdata="string05"><operator type="strrem" lvalue="$string05$" rvalue="With "/></out>
<out type="goto" extdata="4" condition="_?" lvalue="%TRIGGER%" rvalue="/apiimdb "></out>
// Output the Actors of the film
<out condition="!=" lvalue="$string05$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c62#</out>
<out condition="!=" lvalue="$string05$" rvalue="">%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Actors of Significance</out>
<out condition="!=" lvalue="$string05$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# %USERVAR[string05]% #c62#·&gt;</out>
// Read in all the Genre information for this film
<out type="pop" extdata="GENRE_DATA"/>
<out type="push" extdata="ESRLINE">0</out>
<out type="push" extdata="ESRLINE"><operator type="+" lvalue="$ESRLINE$" rvalue="1"/></out>
<out type="push" extdata="ESRESULTENTRY"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.txt" lvalue="l" rvalue="$ESRLINE$"/></out>
<out type="goto" extdata="3" condition="==" lvalue="$ESRESULTENTRY$" rvalue=""></out>
<out type="goto" extdata="2" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Genres:"></out>
<out type="goto" extdata="-4" condition="!?" lvalue="$ESRESULTENTRY$" rvalue="Genres:"></out>
// Process all the possible Genres so they look nice
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Action">#c9#,#c62# Action</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Adventure">$GENRE_DATA$#c9#,#c62# Adventure</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Animation">$GENRE_DATA$#c9#,#c62# Animation</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Biography">$GENRE_DATA$#c9#,#c62# Biography</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Comedy">$GENRE_DATA$#c9#,#c62# Comedy</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Crime">$GENRE_DATA$#c9#,#c62# Crime</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Documentary">$GENRE_DATA$#c9#,#c62# Documentary</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Drama">$GENRE_DATA$#c9#,#c62# Drama</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Family">$GENRE_DATA$#c9#,#c62# Family</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Fantasy">$GENRE_DATA$#c9#,#c62# Fantasy</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="History">$GENRE_DATA$#c9#,#c62# History</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Horror">$GENRE_DATA$#c9#,#c62# Horror</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Music">$GENRE_DATA$#c9#,#c62# Music</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Musical">$GENRE_DATA$#c9#,#c62# Musical</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Romance">$GENRE_DATA$#c9#,#c62# Romance</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Short">$GENRE_DATA$#c9#,#c62# Short</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Sci-Fi">$GENRE_DATA$#c9#,#c62# Sci-Fi</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Thriller">$GENRE_DATA$#c9#,#c62# Thriller</out>
<out type="push" extdata="GENRE_DATA" condition="?" lvalue="$ESRESULTENTRY$" rvalue="War">$GENRE_DATA$#c9#,#c62# War</out>
<out type="push" extdata="GENRE_DATA" condition="==" lvalue="$GENRE_DATA$" rvalue="">No Genre Found</out>
<out type="push" extdata="GENRE_DATA">#c63#(#c62#%USERVAR[GENRE_DATA]%#c63#)</out>
<out type="push" extdata="GENRE_DATA"><operator type="strrep" nvalue="$GENRE_DATA$" lvalue="#c63#(#c62##c9#,#c62# " rvalue="#c63#(#c62#"/></out>
// Process the Plot
<out type="push" extdata="ESRLINE">0</out>
<out type="push" extdata="ESRLINE"><operator type="+" lvalue="$ESRLINE$" rvalue="1"/></out>
<out type="push" extdata="ESRESULTENTRY"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.txt" lvalue="l" rvalue="$ESRLINE$"/></out>
<out type="goto" extdata="3" condition="==" lvalue="$ESRESULTENTRY$" rvalue=""></out>
<out type="goto" extdata="2" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Plot: "></out>
<out type="goto" extdata="-4" condition="!?" lvalue="$ESRESULTENTRY$" rvalue="Plot: "></out>
<out type="push" extdata="ESRESULTENTRY"><operator type="strrem" lvalue="$ESRESULTENTRY$" rvalue="Plot: "/></out>
<out type="push" extdata="ESRESULTENTRY"><operator type="strrem" lvalue="$ESRESULTENTRY$" rvalue="|"/></out>
<out type="push" extdata="ESRESULTENTRY" condition="?" lvalue="$ESRESULTENTRY$" rvalue="Full synopsis"></out>
<out type="push" extdata="ESRESULTENTRY" condition="==" lvalue="$ESRESULTENTRY$" rvalue="">No Plot for that Title could be Found, try visiting the IMDB page manually using the above Address.</out>
<out type="goto" extdata="3" condition="_?" lvalue="%TRIGGER%" rvalue="/apiimdb "></out>
<out condition="!=" lvalue="$string03$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c62#</out>
<out condition="!=" lvalue="$string03$" rvalue="">%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Plot Summary %USERVAR[GENRE_DATA]%</out>
<out type="push" extdata="ESRESULTENTRY"><operator type="strrem" lvalue="$ESRESULTENTRY$" rvalue="  "/></out>
<out type="goto" extdata="2" condition="_?" lvalue="%TRIGGER%" rvalue="/apiimdb "></out>
<out condition="!=" lvalue="$string03$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# %USERVAR[ESRESULTENTRY]% #c62#·&gt;</out>
<out type="push" extdata="IMDB_LIKE"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\Ratings\%USERVAR[searchrequest]%.Like.txt" lvalue="l" rvalue="1"/></out>
<out type="push" extdata="IMDB_HATE"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\Ratings\%USERVAR[searchrequest]%.Hate.txt" lvalue="l" rvalue="1"/></out>
<out type="goto" extdata="7" condition="_?" lvalue="%TRIGGER%" rvalue="/apiimdb "></out>
<out type="goto" extdata="2" condition="!=" lvalue="$IMDB_LIKE$" rvalue=""></out>
<out type="goto" extdata="5" condition="==" lvalue="$IMDB_HATE$" rvalue=""></out>
<out condition="==" lvalue="$IMDBLIKEORHATE$" rvalue="1">%USERVAR[Server_Private_Command]%#c1# #c62#</out>
<out condition="==" lvalue="$IMDBLIKEORHATE$" rvalue="1">%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Room Rating</out>
<out condition="!=" lvalue="$IMDB_LIKE$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# #c1#Liked By#c63#: #c10#%USERVAR[IMDB_LIKE]% #c62#·&gt;</out>
<out condition="!=" lvalue="$IMDB_HATE$" rvalue="">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# #c1#Hated By#c63#: #c10#%USERVAR[IMDB_HATE]% #c62#·&gt;</out>
// Break here if the Plot for the movie wasn't found
<out type="break" condition="_?" lvalue="$ESRESULTENTRY$" rvalue="No Plot for that Title could be Found"></out>
// Show an Advertisment from Pri when the script is run, create a random number between 1 and 15. If its 1 = Ad shows
<out type="push" extdata="Random_Number">%RANDOMNUM[15]%</out>
// Output to room if Randum Number = 1
<out condition="==" lvalue="$Random_Number$" rvalue="1">%USERVAR[Server_Private_Command]%#c1# #c62#</out>
<out condition="==" lvalue="$Random_Number$" rvalue="1">%USERVAR[Server_Private_Command]%#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Advertisement</out>
<out condition="==" lvalue="$Random_Number$" rvalue="1">%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# %USERVAR[Advertisement]% #c62#·&gt;</out>
// Create a local cache of this data so that it can later be read back. This cache can last a maximum of 1 month.
<out type="file" mode="t" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt">v1.0\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt">%MONTH%\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt">#c62# &lt;· #c4#%USERVAR[Menu_Colour]%%USERVAR[string02]%  #c1#· %USERVAR[RATING]%#c63#/#c1#10\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt">#c1# #c1# #c1# #c1# #c1# http://www.imdb.com/title/tt%USERVAR[IMDB_ID_Code]% #c62#·&gt;\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt" condition="!=" lvalue="$string04$" rvalue="">#c1# #c62#\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt" condition="!=" lvalue="$string04$" rvalue="">#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Direction\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt" condition="!=" lvalue="$string04$" rvalue="">#c1# #c1# #c1# #c1# #c1# %USERVAR[string04]% #c62#·&gt;\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt" condition="!=" lvalue="$string04$" rvalue="">#c1# #c62#\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt" condition="!=" lvalue="$string04$" rvalue="">#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Actors of Significance\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt" condition="!=" lvalue="$string04$" rvalue="">#c1# #c1# #c1# #c1# #c1# %USERVAR[string05]% #c62#·&gt;\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt">#c1# #c62#\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt">#c62# &lt;· #c4#%USERVAR[Menu_Colour]%Plot Summary %USERVAR[GENRE_DATA]%\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt">#c1# #c1# #c1# #c1# #c1# %USERVAR[ESRESULTENTRY]% #c62#·&gt;\n</out>
</command>

<command type="script" usergroup="IMDB_Admin_Users">
<in>!privateimdb</in>
<in>!publicimdb</in>
// Check if the command was typed at the start of a sentence, if not break
<out type="push" extdata="IMDB_CMD_REQ">%TRIGGER%</out>
<out type="push" extdata="IMDB_CMD_REQ"><operator type="strleft" lvalue="$IMDB_CMD_REQ$" rvalue="1"/></out>
<out type="break" condition="!_?" lvalue="$IMDB_CMD_REQ$" rvalue="!"></out>
// Process which command the user typed
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="!privateimdb" extdata="C:\Pri.Script.Dependencies\IMDB\.Public.Private.Server.Settings.ini">1\n</out>
<out type="file" mode="t" condition="_?" lvalue="%TRIGGER%" rvalue="!publicimdb" extdata="C:\Pri.Script.Dependencies\IMDB\.Public.Private.Server.Settings.ini">0</out>
// Output to the Admins if it was set to Public Mode
<out condition="_?" lvalue="%TRIGGER%" rvalue="!publicimdb">/opmsg #c4#%USERVAR[Menu_Colour]%IMDB #c63#(#c62#v1.0#c63#): #c1#IMDB Has been set to Public Mode</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!publicimdb">/opmsg #c4#%USERVAR[Menu_Colour]%IMDB #c63#(#c62#v1.0#c63#): #c62#When this is set to Public, all IMDB results will be shown to the entire room</out>
// Break if the user selected to use Public
<out type="break" condition="_?" lvalue="%TRIGGER%" rvalue="!publicimdb"></out>
// If the user selected PrivateIMDB, 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\IMDB\.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]%IMDB #c63#(#c62#v1.0#c63#): #c9#IMDB 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\IMDB\.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="!privateimdb">/opmsg #c4#%USERVAR[Menu_Colour]%IMDB #c63#(#c62#v1.0#c63#): #c1#IMDB Has been set to Private Mode</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!privateimdb">/opmsg #c4#%USERVAR[Menu_Colour]%IMDB #c63#(#c62#v1.0#c63#): #c62#When this is set to Private, only those who use the !IMDB command 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="IMDB_Checking_For_WCS" condition="?" lvalue="%SERVER%" rvalue="WinMX">1</out>
<out condition="?" lvalue="%SERVER%" rvalue="WinMX">/stats</out>
</command>

<command type="script" condition="==" lvalue="$IMDB_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]%IMDB #c63#(#c62#v1.0#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\IMDB\.Public.Private.Server.Settings.ini">1\n/hidecmd /privnotice :@:RAWNAME:@::@:SPACE:@:</out>
// Push 0 to Checking for WCS
<out type="push" extdata="IMDB_Checking_For_WCS">0</out>
</command>

<command type="script" usergroup="IMDB_Admin_Users">
<in>!setimdbcolour %PARAM%</in>
<in>!setimdbcolor %PARAM%</in>
// Check if the command was typed at the start of a sentence, if not break
<out type="push" extdata="IMDB_CMD_REQ">%TRIGGER%</out>
<out type="push" extdata="IMDB_CMD_REQ"><operator type="strleft" lvalue="$IMDB_CMD_REQ$" rvalue="12"/></out>
<out type="break" condition="!_?" lvalue="$IMDB_CMD_REQ$" rvalue="!setimdbcolo"></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\IMDB\.Menu.Colour.ini">%PARAM%\n</out>
<out type="file" mode="t" condition="!?" lvalue="%PARAM%" rvalue="#c" extdata="C:\Pri.Script.Dependencies\IMDB\.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%IMDB #c63#(#c62#v1.0#c63#): #c1#IMDB Has set its colours to#c63#: %PARAM% |||||</out>
<out condition="!?" lvalue="%PARAM%" rvalue="#c">/opmsg #c4##c%PARAM%#IMDB #c63#(#c62#v1.0#c63#): #c1#IMDB Has set its colours to#c63#: #c%PARAM%# |||||</out>
</command>

</config>