//////////////
//
// Wikipedia v0.3a by Pri (19th of July 2010)
//
//////////////
//
// Commands Included that you can use:
// !Wiki [Query] - Perform a query to locate information about something from Wikipedia.org
// !PrivateWiki - Typing this will set Wikipedia to only give results privately to those who use the command
// !PublicWiki - Typing this will set Wikipedia to give results to the entire room when someone uses the command
// !SetWikiColour [Number] - Set the menu colours to something other than the default Green (#c4#) to better fit your room
//
//////////////
// 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 !Wiki [Query] and see the results
* ®ÊN Pri *
!wiki %PARAM%
// Filter input so it cannot be activated mid-sentance
%TRIGGER%
// Check that the scripts folder and settings file has been setup. If it hasn't do it.
cmd.exe /c MD C:\Pri.Script.Dependencies\Wikipedia
1
// 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)
// Load in the menucolour selected by the admins, if nothing found default is #c4#
// Check if the script has been set to Public or Private Mode
// If the user has selected to use private commands formulate how it should look for this query
// Check if there is a Cache for this Wikipedia Entry already and if there is, out put it to the room/user
%PARAM%
// If this cache was made with an earlier version of this script then don't use the cache and use a new query instead
00-00-00
// If the cache is within 1 month old then display that to the room
%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY1]% #c63#(#c62#Cache#c63#)
%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY2]%
%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY3]%
%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY4]%
%USERVAR[Server_Private_Command]%%USERVAR[LOOKEDUPTODAY5]%
// Check for an updated version of this script
v0.3a
/opmsg #c4#%USERVAR[Menu_Colour]%Wikipedia #c63#(#c62#v0.3a#c63#): #c9#%USERVAR[Version_Release_Message]%
%DATE%
// Push Paramater in to the Link
%PARAM%
http://en.wikipedia.org/w/api.php?action=opensearch%USERVAR[Special_1]%search=%USERVAR[PARAMTHING]%%USERVAR[Special_1]%format=xml
// Query the Link, only line 1 is supposed to contain data but sometimes line 2 and maybe more can aswell, so take first 20 lines anyway
// Swap tags inside the data with a Newline to Seperate data parts
// Swap around data in the XMLDATA for things like Quotes and stuff
// Write the XMLDATA to a file so we can read back individual pieces
$XMLDATA$\n
// Read in the Page Name
// Read in the Content for the User
// Load a 2nd line of Content if the first one is inconclusive
// Read in the Page Address
// Output to the user if no DATA was found and Break thread
%USERVAR[Server_Private_Command]%#c1# · #c9#No Page Exists for this at Wikipedia, Why not create one?
// Send the user the above data!
%USERVAR[Server_Private_Command]%#c62# <· #c4#%USERVAR[Menu_Colour]%%USERVAR[Name]% #c63#(#c62#Web#c63#)
%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# %USERVAR[PageAddress]% #c62#·>
%USERVAR[Server_Private_Command]%#c1# #c62#
%USERVAR[Server_Private_Command]%#c62# <· #c4#%USERVAR[Menu_Colour]%Summary
%USERVAR[Server_Private_Command]%#c1# #c1# #c1# #c1# #c1# %USERVAR[Content]% #c62#·>
// Create a local cache of this data so that it can later be read back. This cache can last a maximum of 1 month.
v0.3a\n
%MONTH%\n
#c62# <· #c4#%USERVAR[Menu_Colour]%%USERVAR[Name]%\n
#c1# #c1# #c1# #c1# #c1# %USERVAR[PageAddress]% #c62#·>\n
#c1# #c62#\n
#c62# <· #c4#%USERVAR[Menu_Colour]%Summary\n
#c1# #c1# #c1# #c1# #c1# %USERVAR[Content]% #c62#·>\n
!privatewiki
!publicwiki
// Check if the command was typed at the start of a sentence, if not break
%TRIGGER%
// Process which command the user typed
1\n
0
// Output to the Admins if it was set to Public Mode
/opmsg #c4#%USERVAR[Menu_Colour]%Wikipedia #c63#(#c62#v0.3a#c63#): #c1#Wikipedia Has been set to Public Mode
/opmsg #c4#%USERVAR[Menu_Colour]%Wikipedia #c63#(#c62#v0.3a#c63#): #c62#When this is set to Public, all Wikipedia results will be shown to the entire room
// Break if the user selected to use Public
// If the user selected PrivateWiki, work out which server is in use
0
/hidecmd /privnotice :@:RAWNAME:@::@:SPACE:@:
/hidecmd /privnotice :@:RAWNAME:@::@:SPACE:@:
/message :@:RAWNAME:@::@:SPACE:@:
#private :@:RAWNAME:@: #message:@:SPACE:@:
// Because ZCS does not report itself as ZCS and instead as WinMX we are just going to assume that WinMX = ZCS
/privnotice :@:RAWNAME:@::@:SPACE:@:
// Save the command for later use
%USERVAR[Server_Private_Command]%
// Server not recognised Message
/opmsg #c4#%USERVAR[Menu_Colour]%Wikipedia #c63#(#c62#v0.3a#c63#): #c9#Wikipedia cannot be set to Private in your room as the Server #c63#(#c62#%SERVER%#c63#)#c9# is not supported by the script currently
0
// Output to the Admins if it was set to Private Mode
/opmsg #c4#%USERVAR[Menu_Colour]%Wikipedia #c63#(#c62#v0.3a#c63#): #c1#Wikipedia Has been set to Private Mode
/opmsg #c4#%USERVAR[Menu_Colour]%Wikipedia #c63#(#c62#v0.3a#c63#): #c62#When this is set to Private, only those who use the !Wiki command will see results
// Check that WCS 1.8.8 is in use if the Server is reporting itself as WinMX
1
/stats
WCS Version: %PARAM%
// Tell the user that WCS was detected and that they may have seen some temporary garbled text
/opmsg #c4#%USERVAR[Menu_Colour]%Wikipedia #c63#(#c62#v0.3a#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
// If WCS was detected then save that
1\n/hidecmd /privnotice :@:RAWNAME:@::@:SPACE:@:
// Push 0 to Checking for WCS
0
!setwikicolour %PARAM%
!setwikicolor %PARAM%
// Check if the command was typed at the start of a sentence, if not break
%TRIGGER%
// Encapsulate parameter with colour tags if none are present and save to file
%PARAM%\n
#c%PARAM%#\n
// Output to the Admins what colour it has been set to
/opmsg #c4#%PARAM%Wikipedia #c63#(#c62#v0.3a#c63#): #c1#Wikipedia Has set its colours to#c63#: %PARAM% |||||
/opmsg #c4##c%PARAM%#Wikipedia #c63#(#c62#v0.3a#c63#): #c1#Wikipedia Has set its colours to#c63#: #c%PARAM%# |||||