@@ -26,6 +26,15 @@ Could be expanded in the future to include the sound sliders but for now only ha
2626*)
2727 ERSOptionsSlider = enum(BRIGHTNESS, ZOOM);
2828
29+ (*
30+ ## ERSOptionsDropDown
31+ ```pascal
32+ ERSOptionsDropDown = enum(PLAYER_ATTACK, NPC_ATTACK, CLIENT_MODE);
33+ ```
34+ Enum representing each of the options gametab dropdowns.
35+ *)
36+ ERSOptionsDropDown = enum(PLAYER_ATTACK, NPC_ATTACK, CLIENT_MODE);
37+
2938(*
3039## ERSOptionsButton
3140```pascal
@@ -36,13 +45,13 @@ Enum representing each of the options gametab buttons.
3645 ERSOptionsButton = enum(AID, RUN, HOUSE, BOND, ALL_SETTINGS);
3746
3847(*
39- (TRSOptions)=
40- ## type TRSOptions
41- Main record responsible with interacting with the options gametab.
48+ ## TRSOptions
49+ Main record responsible with interacting with the {ref}`Options` gametab.
4250*)
4351 TRSOptions = record
4452 Tabs: TBoxArray;
4553 Sliders: array [ERSOptionsSlider] of TRSSlider;
54+ DropDowns: array [ERSOptionsDropDown] of TRSDropDown;
4655 Buttons: array [ERSOptionsButton] of TRSButton;
4756 ZoomLevel: Integer;
4857 end;
@@ -52,7 +61,9 @@ Main record responsible with interacting with the options gametab.
5261```pascal
5362procedure TRSOptions.SetupInterface();
5463```
55- Internal method used to setup the gametab coordinates.
64+ Internal method used to setup the {ref}`TRSOptions` coordinates.
65+
66+ This is automatically called for you on the {ref}`Options variable`.
5667*)
5768procedure TRSOptions.SetupInterface();
5869var
8798 Self.Buttons[i].Bounds := boxes[i];
8899
89100 with GameTab.Bounds do
101+ begin
90102 Self.Buttons[4].Bounds := TBox.Create(X1 + 22, Y2 - 32, X2 - 22, Y2 - 3);
91103
104+ Self.DropDowns[0].Bounds := [X1 + 11, Y1 + 111, X2 - 11, Y1 + 130];
105+ Self.DropDowns[0].Setup(['Depends on combat levels', 'Always right-click', 'Left-click where available', 'Hidden', 'Right-click for clanmates']);
92106
107+ Self.DropDowns[1].Bounds := [X1 + 11, Y1 + 150, X2 - 11, Y1 + 169];
108+ Self.DropDowns[1].Setup(['Depends on combat levels', 'Always right-click', 'Left-click where available', 'Hidden']);
109+
110+ Self.DropDowns[2].Bounds := [X1 + 11, Y2 - 109, X2 - 11, Y2 - 90];
111+ Self.DropDowns[2].Setup(['Fixed - Classic layout', 'Resizable - Classic layout', 'Resizable - Modern layout']);
112+ end;
93113end;
94114
95115
@@ -169,7 +189,7 @@ begin
169189 if Self.GetTab() = tab then Exit(True);
170190
171191 Mouse.Click(Self.Tabs[tab], EMouseButton.LEFT);
172- Result := SleepUntil(Self.GetTab() = tab, RandomMode(100, 50, 1500), 600 );
192+ Result := SleepUntil(Self.GetTab() = tab, RandomMode(100, 50, 1500), 2000 );
173193end;
174194
175195
@@ -220,6 +240,7 @@ Options.SetZoomLevel(30);
220240*)
221241function TRSOptions.SetZoomLevel(level: Integer): Boolean;
222242begin
243+ if not Self.OpenTab(ERSOptionsTab.DISPLAY) then Exit;
223244 Result := Self.Sliders[ERSOptionsSlider.ZOOM].SetLevel(level);
224245
225246 if Result then
@@ -228,11 +249,87 @@ begin
228249 Self.ZoomLevel := -1;
229250end;
230251
252+
253+ (*
254+ ## Options.SetPlayerAttack
255+ ```pascal
256+ function TRSOptions.SetPlayerAttack(index: Integer): Boolean;
257+ function TRSOptions.SetPlayerAttack(option: String): Boolean; overload;
258+ ```
259+ Attempts to set the specified attack option for players.
260+
261+ Example:
262+ ```pascal
263+ WriteLn Options.SetPlayerAttack('Depends on combat levels');
264+ WriteLn Options.SetPlayerAttack(2);
265+ ```
266+ *)
267+ function TRSOptions.SetPlayerAttack(index: Integer): Boolean;
268+ begin
269+ if not Self.OpenTab(ERSOptionsTab.CONTROLS) then Exit;
270+ Result := Self.DropDowns[ERSOptionsDropDown.PLAYER_ATTACK].Select(index);
271+ end;
272+
273+ function TRSOptions.SetPlayerAttack(option: String): Boolean; overload;
274+ begin
275+ if not Self.OpenTab(ERSOptionsTab.CONTROLS) then Exit;
276+ Result := Self.DropDowns[ERSOptionsDropDown.PLAYER_ATTACK].Select(option);
277+ end;
278+
279+
280+ (*
281+ ## Options.SetNPCAttack
282+ ```pascal
283+ function TRSOptions.SetNPCAttack(index: Integer): Boolean;
284+ function TRSOptions.SetNPCAttack(option: String): Boolean; overload;
285+ ```
286+ Attempts to set the specified attack option for NPCs.
287+
288+ Example:
289+ ```pascal
290+ WriteLn Options.SetNPCAttack('Depends on combat levels');
291+ WriteLn Options.SetNPCAttack(2);
292+ ```
293+ *)
294+ function TRSOptions.SetNPCAttack(index: Integer): Boolean;
295+ begin
296+ if not Self.OpenTab(ERSOptionsTab.CONTROLS) then Exit;
297+ Result := Self.DropDowns[ERSOptionsDropDown.NPC_ATTACK].Select(index);
298+ end;
299+
300+ function TRSOptions.SetNPCAttack(option: String): Boolean; overload;
301+ begin
302+ if not Self.OpenTab(ERSOptionsTab.CONTROLS) then Exit;
303+ Result := Self.DropDowns[ERSOptionsDropDown.NPC_ATTACK].Select(option);
304+ end;
305+
306+
307+ (*
308+ ## Options.SetClientMode
309+ ```pascal
310+ function TRSOptions.SetClientMode(mode: ERSMode): Boolean;
311+ ```
312+ Attempts to set the specified `mode` client mode.
313+
314+ Example:
315+ ```pascal
316+ WriteLn Options.SetClientMode('Fixed');
317+ ```
318+ *)
319+ function TRSOptions.SetClientMode(mode: ERSMode): Boolean;
320+ begin
321+ if not Self.OpenTab(ERSOptionsTab.DISPLAY) then Exit;
322+
323+ Result := Self.DropDowns[ERSOptionsDropDown.CLIENT_MODE].Select(Ord(mode)-1);
324+ if Result and RSClient.WaitModeChange(4000) then
325+ RSClient.IsLoggedIn(); //force trigger SetupInterfaces
326+ end;
327+
328+
231329var
232330(*
233- (Options)=
234- ## var Options
235- Global TRSOptions variable.
331+ ## Options variable
332+ Global {ref}`TRSOptions` variable.
236333*)
237334 Options: TRSOptions;
238335
0 commit comments