Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.55 KB | None | 0 0
  1. program NewScript;
  2. {$DEFINE SMART}
  3. {$i SRL\SRL.scar}
  4. {$i Reflection\Reflection.Simba}
  5.  
  6.  
  7. const
  8. //Just hit play - smart options are here. (Fill smart options in first)
  9. S_World = 33;
  10. S_Signed = True;
  11. S_Member = True;
  12.  
  13.  
  14. var
  15. ScriptForm: TForm;
  16. Label1: TLABEL;
  17. CheckBox1: TCHECKBOX;
  18. CheckBox2: TCHECKBOX;
  19. Label2: TLABEL;
  20. DropDown2: TCOMBOBOX;
  21. Label3: TLABEL;
  22. Radios: TRADIOGROUP;
  23. Label4: TLABEL;
  24. Editable1: TEDIT;
  25. Label5: TLABEL;
  26. Editable2: TEDIT;
  27. Button1: TBUTTON;
  28. Button2: TBUTTON;
  29. Button3: TBUTTON;
  30.  
  31.  
  32. function FormCanProceed: Boolean;
  33. begin
  34. if (Editable1.TEXT = '') or (Editable2.TEXT = '') then
  35. begin
  36. Result := False;
  37. writeln('Form cannot proceed because you did not fill in username/password');
  38. Exit;
  39. end;
  40. if (CheckBox1.STATE = cbUnchecked) and (CheckBox2.STATE = cbUnchecked) then
  41. begin
  42. Result := False;
  43. writeln('Form cannot proceed because you did not choose whether to cut or string or do both');
  44. Exit;
  45. end;
  46. if (DropDown2.ITEMINDEX = -1) then
  47. begin
  48. Result := False;
  49. writeln('Form cannot proceed because you did not choose what type of log to fletch');
  50. Exit;
  51. end;
  52. if (Radios.ITEMINDEX = -1) then
  53. begin
  54. Result := False;
  55. writeln('Form cannot proceed because you did not choose short or longbows');
  56. Exit;
  57. end;
  58. Result := True;
  59. end;
  60.  
  61.  
  62. procedure SavePlayerInfo(Sender: TObject);
  63. begin
  64. if not(FormCanProceed) then
  65. Exit;
  66. WriteINI('user', 'name', Base64Encode(Editable1.TEXT), ScriptPath + 'PlayerInfo.ini');
  67. WriteINI('user', 'pass', Base64Encode(Editable2.TEXT), ScriptPath + 'PlayerInfo.ini');
  68. end;
  69.  
  70.  
  71. procedure LoadPlayerInfo(Sender: TObject);
  72. begin
  73. Editable1.TEXT := Base64Decode(ReadINI('user', 'name', ScriptPath + 'PlayerInfo.ini'));
  74. Editable2.TEXT := Base64Decode(ReadINI('user', 'pass', ScriptPath + 'PlayerInfo.ini'));
  75. end;
  76.  
  77.  
  78. const
  79. LongBows = 0;
  80. Cut = 1;
  81. Strng = 2;
  82. LogType = 0;
  83. LOG_REG = 0;
  84. LOG_OAK = 1;
  85. LOG_WILLOW = 2;
  86. LOG_MAPLE = 3;
  87. LOG_YEW = 4;
  88. LOG_MAGIC = 5;
  89.  
  90.  
  91. procedure EndForm(Sender: TObject);
  92. begin
  93. if not(FormCanProceed) then
  94. Exit;
  95. HowManyPlayers := 1;
  96. NumberOfPlayers(1);
  97. Players[0].Name := Editable1.TEXT;
  98. Players[0].Pass := Editable2.TEXT;
  99. Players[0].Active := True;
  100. case Radios.ITEMINDEX of
  101. 0: Players[0].Booleans[LongBows] := False;
  102. 1: Players[0].Booleans[LongBows] := True;
  103. end;
  104. Players[0].Integers[LogType] := DropDown2.ITEMINDEX;
  105. ScriptForm.CLOSE;
  106. end;
  107.  
  108.  
  109. procedure InitForm;
  110. begin
  111. //Primary Form
  112. ScriptForm := CreateForm;
  113. ScriptForm.Height := 200;
  114. ScriptForm.Width := 300;
  115. ScriptForm.CAPTION := 'Fletcher';
  116.  
  117. //Label1: "Choose what to do:" (string/fletch)
  118. Label1 := TLABEL.Create(ScriptForm);
  119. Label1.Parent := ScriptForm;
  120. Label1.Top := 5;
  121. Label1.Left := 10;
  122. Label1.CAPTION := 'Choose what to do:';
  123.  
  124. //CheckBox1: [ ] String
  125. CheckBox1 := TCHECKBOX.Create(ScriptForm);
  126. CheckBox1.Parent := ScriptForm;
  127. CheckBox1.Top := 26;
  128. CheckBox1.Left := 10;
  129. CheckBox1.CAPTION := 'Cut';
  130.  
  131. //CheckBox2: [ ] Fletch
  132. CheckBox2 := TCHECKBOX.Create(ScriptForm);
  133. CheckBox2.Parent := SCriptForm;
  134. CheckBox2.Top := 26;
  135. CheckBox2.Left := 55;
  136. CheckBox2.CAPTION := 'String';
  137.  
  138. //Label2: "Choose what type of log:" (regular/oak/etc.)
  139. Label2 := TLABEL.Create(ScriptForm);
  140. Label2.Parent := ScriptForm;
  141. Label2.Top := 55;
  142. Label2.Left := 10;
  143. Label2.CAPTION := 'Choose what type of log:';
  144.  
  145. //DropDown2: Log types
  146. DropDown2 := TCOMBOBOX.Create(ScriptForm);
  147. DropDown2.Parent := ScriptForm;
  148. DropDown2.ITEMS.Add('Normal');
  149. DropDown2.ITEMS.Add('Oak');
  150. DropDown2.ITEMS.Add('Willow');
  151. DropDown2.ITEMS.Add('Maple');
  152. DropDown2.ITEMS.Add('Yew');
  153. DropDown2.ITEMS.Add('Magic');
  154. DropDown2.Top := 76;
  155. DropDown2.Left := 10;
  156.  
  157. //Label3: "Shortbows or Longbows?" (Shortbow/Longbow)
  158. Label3 := TLABEL.Create(ScriptForm);
  159. Label3.Parent := ScriptForm;
  160. Label3.CAPTION := 'Shortbows or Longbows?';
  161. Label3.Top := 110;
  162. Label3.Left := 10;
  163.  
  164. //Radios: Shortbow/Longbow
  165. Radios := TRADIOGROUP.Create(ScriptForm);
  166. Radios.Parent := ScriptForm;
  167. Radios.ITEMS.Add('Short');
  168. Radios.ITEMS.Add('Long');
  169. Radios.Top := 126;
  170. Radios.Left := 10;
  171. Radios.Width := 80;
  172. Radios.Height := 65;
  173.  
  174. //Label4: "Username:" (Player username)
  175. Label4 := TLABEL.Create(ScriptForm);
  176. Label4.Parent := ScriptForm;
  177. Label4.Top := 5;
  178. Label4.Left := 160;
  179. Label4.CAPTION := 'Username:';
  180.  
  181. //Editable1: Username
  182. Editable1 := TEDIT.Create(ScriptForm);
  183. Editable1.Parent := ScriptForm;
  184. Editable1.Top := 21;
  185. Editable1.Left := 160;
  186. Editable1.Width := Editable1.Width + 10; //Increasing default width by 10 pixels
  187.  
  188. //Label5: "Password:" (Player password)
  189. Label5 := TLABEL.Create(ScriptForm);
  190. Label5.Parent := ScriptForm;
  191. Label5.Top := 48;
  192. Label5.Left := 160;
  193. Label5.CAPTION := 'Password:';
  194.  
  195. //Editable2: Password
  196. Editable2 := TEDIT.Create(ScriptForm);
  197. Editable2.Parent := ScriptForm;
  198. Editable2.Top := 64;
  199. Editable2.Left := 160;
  200. Editable2.Width := Editable2.Width + 10; //Increasing default width by 10 pixels
  201. Editable2.PASSWORDCHAR := '*';
  202.  
  203. //Button1: Save player information
  204. Button1 := TBUTTON.Create(ScriptForm);
  205. Button1.Parent := ScriptForm;
  206. Button1.Top := 98;
  207. Button1.Left := 160;
  208. Button1.CAPTION := 'Save Player Info';
  209. Button1.ONCLICK := @SavePlayerInfo;
  210. Button1.Width := 95;
  211.  
  212. //Button2: Load player information
  213. Button2 := TBUTTON.Create(ScriptForm);
  214. Button2.Parent := ScriptForm;
  215. Button2.Top := 132;
  216. Button2.Left := 160;
  217. Button2.CAPTION := 'Load Player Info';
  218. Button2.ONCLICK := @LoadPlayerInfo;
  219. Button2.Width := 95;
  220.  
  221. //Button3: Start script
  222. Button3 := TButton.Create(ScriptForm);
  223. Button3.Parent := ScriptForm;
  224. Button3.Top := 165;
  225. Button3.Left := 160;
  226. Button3.Caption := 'Start Script!';
  227. Button3.ONCLICK := @EndForm;
  228. Button3.Width := 95;
  229. end;
  230.  
  231.  
  232. procedure ShowFormModel;
  233. begin
  234. ScriptForm.SHOWMODAL;
  235. end;
  236.  
  237.  
  238. procedure ShowForm;
  239. var
  240. v: TVariantArray;
  241. begin
  242. ThreadSafeCall('InitForm', v);
  243. SetLength(v, 0);
  244. ThreadSafeCall('ShowFormModel', v);
  245. end;
  246.  
  247.  
  248. begin
  249. ShowForm;
  250. Smart_Server := S_World;
  251. Smart_Signed := S_Signed;
  252. Smart_Members := S_Member;
  253. Smart_SuperDetail := False;
  254. SetupSRL;
  255. HowManyPlayers := 1;
  256. NumberOfPlayers(HowManyPlayers);
  257. R_UpdateHooks;
  258. if not(LoggedIn) then
  259. begin
  260. LogInPlayer;
  261. Wait(3000 + Random(2000));
  262. SetAngle(True);
  263. MakeCompass('n');
  264. end else
  265. PlayerStartTime := GetSystemTime;
  266. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement