<config>

//////////////
//
//  IMDB v0.2a by Pri (30th of April 2010)
//
//////////////
//
//  Commands Included that you can use:
//  !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
//  NOT DONE YET: !Hate [Film Name] - Rate a film by saying you hate it (ratings appear on the !IMDB command when used)
//  NOT DONE YET: !like [Film Name] - Rate a film by saying you like it (ratings appear on the !IMDB command when used)
//
//  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
//  NOT DONE YET: !Cache Off - Set the script not to use its Cache (This is just for testing, do not leave the cache off!)
//  NOT DONE YET: !Cache On - Set the script to use its cache again (Default behavier)
//
//////////////

<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>
// 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_2" condition="==" lvalue="$Special_2$" rvalue=""><operator type="readweb" nvalue="http://imdb.mxpulse.com/metis.assistant.txt" lvalue="l" rvalue="2"/></out>
<out type="push" extdata="Special_1" condition="==" lvalue="$Special_1$" rvalue=""><operator type="readweb" nvalue="http://imdb.mxpulse.com/metis.assistant.txt" lvalue="l" rvalue="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"/>
// 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="LOOKEDUPTODAYDATE"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\%USERVAR[searchrequest]%.txt" lvalue="l" rvalue="1"/></out>
<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="2"/></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="3"/></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="4"/></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="5"/></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="6"/></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="7"/></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="8"/></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="9"/></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="10"/></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="11"/></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="12"/></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#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">v0.2a</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="v0.2a"><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#IMDB #c63#(#c62#v0.2a#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>
// Query the MXPulse IMDB API to get the films page ID
<out type="push" extdata="PARAMTHING">%PARAM%</out>
<out type="push" extdata="QUERY">http://imdb.mxpulse.com/query.php?film=%USERVAR[PARAMTHING]%</out>
<out type="push" extdata="string01"><operator type="readweb" nvalue="$QUERY$" lvalue="l" rvalue="1"/></out>
<out condition="_?" lvalue="%USERVAR[string01]%" rvalue="error-code">%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[string01]%" rvalue="error-code"></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[string01]%/</out>
// Query the first 700 lines of the IMDB Page
<out type="push" extdata="string03"><operator type="readweb" nvalue="$OPENLYREADTHIS$" lvalue="c" rvalue="700" /></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=".  " 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="strrem" lvalue="$string03$" rvalue="<p>"/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="</div></div><div class=$Special_2$meta$Special_2$><b>" rvalue="\n.\nRating: "/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="<div class=$Special_2$starbar-meta$Special_2$>        <b>" rvalue="\n.\nRating: "/></out>
<out type="push" extdata="string03"><operator type="strrep" nvalue="$string03$" lvalue="</div>      </div>      <div class=$Special_2$meta$Special_2$>        <b>" rvalue="\n.\nRating: "/></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="$Special_1$#x27;" rvalue="'"/></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=$Special_2$info-content$Special_2$>"/></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"><operator type="readfile" nvalue="C:\Pri.Script.Dependencies\IMDB\.IMDB.Cache.txt" lvalue="l" rvalue="3"/></out>
<out type="push" extdata="string02"><operator type="strrem" lvalue="$string02$" rvalue="$Special_1$#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="$Special_1$#x26;" rvalue="$Special_1$"/></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[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[string01]%/ #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#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="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#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="Genre:"></out>
<out type="goto" extdata="-4" condition="!?" lvalue="$ESRESULTENTRY$" rvalue="Genre:"></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="">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#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#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 5. If its 1 = Ad shows
<out type="push" extdata="Random_Number">%RANDOMNUM[5]%</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#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">%MONTH%\n</out>
<out type="file" mode="a" extdata="C:\Pri.Script.Dependencies\IMDB\%PARAM%.txt">#c62# &lt;· #c4#%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[string01]% #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#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#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#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#IMDB #c63#(#c62#v0.2a#c63#): #c1#IMDB Has been set to Public Mode</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!publicimdb">/opmsg #c4#IMDB #c63#(#c62#v0.2a#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#IMDB #c63#(#c62#v0.2a#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#IMDB #c63#(#c62#v0.2a#c63#): #c1#IMDB Has been set to Private Mode</out>
<out condition="_?" lvalue="%TRIGGER%" rvalue="!privateimdb">/opmsg #c4#IMDB #c63#(#c62#v0.2a#c63#): #c62#When this is set to Private, only those who use the !IMDB command will see results</out>
</command>

</config>