Janilabo

MSSL.scar

Sep 19th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 10.77 KB | None | 0 0
  1. {==============================================================================]
  2. |      M A S S I V E  •  S C A R  •  S C R I P T I N G  •  L I B R A R Y       |
  3. |==============================================================================|
  4. |            ___               ___               ___               ___         |
  5. |           /\__\             /\  \             /\  \             /\__\        |    
  6. |          /  |  |           /  \  \           /  \  \           / /  /        |
  7. |         / | |  |          / /\ \  \         / /\ \  \         / /  /         |
  8. |        / /| |__|__       _\ \ \ \  \       _\ \ \ \  \       / /  /          |
  9. |       / / |    \__\     /\ \ \ \ \__\     /\ \ \ \ \__\     / /__/           |
  10. |       \/__/--/ /  /     \ \ \ \ \/__/     \ \ \ \ \/__/     \ \  \           |
  11. |             / /  /       \ \ \ \__\        \ \ \ \__\        \ \  \          |
  12. |            / /  /         \ \/ /  /         \ \/ /  /         \ \  \         |
  13. |           / /  /           \  /  /           \  /  /           \ \__\        |
  14. |           \/__/             \/__/             \/__/             \/__/        |
  15. |                                                                              |
  16. |==============================================================================|
  17. |      :::::::::::::::::  V E R S I O N  0.84  B E T A  ::::::::::::::::       |
  18. [==============================================================================}
  19.  
  20. {$IFNDEF SCAR335_UP}
  21.   {$ERROR [MSSL] Please update your copy of SCAR to version 3.35[+]}
  22. {$ENDIF}
  23.        
  24. {==============================================================================|  
  25.                            MSSL Core Level-1 Includes                          
  26.                          Data and Mathematics Routines.                        
  27. [==============================================================================}
  28. {$I Library\Core\Level-1\Miscellaneous.scar}
  29. {$I Library\Core\Level-1\Math.scar}
  30. {$I Library\Core\Level-1\Measuring.scar}
  31. {$I Library\Core\Level-1\Integer.scar}
  32. {$I Library\Core\Level-1\Extended.scar}
  33. {$I Library\Core\Level-1\Char.scar}
  34. {$I Library\Core\Level-1\String.scar}
  35. {$I Library\Core\Level-1\Boolean.scar}
  36. {$I Library\Core\Level-1\Variant.scar}
  37. {$I Library\Core\Level-1\Box.scar}
  38. {$I Library\Core\Level-1\Point.scar}
  39.  
  40. {==============================================================================|  
  41.                            MSSL Core Level-2 Includes                          
  42.               Input, Output, File, Client, Time and Date routines.              
  43. [==============================================================================}
  44. {$I Library\Core\Level-2\Date.scar}
  45. {$I Library\Core\Level-2\Time.scar}
  46. {$I Library\Core\Level-2\Path.scar}
  47. {$I Library\Core\Level-2\Directory.scar}
  48. {$I Library\Core\Level-2\File.scar}
  49. {$I Library\Core\Level-2\Bitmap.scar}
  50. {$I Library\Core\Level-2\DTM.scar}
  51. {$I Library\Core\Level-2\Color.scar}
  52. {$I Library\Core\Level-2\OCR.scar}
  53. {$I Library\Core\Level-2\Mouse.scar}
  54. {$I Library\Core\Level-2\Keyboard.scar}
  55. {$I Library\Core\Level-2\Client.scar}
  56.  
  57. {==============================================================================|  
  58.                            MSSL Core Level-3 Includes                          
  59.                      Data Processing and Tools & Utilities.                    
  60. [==============================================================================}
  61. {$I Library\Core\Level-3\Grid.scar}
  62. {$I Library\Core\Level-3\Sorting.scar}
  63. {$I Library\Core\Level-3\Range.scar}
  64. {$I Library\Core\Level-3\Command.scar}
  65. {$I Library\Core\Level-3\Memory.scar}
  66. {$I Library\Core\Level-3\Conversion.scar}
  67.  
  68. {==============================================================================|  
  69.   const MSSL_LIBRARY_ID = Integer;
  70.   Contributors: Janilabo
  71.   Description: Constant for MSSL ID.
  72.   Created: September 30th, 2012.                  
  73. [==============================================================================}
  74. const
  75.   MSSL_LIBRARY_ID = 84;
  76.      
  77. {==============================================================================|  
  78.   const MSSL_LIBRARY_MAIN_VERSION = Integer;
  79.   Contributors: Janilabo
  80.   Description: Constant for MSSL Main Version.
  81.   Created: September 30th, 2012.                  
  82. [==============================================================================}
  83. const
  84.   MSSL_LIBRARY_MAIN_VERSION = 0;
  85.  
  86. {==============================================================================|  
  87.   const MSSL_LIBRARY_MINOR_VERSION = Integer;
  88.   Contributors: Janilabo
  89.   Description: Constant for MSSL Minor Version.
  90.   Created: September 30th, 2012.                  
  91. [==============================================================================}
  92. const
  93.   MSSL_LIBRARY_MINOR_VERSION = 84;
  94.  
  95. {==============================================================================|  
  96.   const MSSL_LIBRARY_STATE = string;
  97.   Contributors: Janilabo
  98.   Description: Constant for MSSL State ('Alpha', 'Beta').
  99.   Created: September 30th, 2012.                  
  100. [==============================================================================}
  101. const
  102.   MSSL_LIBRARY_STATE = 'Beta';  
  103.  
  104. //{$DEFINE MSSL_Compile}
  105.  
  106. {$IFDEF MSSL_Compile}
  107.   {$DEFINE RSCE}
  108.   {$DEFINE RSC}
  109.   {$DEFINE SW}
  110. {$ENDIF}
  111.  
  112. {==============================================================================|  
  113.                     MSSL Gaming Include - RuneScape Classic                    
  114. |==============================================================================}
  115. {$IFDEF RSC}
  116.   {$I Library\Gaming\RuneScape_Classic\RuneScape_Classic.scar}
  117. {$ENDIF}
  118.  
  119. {==============================================================================|  
  120.                        MSSL Gaming Include - RSCEmulation                      
  121. [==============================================================================}
  122. {$IFDEF RSCE}
  123.   {$I Library\Gaming\RSCEmulation\RSCEmulation.scar}
  124. {$ENDIF}
  125.  
  126. {==============================================================================|  
  127.                       MSSL Gaming Include - Shadow Worlds                      
  128. [==============================================================================}
  129. {$IFDEF SW}
  130.   {$I Library\Gaming\Shadow_Worlds\Shadow_Worlds.scar}
  131. {$ENDIF}
  132.  
  133. {==============================================================================|  
  134.   var MSSL_StartCaption: string;
  135.   Contributors: Janilabo
  136.   Description: Holds SCAR's original title (before MSSL takes over).
  137.                Original title will be restored with unsetupment of MSSL.
  138.   Created: September 30th, 2012.                  
  139. [==============================================================================}
  140. var
  141.   MSSL_StartCaption: string;
  142.                      
  143. {==============================================================================|  
  144.   function MSSL_ShortBuiltString: string;
  145.   Contributors: Janilabo
  146.   Description: Returns MSSL Built/Version string, short edition.
  147.   Example: 1.1b (MSSL_LIBRARY_MAIN_VERSION, MSSL_LIBRARY_MINOR_VERSION, MSSL_LIBRARY_STATE)
  148.   Created: September 30th, 2012.                  
  149. [==============================================================================}
  150. function MSSL_ShortBuiltString: string;
  151. begin
  152.   Result := (IntToStr(MSSL_LIBRARY_MAIN_VERSION) + '.' + IntToStr(MSSL_LIBRARY_MINOR_VERSION));
  153.   case Lowercase(MSSL_LIBRARY_STATE) of
  154.     'alpha': Result := (Result + 'a');
  155.     'beta': Result := (Result + 'b');
  156.   end;
  157. end;
  158.  
  159. {==============================================================================|  
  160.   function MSSL_LongBuiltString: string;
  161.   Contributors: Janilabo
  162.   Description: Returns MSSL Built/Version string, long edition.
  163.   Example: v1.1 Beta (MSSL_LIBRARY_MAIN_VERSION, MSSL_LIBRARY_MINOR_VERSION, MSSL_LIBRARY_STATE)
  164.   Created: September 30th, 2012.                  
  165. [==============================================================================}
  166. function MSSL_LongBuiltString: string;
  167. begin
  168.   Result := ('v' + IntToStr(MSSL_LIBRARY_MAIN_VERSION) + '.' + IntToStr(MSSL_LIBRARY_MINOR_VERSION));
  169.   if (MSSL_LIBRARY_STATE <> '') then
  170.     Result := (Result + ' ' + MSSL_LIBRARY_STATE);
  171. end;
  172.  
  173. {==============================================================================|  
  174.   procedure MSSL_Setup;
  175.   Contributors: Janilabo
  176.   Description: Command for setting up MSSL.
  177.   Created: September 30th, 2012.                  
  178. [==============================================================================}
  179. procedure MSSL_Setup;
  180. var
  181.   t: Integer;
  182. begin
  183.   t := GetSystemTime;
  184.   ClearDebug;
  185.   MSSL_StartCaption := GetSelf.Caption;
  186.   Disguise(MSSL_StartCaption + ' (Script powered by Massive SCAR Scripting Library ' + MSSL_ShortBuiltString + ')');
  187.   MSSL_SmallLetters := 'abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýšœžþÿ';
  188.   MSSL_CapitalLetters := 'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝŠŒŽÞŸ';
  189.   {$IFDEF RSC}
  190.     RSC_Setup;
  191.   {$ENDIF}
  192.   {$IFDEF RSCE}        
  193.     RSCE_Setup;  
  194.   {$ENDIF}  
  195.   {$IFDEF SW}
  196.     SW_Setup;  
  197.   {$ENDIF}      
  198.   WriteLn('*** [' + MSSL_TheTime + '] Massive SCAR Scripting Library ' + MSSL_LongBuiltString + ' STARTED - process took ' + IntToStr(GetSystemTime - t) + ' msec! ***');
  199. end;
  200.  
  201. {==============================================================================|  
  202.   procedure MSSL_Unsetup;
  203.   Contributors: Janilabo
  204.   Description: Command for freeing everything that is loaded into memory by MSSL.
  205.   Created: September 30th, 2012.                  
  206. [==============================================================================}
  207. procedure MSSL_Unsetup;
  208. var
  209.   t: Integer;
  210. begin
  211.   t := GetSystemTime;    
  212.   {$IFDEF RSC}
  213.     RSC_Unsetup;
  214.   {$ENDIF}
  215.   {$IFDEF RSCE}
  216.     RSCE_Unsetup;  
  217.   {$ENDIF}
  218.   {$IFDEF SW}
  219.     SW_Unsetup;
  220.   {$ENDIF}              
  221.   MSSL_FreeMMObjects(MSSL_MM);
  222.   Disguise(MSSL_StartCaption);
  223.   MSSL_SmallLetters := '';
  224.   MSSL_CapitalLetters := '';
  225.   WriteLn('*** [' + MSSL_TheTime + '] Massive SCAR Scripting Library ' + MSSL_LongBuiltString + ' STOPPED - process took ' + IntToStr(GetSystemTime - t) + ' msec! ***');
  226. end;
  227.  
  228. {==============================================================================|  
  229.   procedure MSSL_Terminate(reason: string);
  230.   Contributors: Janilabo
  231.   Description: Terminates the script and prints the reason to debug box.
  232.   Created: September 30th, 2012.                  
  233. [==============================================================================}
  234. procedure MSSL_Terminate(reason: string);
  235. begin
  236.   WriteLn('MSSL Terminate: ' + reason);
  237.   TerminateScript;
  238. end;
  239.  
  240. {$IFDEF MSSL_Compile}
  241.   begin
  242.     ClearDebug;
  243.     MSSL_Setup;
  244.     if MSSL_Unsetup then
  245.       WriteLn(#13#10 + 'No problems occurred - MSSL works!')
  246.     else
  247.       WriteLn(#13#10 + 'ERROR: Could not compile MSSL!');
  248.   end.
  249. {$ENDIF}
Advertisement
Add Comment
Please, Sign In to add comment