Janilabo

MSSL.scar

Sep 19th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 10.76 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.   MSSL_LIBRARY_STATE = 'Beta';  
  102.  
  103. //{$DEFINE MSSL_Compile}
  104.  
  105. {$IFDEF MSSL_Compile}
  106.   {$DEFINE RSCE}
  107.   {$DEFINE RSC}
  108.   {$DEFINE SW}
  109. {$ENDIF}
  110.  
  111. {==============================================================================|  
  112.                     MSSL Gaming Include - RuneScape Classic                    
  113. |==============================================================================}
  114. {$IFDEF RSC}
  115.   {$I Library\Gaming\RuneScape_Classic\RuneScape_Classic.scar}
  116. {$ENDIF}
  117.  
  118. {==============================================================================|  
  119.                        MSSL Gaming Include - RSCEmulation                      
  120. [==============================================================================}
  121. {$IFDEF RSCE}
  122.   {$I Library\Gaming\RSCEmulation\RSCEmulation.scar}
  123. {$ENDIF}
  124.  
  125. {==============================================================================|  
  126.                       MSSL Gaming Include - Shadow Worlds                      
  127. [==============================================================================}
  128. {$IFDEF SW}
  129.   {$I Library\Gaming\Shadow_Worlds\Shadow_Worlds.scar}
  130. {$ENDIF}
  131.  
  132. {==============================================================================|  
  133.   var MSSL_StartCaption: string;
  134.   Contributors: Janilabo
  135.   Description: Holds SCAR's original title (before MSSL takes over).
  136.                Original title will be restored with unsetupment of MSSL.
  137.   Created: September 30th, 2012.                  
  138. [==============================================================================}
  139. var
  140.   MSSL_StartCaption: string;
  141.                      
  142. {==============================================================================|  
  143.   function MSSL_ShortBuiltString: string;
  144.   Contributors: Janilabo
  145.   Description: Returns MSSL Built/Version string, short edition.
  146.   Example: 1.1b (MSSL_LIBRARY_MAIN_VERSION, MSSL_LIBRARY_MINOR_VERSION, MSSL_LIBRARY_STATE)
  147.   Created: September 30th, 2012.                  
  148. [==============================================================================}
  149. function MSSL_ShortBuiltString: string;
  150. begin
  151.   Result := (IntToStr(MSSL_LIBRARY_MAIN_VERSION) + '.' + IntToStr(MSSL_LIBRARY_MINOR_VERSION));
  152.   case Lowercase(MSSL_LIBRARY_STATE) of
  153.     'alpha': Result := (Result + 'a');
  154.     'beta': Result := (Result + 'b');
  155.   end;
  156. end;
  157.  
  158. {==============================================================================|  
  159.   function MSSL_LongBuiltString: string;
  160.   Contributors: Janilabo
  161.   Description: Returns MSSL Built/Version string, long edition.
  162.   Example: v1.1 Beta (MSSL_LIBRARY_MAIN_VERSION, MSSL_LIBRARY_MINOR_VERSION, MSSL_LIBRARY_STATE)
  163.   Created: September 30th, 2012.                  
  164. [==============================================================================}
  165. function MSSL_LongBuiltString: string;
  166. begin
  167.   Result := ('v' + IntToStr(MSSL_LIBRARY_MAIN_VERSION) + '.' + IntToStr(MSSL_LIBRARY_MINOR_VERSION));
  168.   if (MSSL_LIBRARY_STATE <> '') then
  169.     Result := (Result + ' ' + MSSL_LIBRARY_STATE);
  170. end;
  171.  
  172. {==============================================================================|  
  173.   procedure MSSL_Setup;
  174.   Contributors: Janilabo
  175.   Description: Command for setting up MSSL.
  176.   Created: September 30th, 2012.                  
  177. [==============================================================================}
  178. procedure MSSL_Setup;
  179. var
  180.   t: Integer;
  181. begin
  182.   t := GetSystemTime;
  183.   ClearDebug;
  184.   MSSL_StartCaption := GetSelf.Caption;
  185.   Disguise(MSSL_StartCaption + ' (Script powered by Massive SCAR Scripting Library ' + MSSL_ShortBuiltString + ')');
  186.   MSSL_SmallLetters := 'abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýšœžþÿ';
  187.   MSSL_CapitalLetters := 'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝŠŒŽÞŸ';
  188.   {$IFDEF RSC}
  189.     RSC_Setup;
  190.   {$ENDIF}
  191.   {$IFDEF RSCE}        
  192.     RSCE_Setup;  
  193.   {$ENDIF}  
  194.   {$IFDEF SW}
  195.     SW_Setup;  
  196.   {$ENDIF}      
  197.   WriteLn('*** [' + MSSL_TheTime + '] Massive SCAR Scripting Library ' + MSSL_LongBuiltString + ' STARTED - process took ' + IntToStr(GetSystemTime - t) + ' msec! ***');
  198. end;
  199.  
  200. {==============================================================================|  
  201.   procedure MSSL_Unsetup;
  202.   Contributors: Janilabo
  203.   Description: Command for freeing everything that is loaded into memory by MSSL.
  204.   Created: September 30th, 2012.                  
  205. [==============================================================================}
  206. procedure MSSL_Unsetup;
  207. var
  208.   t: Integer;
  209. begin
  210.   t := GetSystemTime;    
  211.   {$IFDEF RSC}
  212.     RSC_Unsetup;
  213.   {$ENDIF}
  214.   {$IFDEF RSCE}
  215.     RSCE_Unsetup;  
  216.   {$ENDIF}
  217.   {$IFDEF SW}
  218.     SW_Unsetup;
  219.   {$ENDIF}              
  220.   MSSL_FreeMMObjects(MSSL_MM);
  221.   Disguise(MSSL_StartCaption);
  222.   MSSL_SmallLetters := '';
  223.   MSSL_CapitalLetters := '';
  224.   WriteLn('*** [' + MSSL_TheTime + '] Massive SCAR Scripting Library ' + MSSL_LongBuiltString + ' STOPPED - process took ' + IntToStr(GetSystemTime - t) + ' msec! ***');
  225. end;
  226.  
  227. {==============================================================================|  
  228.   procedure MSSL_Terminate(reason: string);
  229.   Contributors: Janilabo
  230.   Description: Terminates the script and prints the reason to debug box.
  231.   Created: September 30th, 2012.                  
  232. [==============================================================================}
  233. procedure MSSL_Terminate(reason: string);
  234. begin
  235.   WriteLn('MSSL Terminate: ' + reason);
  236.   TerminateScript;
  237. end;
  238.  
  239. {$IFDEF MSSL_Compile}
  240.   begin
  241.     ClearDebug;
  242.     MSSL_Setup;
  243.     if MSSL_Unsetup then
  244.       WriteLn(#13#10 + 'No problems occurred - MSSL works!')
  245.     else
  246.       WriteLn(#13#10 + 'ERROR: Could not compile MSSL!');
  247.   end.
  248. {$ENDIF}
Advertisement
Add Comment
Please, Sign In to add comment