Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-]
- [ ________ _________.___ __________ ]
- [ \_____ \ / _____/| | \______ \ ]
- [ / | \ \_____ \ | | | _/ ]
- [ / | \/ \| | | | \ ]
- [ \_______ /_______ /|___| /\____|_ / ]
- [ \/ \/ \/ \/ revision 1 ]
- [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-]
- [ O.S.I. Official SCAR Include - Runecrafter ]
- [ ]
- [ Author : Wanted ]
- [ Description : Automates runecrafting and banking tasks in RS2. ]
- [ Website : http://scar-divi.com/ ]
- [ Directions : See website for usage instructions. ]
- [ ]
- [ More scripts can be found at scar-divi.com ]
- [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}
- {$DEFINE RS2}
- {$DEFINE OSI_Color_Anti_Randoms}
- {$DEFINE SMART} // Comment out to disable SMART
- {$I OSI\OSI.scar}
- {$I OSI\RS2\Skill\Runecrafting.scar}
- {$I OSI\RS2\Skill\Mining.scar}
- {$I OSI\RS2\Skill\Woodcutting.scar}
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- INDEXES
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- const
- Script_Revision = 1;
- Player_Loads_To_Do = 0;
- Player_Max_Ess = 1;
- Player_World = 2;
- Player_Initial_XP = 3;
- Player_Initial_Lvl = 4;
- Player_Charges = 5;
- Player_Pouches_Count = 6;
- Player_Essence_Count = 7;
- Player_Task = 0;
- Player_Random_World = 0;
- Player_Small_Pouch = 1;
- Player_Medium_Pouch = 2;
- Player_Large_Pouch = 3;
- Player_Giant_Pouch = 4;
- Player_Medium_Decayed = 5;
- Player_Large_Decayed = 6;
- Player_Giant_Decayed = 7;
- Player_Pure_Essence = 8;
- Player_Inv_Exclude = 0;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- GLOBAL VARIABLES
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Numbers
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- var
- TimeStarted: Integer;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Text
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- var
- Abyss_Tool, SystemUsername, SystemPassword: string;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Booleans
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- var
- CurrentlyMemberWorld: Boolean;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Form
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- var
- GroupBoxes: array[0..0] of TGroupBox;
- ComboBoxes: array[0..1] of TComboBox;
- CheckBoxes: array[0..2] of TCheckBox;
- Buttons: array[0..9] of TButton;
- NxEdits: array[0..7] of TNxEdit;
- Labels: array[0..25] of TLabel;
- BackgroundPicture: Integer;
- StartScript: Boolean;
- Form: TForm;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- GUI
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure SetPlayerLengths(PlayerNo: Integer);
- Contributors: Wanted
- Description: Sets all player variable lengths.
- Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 10th, 2012. By Wanted. RS2 Build 696.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure SetPlayerLengths(PlayerNo: Integer);
- begin
- SetLength(Players[PlayerNo].Booleans, 9);
- SetLength(Players[PlayerNo].Strings, 1);
- SetLength(Players[PlayerNo].Integers, 8);
- SetLength(Players[CurrentPlayer].TIA, 1);
- Players[PlayerNo].Booleans[0] := True;
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function SettingsFile: string;
- Contributors: Wanted
- Description: Returns the path of settings file.
- Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 9th, 2012. By Wanted. RS2 Build 695.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function SettingsFile: string;
- begin
- Result := ScriptPath + 'Form\Settings';
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure LoadBackground(Sender: TObject);
- Contributors: Wanted
- Description: Loads the background image in the GUI.
- Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 9th, 2012. By Wanted. RS2 Build 695.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure LoadBackground(Sender: TObject);
- begin
- SafeCopyCanvas(GetBitmapCanvas(BackgroundPicture), Form.Canvas, 0, 0, 500, 281, 0, 0, 500, 281);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure OnKeyPress(Sender: TObject; var Key: Char);
- Contributors: SKy Scripter
- Description: Keeps stupid people from typing in the combobox.
- Date Created: ??? By SKy Scripter
- Last Modification: ???. By SKy Scripter.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure OnKeyPress(Sender: TObject; var Key: Char);
- begin
- Key := Chr(VK_CANCEL);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function IdiotStrToIntDef(S: string; Def: LongInt): LongInt;
- Contributors: Wanted
- Description: Prevents idiots from causing havoc, trust me I've seen it happen.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function IdiotStrToIntDef(S: string; Def: LongInt): LongInt;
- var
- S2: string;
- begin
- S2 := GetNumbers(S);
- if (Length(S2) > 9) then
- Result := 2147483647
- else
- Result := StrToIntDef(S2, Def);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure UpdateSettingsFromForm;
- Contributors: Wanted
- Description: Updates global variable and player settings with current form information.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure UpdateSettingsFromForm;
- begin
- SystemUsername := NxEdits[0].Text;
- SystemPassword := NxEdits[1].Text;
- Players[CurrentPlayer].Name := NxEdits[2].Text;
- Players[CurrentPlayer].Pass := NxEdits[5].Text;
- Players[CurrentPlayer].Pin := NxEdits[4].Text;
- Players[CurrentPlayer].LampSkill := ComboBoxes[1].Text;
- Players[CurrentPlayer].Strings[0] := ComboBoxes[0].Text;
- Players[CurrentPlayer].Integers[0] := IdiotStrToIntDef(NxEdits[3].Text, 25);
- Players[CurrentPlayer].Integers[1] := IdiotStrToIntDef(NxEdits[6].Text, 2000);
- Players[CurrentPlayer].Integers[2] := IdiotStrToIntDef(NxEdits[7].Text, 26);
- Players[CurrentPlayer].Active := CheckBoxes[0].Checked;
- Players[CurrentPlayer].Booleans[0] := CheckBoxes[1].Checked;
- Players[CurrentPlayer].Member := CheckBoxes[2].Checked;
- end;
- procedure SomethingClicked(Sender: TObject); forward;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure UpdateFormFromSettings;
- Contributors: Wanted
- Description: Updates the form with current global variable and player settings.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: April 27th, 2012. By Wanted. RS2 Build 713.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure UpdateFormFromSettings;
- begin
- NxEdits[0].Text := SystemUsername;
- if (NxEdits[0].Text = '') then
- NxEdits[0].Text := 'System Username';
- NxEdits[1].Text := SystemPassword;
- if (NxEdits[1].Text = '') then
- NxEdits[1].Text := '***************';
- NxEdits[2].Text := Players[CurrentPlayer].Name;
- if (NxEdits[2].Text = '') then
- NxEdits[2].Text := 'New Username';
- NxEdits[5].Text := Players[CurrentPlayer].Pass;
- if (NxEdits[5].Text = '') then
- NxEdits[5].Text := 'New Password';
- NxEdits[4].Text := Players[CurrentPlayer].Pin;
- if (NxEdits[4].Text = '') then
- NxEdits[4].Text := '0000';
- ComboBoxes[1].Text := Players[CurrentPlayer].LampSkill;
- if (ComboBoxes[1].Text = '') then
- ComboBoxes[1].Text := 'Agility';
- ComboBoxes[0].Text := Players[CurrentPlayer].Strings[0];
- if (ComboBoxes[0].Text = '') then
- ComboBoxes[0].Text := 'Air (Abyss)';
- NxEdits[3].Text := IntToStr(Players[CurrentPlayer].Integers[0]);
- if (NxEdits[3].Text = '0') then
- NxEdits[3].Text := '25';
- NxEdits[6].Text := IntToStr(Players[CurrentPlayer].Integers[1]);
- if (NxEdits[6].Text = '0') then
- NxEdits[6].Text := '2000';
- NxEdits[7].Text := IntToStr(Players[CurrentPlayer].Integers[2]);
- if (NxEdits[7].Text = '0') then
- NxEdits[7].Text := '26';
- CheckBoxes[0].Checked := Players[CurrentPlayer].Active;
- CheckBoxes[1].Checked := Players[CurrentPlayer].Booleans[0];
- CheckBoxes[2].Checked := Players[CurrentPlayer].Member;
- Labels[12].Caption := 'Players[' + IntToStr(CurrentPlayer) + ']';
- Labels[25].Caption := 'Players[' + IntToStr(CurrentPlayer) + ']';
- SomethingClicked(CheckBoxes[1]);
- SomethingClicked(ComboBoxes[0]);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure SomethingClicked(Sender: TObject);
- Contributors: Wanted
- Description: Actions performed when certain form components are clicked.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: April 27th, 2012. By Wanted. RS2 Build 713.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure SomethingClicked(Sender: TObject);
- var
- TempP: TRS2Player;
- V: TVariantArray;
- I: Integer;
- begin
- case Sender of
- Buttons[0]: begin
- for I := 1 to 12 do
- begin
- Labels[I].Hide;
- Labels[I + 13].Hide;
- end;
- for I := 2 to 7 do
- NxEdits[I].Hide;
- for I := 0 to 1 do
- ComboBoxes[I].Hide;
- for I := 6 to 9 do
- Buttons[I].Hide;
- for I := 0 to 2 do
- CheckBoxes[I].Hide;
- GroupBoxes[0].Show;
- Labels[0].Show;
- Labels[13].Show;
- Buttons[5].Show;
- for I := 0 to 1 do
- NxEdits[I].Show;
- Buttons[0].Enabled := False;
- for I := 1 to 4 do
- Buttons[I].Enabled := True;
- end;
- Buttons[1]: begin
- GroupBoxes[0].Hide;
- Labels[0].Hide;
- Labels[13].Hide;
- Buttons[5].Hide;
- for I := 0 to 1 do
- NxEdits[I].Hide;
- for I := 2 to 7 do
- NxEdits[I].Show;
- for I := 0 to 1 do
- ComboBoxes[I].Show;
- for I := 1 to 12 do
- begin
- Labels[I].Show;
- Labels[I + 13].Show;
- end;
- for I := 6 to 9 do
- Buttons[I].Show;
- for I := 0 to 2 do
- CheckBoxes[I].Show;
- Buttons[1].Enabled := False;
- for I := 0 to 4 do
- if (I <> 1) then
- Buttons[I].Enabled := True;
- end;
- Buttons[2]: begin
- for I := 0 to 7 do
- NxEdits[I].Hide;
- GroupBoxes[0].Hide;
- for I := 0 to 12 do
- begin
- Labels[I].Hide;
- Labels[I + 13].Hide;
- end;
- for I := 0 to 1 do
- ComboBoxes[I].Hide;
- for I := 5 to 9 do
- Buttons[I].Hide;
- for I := 0 to 2 do
- CheckBoxes[I].Hide;
- Buttons[2].Enabled := False;
- for I := 0 to 4 do
- if (I <> 2) then
- Buttons[I].Enabled := True;
- end;
- Buttons[3]: begin
- for I := 0 to 7 do
- NxEdits[I].Hide;
- GroupBoxes[0].Hide;
- for I := 0 to 12 do
- begin
- Labels[I].Hide;
- Labels[I + 13].Hide;
- end;
- for I := 0 to 1 do
- ComboBoxes[I].Hide;
- for I := 5 to 9 do
- Buttons[I].Hide;
- for I := 0 to 2 do
- CheckBoxes[I].Hide;
- Buttons[3].Enabled := False;
- for I := 0 to 4 do
- if (I <> 3) then
- Buttons[I].Enabled := True;
- end;
- Buttons[4]: begin
- for I := 0 to 7 do
- NxEdits[I].Hide;
- GroupBoxes[0].Hide;
- for I := 0 to 1 do
- ComboBoxes[I].Hide;
- for I := 0 to 12 do
- begin
- Labels[I].Hide;
- Labels[I + 13].Hide;
- end;
- for I := 5 to 9 do
- Buttons[I].Hide;
- for I := 0 to 2 do
- CheckBoxes[I].Hide;
- Buttons[4].Enabled := False;
- for I := 0 to 3 do
- Buttons[I].Enabled := True;
- end;
- Buttons[5]: begin
- SetArrayLength(V, 0);
- Form.ModalResult := MROK;
- StartScript := True;
- end;
- Buttons[6]: begin
- if (Length(Players) < 2) then
- Exit;
- UpdateSettingsFromForm;
- if (CurrentPlayer = 0) then
- CurrentPlayer := High(Players)
- else
- Dec(CurrentPlayer);
- UpdateFormFromSettings;
- end;
- Buttons[7]: begin
- UpdateSettingsFromForm;
- SetLength(Players, Length(Players) + 1);
- CurrentPlayer := High(Players);
- SetPlayerLengths(CurrentPlayer);
- UpdateFormFromSettings;
- end;
- Buttons[8]: begin
- if (Length(Players) < 2) then
- begin
- Players[0] := TempP;
- SetPlayerLengths(0);
- end
- else
- SetLength(Players, Length(Players) - 1);
- CurrentPlayer := High(Players);
- UpdateFormFromSettings;
- end;
- Buttons[9]: begin
- UpdateSettingsFromForm;
- if (CurrentPlayer = High(Players)) then
- CurrentPlayer := 0
- else
- Inc(CurrentPlayer);
- UpdateFormFromSettings;
- end;
- CheckBoxes[1]: NxEdits[7].Enabled := (not (CheckBoxes[1].Checked));
- ComboBoxes[0]: begin
- CheckBoxes[2].Checked := StrInStr('Abyss', ComboBoxes[0].Text);
- CheckBoxes[2].Enabled := (not (CheckBoxes[2].Checked));
- Labels[11].Enabled := CheckBoxes[2].Enabled;
- Labels[24].Enabled := Labels[11].Enabled;
- end;
- end;
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure LoadSettings;
- Contributors: Wanted
- Description: Loads all global variable and player settings from an .ini file.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure LoadSettings;
- var
- TIA: TIntegerArray;
- I, II, H: Integer;
- begin
- SystemUsername := ReadINI('Access', 'Username', SettingsFile);
- SystemPassword := ReadINI('Access', 'Password', SettingsFile);
- SetLength(Players, StrToIntDef(ReadINI('Players', 'Length', SettingsFile), 1));
- CurrentPlayer := StrToIntDef(ReadINI('Players', 'CurrentPlayer', SettingsFile), 0);
- H := High(Players);
- for I := 0 to H do
- begin
- SetPlayerLengths(I);
- Players[I].Name := ReadINI('Players' + IntToStr(I), 'Name', SettingsFile);
- Players[I].Pass := ReadINI('Players' + IntToStr(I), 'Pass', SettingsFile);
- Players[I].Pin := ReadINI('Players' + IntToStr(I), 'Pin', SettingsFile);
- Players[I].LampSkill := ReadINI('Players' + IntToStr(I), 'LampSkill', SettingsFile);
- Players[I].Active := StrToBoolDef(ReadINI('Players' + IntToStr(I), 'Active', SettingsFile), False);
- Players[I].Member := StrToBoolDef(ReadINI('Players' + IntToStr(I), 'Member', SettingsFile), False);
- Players[I].Booleans[0] := StrToBoolDef(ReadINI('Players' + IntToStr(I), 'Booleans0', SettingsFile), True);
- Players[I].Strings[0] := ReadINI('Players' + IntToStr(I), 'Strings0', SettingsFile);
- TIA := [25, 2000, 26];
- for II := 0 to 2 do
- Players[I].Integers[II] := IdiotStrToIntDef(ReadINI('Players' + IntToStr(I), 'Integers' + IntToStr(II), SettingsFile), TIA[II]);
- end;
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure SaveSettings;
- Contributors: Wanted
- Description: Saves all global variable and player settings into an .ini file.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure SaveSettings;
- var
- I, II, H: Integer;
- begin
- WriteINI('Access', 'Username', SystemUsername, SettingsFile);
- WriteINI('Access', 'Password', SystemPassword, SettingsFile);
- WriteINI('Players', 'Length', IntToStr(Length(Players)), SettingsFile);
- WriteINI('Players', 'CurrentPlayer', IntToStr(CurrentPlayer), SettingsFile);
- H := High(Players);
- for I := 0 to H do
- begin
- WriteINI('Players' + IntToStr(I), 'Name', Players[I].Name, SettingsFile);
- WriteINI('Players' + IntToStr(I), 'Pass', Players[I].Pass, SettingsFile);
- WriteINI('Players' + IntToStr(I), 'Pin', Players[I].Pin, SettingsFile);
- WriteINI('Players' + IntToStr(I), 'LampSkill', Players[I].LampSkill, SettingsFile);
- WriteINI('Players' + IntToStr(I), 'Active', BoolToStr(Players[I].Active), SettingsFile);
- WriteINI('Players' + IntToStr(I), 'Member', BoolToStr(Players[I].Member), SettingsFile);
- WriteINI('Players' + IntToStr(I), 'Booleans0', BoolToStr(Players[I].Booleans[0]), SettingsFile);
- WriteINI('Players' + IntToStr(I), 'Strings0', Players[I].Strings[0], SettingsFile);
- for II := 0 to 2 do
- WriteINI('Players' + IntToStr(I), 'Integers' + IntToStr(II), IntToStr(Players[I].Integers[II]), SettingsFile);
- end;
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure FormClosed(Sender: TObject; var CanClose: Boolean);
- Contributors: Wanted
- Description: Actions performed upon closing form.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure FormClosed(Sender: TObject; var CanClose: Boolean);
- begin
- UpdateSettingsFromForm;
- SaveSettings;
- CanClose := True;
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure InitForm;
- Contributors: Wanted
- Description: The form initialization super condensed.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: April 27th, 2012. By Wanted. RS2 Build 713.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure InitForm;
- var
- FormInfo: TVariantArray;
- I, II: Integer; // 0 1 2 3 4 5 6 7 8 9 10 11 12
- begin // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
- LoadSettings;
- BackgroundPicture := LoadBitmap(ScriptPath + 'Form\Background.bmp');
- FormInfo := ['Access', 'Players', 'Settings', 'Help', 'About', 'Run', '<<', 'New Player', 'Delete Player', '>>', ' ', 'Authentication', '.Name', 'Task', 'Loads', '.Pin', '.Pass', '.LampSkill', 'Max Ess', 'World', '.Active', 'Random World', '.Member', 41, 35, 49, 27, 43, 33, 56, 20, 260, 29, 232, 57, 244, 45, 256, 33, 8, 55, 59, 'Air (Abyss)', 'Mind (Abyss)', 'Water (Abyss)', 'Earth (Abyss)', 'Fire (Abyss)', 'Body (Abyss)', 'Cosmic (Abyss)', 'Chaos (Abyss)', 'Nature (Abyss)', 'Law (Abyss)', 'Death (Abyss)', 'Blood (Abyss)', 'Agility', 'Attack', 'Constitution', 'Construction', 'Cooking', 'Crafting', 'Defence', 'Dungeoneering ', 'Farming', 'Firemaking', 'Fishing', 'Fletching', 'Herblore', 'Hunting', 'Magic', 'Mining', 'Prayer', 'Ranged', 'Runecrafting', 'Slayer', 'Smithing', 'Strength', 'Summoning', 'Thieving', 'Woodcutting'];
- Form := CreateForm;
- with Form do
- begin
- Caption := 'OSI Runecrafter - Revision ' + IntToStr(Script_Revision);
- SetBounds(162, 102, 500, 305);
- BorderStyle := BSToolWindow;
- OnPaint := @LoadBackground;
- OnCloseQuery := @FormClosed;
- with Font do
- begin
- Color := clWhite;
- Style := [fsBold];
- end;
- end;
- for I := 0 to 9 do
- with Buttons[I] do
- begin
- Buttons[I] := TButton.Create(Form);
- Parent := Form;
- OnClick := @SomethingClicked;
- case I of
- 0..4: SetBounds(16 + (96 * I), 253, 85, 19);
- 5: SetBounds(166, 204, 170, 38);
- 6..9: SetBounds(72 + (90 * (I - 6)), 68, 85, 19);
- end;
- Caption := FormInfo[I];
- //Hint := 'Click to ' + FormInfo[2 * I] + '.';
- Font.Style := [];
- end;
- for I := 0 to 0 do
- with GroupBoxes[0] do
- begin
- GroupBoxes[I] := TGroupBox.Create(Form);
- Parent := Form;
- //Caption := FormInfo[5 + I];
- Caption := ' ';
- //SetBounds(FormInfo[2 * I], FormInfo[2 * I], FormInfo[2 * I], FormInfo[1 + (2 * I)]);
- SetBounds(66, 96, 370, 90);
- Hide;
- end;
- for I := 0 to 7 do
- with NxEdits[I] do
- begin
- if (I < 2) then
- begin
- NxEdits[I] := TNxEdit.Create(GroupBoxes[0]);
- Parent := GroupBoxes[0];
- Enabled := False;
- SetBounds(42, 24 + (28 * I), 281, 21);
- end
- else
- begin
- NxEdits[I] := TNxEdit.Create(Form);
- Parent := Form;
- SetBounds(84 + (212 * (I div 5)), 96 + (28 * ((I - 2) mod 3)), 121, 21);
- if (Top > 96) then
- Top := Top + 28;
- end;
- BorderStyle := bsNone;
- Color := clNone;
- if ((I = 4) or (I = 5)) then
- PasswordChar := '*';
- end;
- for I := 0 to 12 do
- with Labels[I] do
- begin
- if (I < 1) then
- begin
- Labels[I] := TLabel.Create(GroupBoxes[0]);
- Labels[I + 13] := TLabel.Create(GroupBoxes[0]);
- Parent := GroupBoxes[0];
- Labels[I + 13].Parent := GroupBoxes[0];
- SetBounds(10, 0, 84, 13);
- Labels[I + 13].SetBounds(10, 0, 84, 13);
- end
- else
- begin
- Labels[I] := TLabel.Create(Form);
- Labels[I + 13] := TLabel.Create(Form);
- Parent := Form;
- Labels[I + 13].Parent := Form;
- case I of
- 0, 12: SetBounds(FormInfo[39 + (3 * (I - 12))], FormInfo[40 + (3 * (I - 12))], FormInfo[41 + (3 * (I - 12))], 13);
- 1..8: SetBounds(FormInfo[21 + (2 * I)], 100 + (28 * ((I - 1) mod 4)), FormInfo[24 + (2 * (I - 1))], 13);
- 9..11: SetBounds(104 + (211 * (I div 10)), 208 + (18 * (I div 11)), 83, 13);
- end;
- end;
- Labels[I + 13].SetBounds(Left - 1, Top - 1, Width, Height);
- Caption := FormInfo[11 + I];
- Labels[I + 13].Caption := FormInfo[11 + I];
- Labels[I].Font.Color := clBlack;
- end;
- for I := 0 to 1 do
- with ComboBoxes[I] do
- begin
- ComboBoxes[I] := TComboBox.Create(Form);
- Parent := Form;
- SetBounds(84 + (I * 212), 124, 121, 21);
- Color := clNone;
- OnKeyPress := @OnKeyPress;
- for II := 0 to (11 + (13 * I)) do
- Items.Add(FormInfo[42 + (12 * I) + II]);
- OnClick := @SomethingClicked;
- end;
- for I := 0 to 2 do
- with CheckBoxes[I] do
- begin
- CheckBoxes[I] := TCheckBox.Create(Form);
- Parent := Form;
- SetBounds(84 + (212 * ((I + 9) div 10)), 206 + (20 * ((I + 9) div 11)), 14, 17);
- OnClick := @SomethingClicked;
- end;
- SomethingClicked(Buttons[0]);
- UpdateFormFromSettings;
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure FormSafeInit;
- Contributors: Freddy
- Description: Safe form display
- Date Created: ??? By Freddy
- Last Modification: ??? By Freddy
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure FormSafeInit;
- var
- v: TVariantArray;
- begin
- SetLength(v, 0);
- ThreadSafeCall('InitForm', v);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function FormShowModal: Boolean;
- Contributors: Freddy
- Description: Safe form display
- Date Created: ??? By Freddy
- Last Modification: ??? By Freddy
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function FormShowModal: Boolean;
- begin
- Result := Form.ShowModal = mrOk;
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function FormSafeShowModal: Boolean;
- Contributors: Freddy
- Description: Safe form display
- Date Created: ??? By Freddy
- Last Modification: ??? By Freddy
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function FormSafeShowModal: Boolean;
- var
- v: TVariantArray;
- begin
- SetLength(v, 0);
- Result := ThreadSafeCall('FormShowModal', v);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- SCRIPT
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure InitScript;
- Contributors: Wanted
- Description: Initiates the script.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 8th, 2012. By Wanted. RS2 Build 695.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure InitScript;
- begin
- ClearDebug;
- try
- FormSafeInit;
- FormSafeShowModal;
- except
- WriteLn('Error in Form');
- finally
- FreeForm(Form);
- FreeBitmap(BackgroundPicture);
- end;
- if (not (StartScript)) then
- TerminateScript;
- SetUpOSI;
- {$IFNDEF SMART}
- FindWindowBySize(RSPW, RSPH);
- WaitRR(500, 750);
- ActivateClient;
- {$ENDIF}
- WaitRR(1000, 2000);
- TimeStarted := GetSystemTime;
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function PlayerRune(PlayerNo: Integer): string;
- Contributors: Wanted
- Description: Returns the rune this player will be crafting.
- Date Created: January 10th, 2012. By Wanted. RS2 Build 696.
- Last Modification: January 10th, 2012. By Wanted. RS2 Build 696.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function PlayerRune(PlayerNo: Integer): string;
- begin
- Result := Copy(Players[CurrentPlayer].Strings[Player_Task], 1, (Pos('(', Players[CurrentPlayer].Strings[Player_Task]) - 2));
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function PlayerRuneLoc(PlayerNo: Integer): string;
- Contributors: Wanted
- Description: Returns the location that this player will be using to runecraft.
- Date Created: January 10th, 2012. By Wanted. RS2 Build 696.
- Last Modification: January 10th, 2012. By Wanted. RS2 Build 696.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function PlayerRuneLoc(PlayerNo: Integer): string;
- begin
- Result := Between('(', ')', Players[CurrentPlayer].Strings[Player_Task]);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function InitPlayer: Boolean;
- Contributors: Wanted
- Description: Initiates a player, true if log in successful.
- Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
- Last Modification: May 13th, 2012. By Wanted. RS2 Build 716.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function InitPlayer: Boolean;
- var
- PNames, PureEssenceRunes: TStringArray;
- I, Slot, dtmTool, Tol: Integer;
- PAmounts: TIntegerArray;
- S: string;
- P: TPoint;
- B: TBox;
- begin
- if (not (CurrentlyMemberWorld)) then
- begin
- if (Players[CurrentPlayer].Booleans[Player_Random_World]) then
- Players[CurrentPlayer].WorldInfo := [Players[CurrentPlayer].Member, -1, False]
- else
- Players[CurrentPlayer].WorldInfo := [Players[CurrentPlayer].Member, Players[CurrentPlayer].Integers[Player_World]];
- CurrentlyMemberWorld := True;
- end
- else
- Players[CurrentPlayer].WorldInfo := [];
- Result := LoggedIn;
- if (not (Result)) then
- Result := Login;
- if (not (Result)) then
- Exit;
- PureEssenceRunes := ['Cosmic', 'Chaos', 'Astral', 'Nature', 'Law', 'Armadyl', 'Blood'];
- Players[CurrentPlayer].Booleans[Player_Pure_Essence] := InStrArr(PlayerRune(CurrentPlayer), PureEssenceRunes, False);
- S := 'regular';
- if (Players[CurrentPlayer].Booleans[Player_Pure_Essence]) then
- S := 'pure';
- WriteLn('Player set to runecraft ' + S + ' essence into ' + LowerCase(PlayerRune(CurrentPlayer)) + ' runes at ' + PlayerRuneLoc(CurrentPlayer) + '.');
- WaitRR(500, 750);
- SetAngle(True);
- MakeCompass(Dir_North);
- Wait(1500); //ScanForRandoms(1500, T); // FIX
- SetChats([Chat_All_Tab, Chat_Game_Tab, Chat_Public_Tab, Chat_Private_Tab, Chat_Friends_Tab, Chat_Clan_Tab, Chat_Trade_Tab, Chat_Assist_Tab],
- [Chat_View, Chat_All, Chat_Hide, Chat_Off, Chat_Off, Chat_Off, Chat_On, Chat_Off]);
- GetAllLevels(True);
- if (Players[CurrentPlayer].Integers[Player_Initial_XP] = 0) then
- Players[CurrentPlayer].Integers[Player_Initial_XP] := GetXP(Skill_Runecrafting, False);
- if (Players[CurrentPlayer].Integers[Player_Initial_Lvl] = 0) then
- Players[CurrentPlayer].Integers[Player_Initial_Lvl] := Players[CurrentPlayer].Level[Skill_Runecrafting];
- WriteLn('RC Level: ' + IntToStr(Players[CurrentPlayer].Level[Skill_RuneCrafting]) + ' Exp: ' + IntToStr(Players[CurrentPlayer].Integers[Player_Initial_XP]));
- SetGameTab(Tab_Equip);
- B := GetEquipmentBounds(Tab_Equip_Right_Hand);
- Abyss_Tool := '';
- dtmTool := LoadMiningItem(dtmPickaxe, Tol);
- if (FindDTM(dtmTool, P.X, P.Y, B.X1, B.Y1, B.X2, B.Y2)) then
- Abyss_Tool := 'Pickaxe';
- FreeDTM(dtmTool);
- if (Abyss_Tool = '') then
- begin
- dtmTool := LoadWoodcuttingItem(dtmHatchet, Tol);
- if (FindDTM(dtmTool, P.X, P.Y, B.X1, B.Y1, B.X2, B.Y2)) then
- Abyss_Tool := 'Hatchet';
- FreeDTM(dtmTool);
- end;
- if (Abyss_Tool <> '') then
- WriteLn(Abyss_Tool + ' abyss entrance tool detected.')
- else
- WriteLn('No abyss entrance tool detected.');
- ClickEquipedItem(Tab_Equip_Neck, MoveTo, False);
- WaitRR(1000, 1500);
- Players[CurrentPlayer].Integers[Player_Charges] := StrToIntDef(GetNumbers(Copy(GetUpText, 1, 25)), 0);
- WriteLn('Equipped Amulet of glory(' + IntToStr(Players[CurrentPlayer].Integers[Player_Charges]) + ') detected.');
- SetGameTab(Tab_Inv);
- PNames := ['Small', 'Medium', 'Large', 'Gaint'];
- Players[CurrentPlayer].Integers[Player_Pouches_Count] := 0;
- PAmounts := [2, 5, 8, 11];
- Players[CurrentPlayer].Integers[Player_Essence_Count] := 28;
- for I := 0 to 3 do
- if (FindPouch(I, Slot, False)) then
- begin
- Inc(Players[CurrentPlayer].Integers[Player_Pouches_Count]);
- WriteLn(PNames[I] + ' pouch detected in slot ' + IntToStr(Slot) + '.');
- Players[CurrentPlayer].Booleans[I + 1] := True;
- IncEx(Players[CurrentPlayer].Integers[Player_Essence_Count], PAmounts[I]);
- SetLength(Players[CurrentPlayer].TIA[Player_Inv_Exclude], Length(Players[CurrentPlayer].TIA[Player_Inv_Exclude]) + 1);
- Players[CurrentPlayer].TIA[Player_Inv_Exclude][High(Players[CurrentPlayer].TIA[Player_Inv_Exclude])] := Slot;
- end;
- if (Players[CurrentPlayer].Integers[Player_Pouches_Count] < 1) then
- WriteLn('No pouches detected.')
- else
- WriteLn(IntToStr(Players[CurrentPlayer].Integers[Player_Pouches_Count]) + ' pouch(es) detected.');
- Players[CurrentPlayer].Loc := 'EVB.';
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure Banking;
- Contributors: Wanted
- Description: Everything for banking.
- Date Created: January 9th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 10th, 2012. By Wanted. RS2 Build 696.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure Banking;
- var
- I, EBC, dtmGlory_Amulet: Integer;
- PAmounts: TIntegerArray;
- P: TPoint;
- S: string;
- B: TBox;
- begin
- if (Players[CurrentPlayer].Loc <> 'EVB.') then
- Exit;
- if (not (LoggedIn)) then
- Exit;
- if (Players[CurrentPlayer].Booleans[Player_Medium_Pouch]) then
- if (not (Players[CurrentPlayer].Booleans[Player_Medium_Decayed])) then
- if (FindPouch(bmpPouch_Medium_Damaged, I, True)) then
- begin
- Players[CurrentPlayer].Booleans[Player_Medium_Decayed] := True;
- WriteLn('Damaged medium pouch detected.');
- DecEx(Players[CurrentPlayer].Integers[Player_Essence_Count], 3);
- end;
- if (Players[CurrentPlayer].Booleans[Player_Large_Pouch]) then
- if (not (Players[CurrentPlayer].Booleans[Player_Large_Decayed])) then
- if (FindPouch(bmpPouch_Large_Damaged, I, True)) then
- begin
- Players[CurrentPlayer].Booleans[Player_Large_Decayed] := True;
- WriteLn('Damaged large pouch detected.');
- DecEx(Players[CurrentPlayer].Integers[Player_Essence_Count], 3);
- end;
- if ((InvFull(True)) and (Players[CurrentPlayer].Integers[Player_Charges] > 0)) then
- Exit;
- Players[CurrentPlayer].Loc := 'Banking...';
- WriteLn('Banking...');
- if (Players[CurrentPlayer].Integers[Player_Charges] < 1) then
- begin
- WriteLn('Glory amulet has run out of charges. Switching to new amulet...');
- ClickEquipedItem(Tab_Equip_Necklace, ClickLeft, True);
- SetGameTab(Tab_Inv);
- end;
- if (not (OpenBank(Loc_EVB))) then
- begin
- WriteLn('Unable to Open Bank! Logging out...');
- Logout;
- Players[CurrentPlayer].Active := False;
- Players[CurrentPlayer].Loc := 'Can''t find bank';
- Exit;
- end;
- DepositAllExclude(Players[CurrentPlayer].TIA[Player_Inv_Exclude], False);
- if (Players[CurrentPlayer].Integers[Player_Charges] < 1) then
- begin
- dtmGlory_Amulet := DTMFromString('78DA639CC8C8C0F0930105648BF433480269A' +
- '00CC37F2060EC03B2DE32A0012630C908E531F60059AF08A89905' +
- '64BD26A0662E116AA60159BF8970CF4F026A407EFF875F0D00BE0' +
- 'F1177');
- B := GetBankSlotBounds(38);
- if (not (FindDTM(dtmGlory_Amulet, P.X, P.Y, B.X1, B.Y1, B.X2, B.Y2))) then
- begin
- WriteLn('Out of glories! Logging out...');
- CloseBank(False);
- Logout;
- Players[CurrentPlayer].Active := False;
- Players[CurrentPlayer].Loc := 'Out of glories';
- FreeDTM(dtmGlory_Amulet);
- Exit;
- end;
- FreeDTM(dtmGlory_Amulet);
- Withdraw(Withdraw_1, 38, False);
- for I := 0 to 27 do
- if (not (TIAContains(Players[CurrentPlayer].TIA[Player_Inv_Exclude], I))) then
- begin
- MouseItem(I, ClickRight, False);
- ChooseOptionMulti(['Wea', 'ear', 'ar A']);
- Break;
- end;
- Players[CurrentPlayer].Integers[Player_Charges] := 4;
- end;
- Withdraw(Withdraw_All, 39, False);
- PAmounts := [2, 5, 8, 11];
- for I := 0 to 1 do
- if (Players[CurrentPlayer].Booleans[I + 5]) then
- DecEx(PAmounts[I + 1], 3);
- EBC := 28;
- for I := 0 to 3 do
- if (Players[CurrentPlayer].Booleans[I + 1]) then
- begin
- IncEx(EBC, PAmounts[I]);
- if (EBC > 50) then
- Withdraw(Withdraw_All, 39, False);
- ClickPouch(I, Pouch_Fill, False);
- end;
- if (EBC > 28) then
- Withdraw(Withdraw_All, 39, False);
- S := 'regular';
- if (Players[CurrentPlayer].Booleans[Player_Pure_Essence]) then
- S := 'pure';
- WriteLn(IntToStr(Players[CurrentPlayer].Integers[Player_Essence_Count]) + ' ' + s + ' essences being carried.');
- WriteLn('Finished banking.');
- Players[CurrentPlayer].Loc := 'EVB.';
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function WalkOutOfBank: Boolean;
- Contributors: Wanted
- Description: Walks out of the bank using banker NPC MM dtm.
- Date Created: January 11th, 2012. By Wanted. RS2 Build 696.
- Last Modification: January 11th, 2012. By Wanted. RS2 Build 696.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function WalkOutOfBank: Boolean;
- var
- dtm_Bankers_Exit: Integer;
- Angle: Extended;
- P: TPoint;
- begin
- dtm_Bankers_Exit := DTMFromString('78DA635CC6C4C0A0C68002FA972633FC07D28' +
- 'C40FC1F08182B816A4221722C5035FFFFB2302843D58000588D2F' +
- '0135554035AE04D4D402D538E1570300DC321321');
- FindDTMRotated(dtm_Bankers_Exit, P.X, P.Y, MMX1, MMY1, MMX2, MMY2, Radians(-15), Radians(15), Radians(1), Angle);
- FreeDTM(dtm_Bankers_Exit);
- Result := OnMM(P.X, P.Y);
- if (not (Result)) then
- Exit;
- MouseFlagEx(P.X, P.Y, 0, 0, 10);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- ABYSS
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function CrossWildernessWall: Boolean;
- Contributors: Wanted
- Description: Finds and jumns over the wilderness wall.
- Date Created: January 11th, 2012. By Wanted. RS2 Build 696.
- Last Modification: January 11th, 2012. By Wanted. RS2 Build 696.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function CrossWildernessWall: Boolean;
- var
- ATPA: T2DPointArray;
- TPA: TPointArray;
- I, H: Integer;
- P: TPoint;
- begin
- Result := False;
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.19, 0.98);
- FindColorsTolerance(TPA, 3685954, MSX1, MSY1, MSX2, MSY2, 6);
- SetColorSpeed2Modifiers(0.2, 0.2);
- ColorToleranceSpeed(1);
- if (Length(TPA) < 100) then
- Exit;
- ATPA := TPAToATPAEx(TPA, 50, 50);
- H := High(ATPA);
- if (H < 0) then
- Exit;
- SortATPAByMiddleEx(ATPA, Point(MSCX, MSCY));
- for I := 0 to H do
- if (Length(ATPA[I]) > 150) then
- begin
- P := MiddleTPA(ATPA[I]);
- MMouse(P.X, P.Y, 0, 0);
- if (not (IsUpTextMulti(['ross', 'ildern', 'erness', ' wall']))) then
- Continue;
- GetMousePos(P.X, P.Y);
- Mouse(P.X, P.Y, 0, 0, True);
- Flag;
- WaitRR(750, 1250);
- if (GetColor(185, 242) = 65536) then
- begin
- if (GetColor(142, 220) = 65536) then
- begin
- MouseBox(139, 224, 148, 232, ClickLeft);
- WaitRR(500, 700);
- end;
- MouseBox(142, 244, 227, 294, ClickLeft);
- Flag;
- WaitRR(1000, 2000);
- end;
- Result := True;
- Exit;
- end;
- WriteLn('Unable to find wilderness wall!');
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- function WalkAfterWall: Boolean;
- Contributors: Wanted
- Description: Walks after the wall using the tree trunk MM dtm.
- Date Created: January 11th, 2012. By Wanted. RS2 Build 696.
- Last Modification: January 11th, 2012. By Wanted. RS2 Build 696.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- function WalkAfterWall: Boolean;
- var
- dtm_Past_Wall: Integer;
- Angle: Extended;
- P: TPoint;
- begin
- dtm_Past_Wall := DTMFromString('78DA636C62626050604001FD4B9319FE03694' +
- '620FE0F048C49403552103916A81AB560210649A81A1060EC2242' +
- '4D1A508D1E0135CD84D50000D7470C4E');
- FindDTMRotated(dtm_Past_Wall, P.X, P.Y, MMX1, MMY1, MMX2, MMY2, Radians(-15), Radians(15), Radians(1), Angle);
- FreeDTM(dtm_Past_Wall);
- Result := OnMM(P.X, P.Y);
- if (not (Result)) then
- Exit;
- MouseFlagEx(P.X, P.Y, 0, 0, 10);
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure WalkToAbyss;
- Contributors: Wanted
- Description: Walks up to the zamorak mage and teleports into abyss.
- Date Created: January 11th, 2012. By Wanted. RS2 Build 696.
- Last Modification: January 11th, 2012. By Wanted. RS2 Build 696.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure WalkToAbyss;
- begin
- //if (Players[CurrentPlayer].Loc <> 'EVB.') then FIX
- //Exit; FIX
- if (not (LoggedIn)) then
- Exit;
- Players[CurrentPlayer].Loc := 'Walking to mage';
- WriteLn('Walking to zamorak mage...');
- if (not (WalkOutOfBank)) then
- MouseFlagEx(661, 37, 2, 3, 10);
- MouseFlag(637, 13, 1, 1);
- WaitRR(500, 700);
- if (not (CrossWildernessWall)) then
- begin
- MouseFlag(MMCX, 57, 1, 7);
- WaitRR(500, 700);
- if (not (CrossWildernessWall)) then
- begin
- WriteLn('Could not cross wilderness wall! logging out...');
- Logout;
- Players[CurrentPlayer].Active := False;
- Players[CurrentPlayer].Loc := 'Can''t find wall';
- Exit;
- end;
- end;
- if (not (WalkAfterWall)) then
- MouseFlagEx(641, 34, 2, 3, 10);
- MouseFlagEx(628, 43, 2, 4, 10);
- end;
- function TeleportZamorakMage: Boolean;
- var
- T, TT, I, H, Atmp: Integer;
- TPA, TPA2: TPointArray;
- ATPA: T2DPointArray;
- P: TPoint;
- B: TBox;
- begin
- Result := False;
- T := GetSystemTime + RR(80000, 100000);
- Atmp := 0;
- repeat
- Inc(Atmp);
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.59, 0.32);
- FindMMColorsTolerance(TPA, 8615537, 11);
- SetColorSpeed2Modifiers(0.2, 0.2);
- ColorToleranceSpeed(1);
- if (Length(TPA) < 30) then
- Exit;
- ATPA := SplitTPA(TPA, 5);
- SortATPASize(ATPA, True);
- if (Length(ATPA) < 1) then
- Exit;
- TPA := ATPA[0];
- TPASortEx(TPA, Point(MMX1, MMY1));
- P := TPA[0];
- if (Atmp > 3) then
- Atmp := 1;
- case Atmp of
- 1: MouseFlag(P.X, P.Y - 16, 2, 2);
- 2: MouseFlag(P.X - 10, P.Y - 7, 2, 2);
- 3: MouseFlag(P.X, P.Y - 30, 2, 2);
- end;
- WaitRR(500, 700);
- TT := GetSystemTime + RR(4000, 6000);
- while (GetSystemTime < TT) do
- begin
- ATPA := FindMMDotsExOverlap([cldYellowDot]);
- if (Length(ATPA) < 1) then
- Continue;
- TPA := ATPA[0];
- TPA := MMsToMSs(TPA);
- if (Length(TPA) < 1) then
- Continue;
- H := High(TPA);
- for I := 0 to H do
- begin
- B := Box(TPA[I].X - 30, TPA[I].Y - 30, TPA[I].X + 30, TPA[I].Y + 30);
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.17, 0.12);
- FindColorsTolerance(TPA2, 1779289, B.X1, B.Y1, B.X2, B.Y2, 13);
- SetColorSpeed2Modifiers(0.2, 0.2);
- ColorToleranceSpeed(1);
- if (Length(TPA2) > 50) then
- begin
- ATPA := SplitTPA(TPA2, 4);
- SortATPASize(ATPA, True);
- if (Length(ATPA) < 1) then
- Continue;
- P := MiddleTPA(ATPA[0]);
- MMouse(P.X, P.Y, 0, 0);
- if (not (IsUpTextMulti(['alk-to', 'Mage', ' Zam', 'amora', 'morak']))) then
- Continue;
- GetMousePos(P.X, P.Y);
- Mouse(P.X, P.Y, 0, 0, False);
- if (not (ChooseOptionMulti(['rade']))) then // FIX
- Continue;
- Break;
- end;
- end;
- if (I <= H) then
- begin
- //InAbyssLoop Result True Exit
- end;
- end;
- WriteLn('Zamorak Mage not found! Repositioning...');
- until (GetSystemTime > T)
- end;
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- MAIN LOOP
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- procedure MainLoop;
- Contributors: Wanted
- Description: The entire repeating portion of script pulled
- together here to avoid use of extra global vars.
- Date Created: January 8th, 2012. By Wanted. RS2 Build 695.
- Last Modification: January 11th, 2012. By Wanted. RS2 Build 697.
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
- procedure MainLoop;
- begin
- InitPlayer; //FIX
- Banking; //FIX
- WalkToAbyss; //FIX
- TeleportZamorakMage; // FIX
- end;
- begin
- InitScript;
- MainLoop;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement