SRL Archive - Archive

Fitta - SRL Member Application


Fitta

2014-11-04 15:29:19

How Long have You Played Runescape?
1 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
Java, PHP


Are you a member of any other communities?
All major botting sites


Tell us about yourself…
From: Fitta
17 year old guy studying from home. Got a lot of spare time as my legs are not fully working!
Started playing rs, got tired of it, found this place and made some simple scripts. Now I'm addicted heh.

Also plays CS:GO and Leauge Of Legends.

Since last time I've done a lot of scripting, mostly Aerolib.. Really want to contribute with this script for the old schoolers! I've got a bunch of other scripts too, but this one is the most recent!



Please show us one (or multiple) of your scripts.
program NMZ;
{$DEFINE SMART}
{$i AeroLib/AeroLib.Simba}

{
FORM VARIABLES
}
var
FittForm:TForm;
ButtonArr: array [0..1] of TButton;
ComboBox: TComboBox;
CheckBoxArr: array [0..3] of TCheckBox;
LabelArr: array [0..6] of TLabel;
EditArr: array [0..4] of TEdit;
RunNMZ, SaveForm, LoadForm: Boolean;

{
END OF FORM VARIABLES
}

{
SCRIPT VARIABLES
}
T: Array [0..3] of Timer;
Disconnect: boolean;
{
END OF SCRIPT VARIABLES
}

{
SCRIPT CONSTANTS
}

const
default = 'Arial Black';

Button_OK = 0;
Button_Save = 1;

CheckBox_Prayer = 0;
CheckBox_Abs = 1;
CheckBox_Track = 2;
CheckBox_Logout = 3;

Label_FProg = 0;

Edit_FKEY = 0;
Edit_PrioStart = 1;
Edit_PrioEnd = 2;
Edit_BoostStart = 3;
Edit_BoostEnd = 4;

Timer_Boost = 0;
Timer_WaitPot = 1;
Timer_Flick_Prayer = 2;
Timer_Disconnect = 3;

Bool_Prio_Pot = 0;
Bool_Prio_Out = 1;
Bool_Boost_Out = 2;
Bool_Player_Prayer = 5;
Bool_Player_Abs = 7;
Bool_Player_Logout = 6;
Bool_Player_Track = 8;

Int_DrinkDoses = 1;
Int_Flick_Next = 2;
Int_Prio_NextPot = 3;
Int_Player_PrioStart = 4;
Int_Player_PrioEnd = 5;
Int_Player_BoostStart = 6;
Int_Player_BoostEnd = 7;
Int_Player_fkey = 8;
Int_Player_MaxHP = 9;
Int_Prio_TimeTillPot = 10;
Int_Prayer_TimeTillflick = 11;

Str_Player_Skill = 0;

afterClick = 19;
antiBan = 1300;

{
END OF SCRIPT CONSTANTS
}

{
FORM CODE
}
procedure SaveFormINI;
begin
If Not SaveForm then
Exit;

WriteINI('nmz', 'skill', Me.Strings[Str_Player_Skill], ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'prayer', BoolToStr(Me.Booleans[Bool_Player_Prayer]), ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'abs', BoolToStr(Me.Booleans[Bool_Player_Abs]), ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'logout', BoolToStr(Me.Booleans[Bool_Player_Logout]), ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'track', BoolToStr(Me.Booleans[Bool_Player_Track]), ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'fkey', IntToStr(Me.Integers[Int_Player_fkey]), ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'priostart', IntToStr(Me.Integers[Int_Player_PrioStart]), ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'prioend', IntToStr(Me.Integers[Int_Player_PrioEnd]), ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'booststart', IntToStr(Me.Integers[Int_Player_BoostStart]), ScriptPath + 'nmzsetup.ini');
WriteINI('nmz', 'boostend', IntToStr(Me.Integers[Int_Player_BoostEnd]), ScriptPath + 'nmzsetup.ini');
Writeln('[Form] .ini file saved with settings..');
end;


procedure procedure_OnClick(sender: TObject);
{$IFNDEF CODEINSIGHT}
native;
{$ENDIF}
begin
case Sender of
CheckBoxArr[CheckBox_Prayer]:
Case CheckBoxArr[CheckBox_Prayer].getState of
cbChecked:
begin
CheckBoxArr[CheckBox_Abs].setVisible(False);
FittForm.SetBounds(400, 320, 180, 320);
CheckBoxArr[CheckBox_Prayer].SetBounds(15, 15, 150, 150);
LabelArr[1].setCaption('Prayer');
LabelArr[1].SetBounds(50, 155, 50, 50);
end;

cbUnchecked:
begin
CheckBoxArr[CheckBox_Abs].setVisible(True);
FittForm.SetBounds(400, 320, 320, 50);
CheckBoxArr[CheckBox_Prayer].SetBounds(15, 15, 150, 150);
end;
end;

CheckBoxArr[CheckBox_Abs]:
Case CheckBoxArr[CheckBox_Abs].getState of
cbChecked:
begin
CheckBoxArr[CheckBox_Prayer].setVisible(False);
FittForm.SetBounds(400, 320, 180, 320);
CheckBoxArr[CheckBox_ABS].SetBounds(15, 15, 150, 150);
LabelArr[1].setCaption('Absorption');
LabelArr[1].SetBounds(40, 155, 50, 50);
end;

cbUnchecked:
begin
CheckBoxArr[CheckBox_Prayer].setVisible(True);
FittForm.SetBounds(400, 320, 320, 50);
CheckBoxArr[CheckBox_ABS].SetBounds(15+145, 15, 150, 150);
end;
end;

CheckBoxArr[CheckBox_Track]:
Case CheckBoxArr[CheckBox_Track].getState of
cbChecked:
begin
ComboBox.setEnabled(True);
EditArr[Edit_FKEY].setEnabled(True);
LabelArr[Label_FProg].setEnabled(True);
end;

cbUnchecked:
begin
ComboBox.setEnabled(False);
ComboBox.setCaption('Style of combat?');
EditArr[Edit_FKEY].setEnabled(False);
LabelArr[Label_FProg].setEnabled(False);
end;
end;


ButtonArr[Button_Save]:
begin
SaveForm := True;
Client.WriteLn('[FORM] Will save these settings when start..');
end;

ButtonArr[Button_OK]:
begin
Me.Booleans[Bool_Player_Prayer] := (CheckBoxArr[CheckBox_Prayer].getState = cbChecked);
Me.Booleans[Bool_Player_Abs] := (CheckBoxArr[CheckBox_Abs].getState = cbChecked);
Me.Booleans[Bool_Player_Logout] := (CheckBoxArr[CheckBox_Logout].getState = cbChecked);
Me.Booleans[Bool_Player_Track] := (CheckBoxArr[CheckBox_Track].getState = cbChecked);

Me.Integers[Int_Player_PrioStart] := StrToIntDef(EditArr[Edit_PrioStart].getCaption, -1);
Me.Integers[Int_Player_PrioEnd] := StrToIntDef(EditArr[Edit_PrioEnd].getCaption, -1);
Me.Integers[Int_Player_BoostStart] := StrToIntDef(EditArr[Edit_BoostStart].getCaption, -1);
Me.Integers[Int_Player_BoostEnd] := StrToIntDef(EditArr[Edit_BoostEnd].getCaption, -1);
Me.Integers[Int_Player_fkey] := StrToIntDef(EditArr[Edit_FKEY].getCaption, -1);

Me.Strings[Str_Player_Skill] := ComboBox.getCaption;

Writeln('[FORM] OK -> Script start');
RunNMZ := True;
FittForm.Close;
end;

end;
end;


procedure InitForm;
{$IFNDEF CODEINSIGHT}
native;
{$ENDIF}
var
I: Integer;
t_Bool: Boolean;
begin
FittForm.Init(nil);

with FittForm do
begin
SetCaption('Nightmare Zone');
SetBounds(408, 321, 320, 50);
SetPosition(poScreenCenter);
SetBorderStyle(bsDialog);
SetColor(16777215);
GetFont().SetName(default);
GetFont().SetColor(536870912);
GetFont().SetSize(11);
end;


For I:=0 to High(ButtonArr)do
begin
ButtonArr[I].Init(FittForm);
with ButtonArr[I] do
begin
SetParent(FittForm);
SetBounds(20+(I*75), 275, 60, 25);
SetOnClick(procedure_OnClick);
GetFont().SetName(default);
GetFont().SetColor(536870912);
GetFont().SetSize(9);
end;
end;
ButtonArr[Button_OK].SetCaption('Start');
ButtonArr[Button_Save].SetCaption('Save');

ComboBox.Init(FittForm);
With ComboBox do
begin
SetParent(FittForm);
SetBounds(15, 100, 140, 28);
SetEnabled(False);
setCaption('Style of combat?');
GetItems().Add('Attack');
GetItems().Add('Strength');
GetItems().Add('Defence');
GetItems().Add('Range');
GetItems().Add('Mage');
SetOnClick(procedure_OnClick);
GetFont().SetName(default);
GetFont().SetColor(536870912);
GetFont().SetSize(7);
end;

For I:=0 to High(CheckBoxArr)do
begin
CheckBoxArr[I].Init(FittForm);

With CheckBoxArr[I] do
begin
SetParent(FittForm);
getFont().SetSize(7);
SetOnClick(procedure_OnClick);
SetBounds(15+(I*145), 15, 150, 150);
end;
end;
CheckBoxArr[CheckBox_Prayer].SetCaption('Using Prayer?');
CheckBoxArr[CheckBox_Abs].SetCaption('Using Absorption?');

CheckBoxArr[CheckBox_Logout].SetCaption('Logout when done?');
CheckBoxArr[CheckBox_Logout].SetBounds(15, 50, 150, 150);

CheckBoxArr[CheckBox_Track].SetCaption('Track experience?');
CheckBoxArr[CheckBox_Track].SetBounds(15, 70, 150, 150);

For I:=0 to High(LabelArr)do
begin
LabelArr[I].Init(FittForm);

With LabelArr[I] do
begin
SetParent(FittForm);
getFont().SetSize(7);
SetBounds(15, 130+(I*40), 50, 50);
SetVisible(False);
end;
end;
LabelArr[Label_FProg].setCaption('F for progress');
LabelArr[Label_FProg].setVisible(True);
LabelArr[Label_FProg].SetBounds(35, 130, 50, 50);
LabelArr[Label_FProg].setEnabled(False);

LabelArr[1].setCaption('Absorption');
LabelArr[1].getFont().SetSize(9);
LabelArr[1].setVisible(True);
LabelArr[1].SetBounds(40, 155, 50, 50);

LabelArr[2].setCaption('Start');
LabelArr[2].getFont().SetSize(6);
LabelArr[2].setVisible(True);
LabelArr[2].SetBounds(25, 185, 50, 50);

LabelArr[3].setCaption('End');
LabelArr[3].getFont().SetSize(6);
LabelArr[3].setVisible(True);
LabelArr[3].SetBounds(95, 185, 50, 50);

LabelArr[4].setCaption('Overloads');
LabelArr[4].getFont().SetSize(9);
LabelArr[4].setVisible(True);
LabelArr[4].SetBounds(40, 215, 50, 50);

LabelArr[5].setCaption('Start');
LabelArr[5].getFont().SetSize(6);
LabelArr[5].setVisible(True);
LabelArr[5].SetBounds(25, 245, 50, 50);

LabelArr[6].setCaption('End');
LabelArr[6].getFont().SetSize(6);
LabelArr[6].setVisible(True);
LabelArr[6].SetBounds(95, 245, 50, 50);

For I:=0 to High(EditArr)do
begin
EditArr[I].Init(FittForm);
EditArr[I].setMaxLength(2);
With EditArr[I] do
begin
SetParent(FittForm);
SetBounds(50, 100+(I*40), 50, 50);
getFont().SetSize(7);

end;
end;
EditArr[EDIT_FKEY].SetBounds(44, 127, 15, 12);
EditArr[EDIT_FKEY].setEnabled(False);
EditArr[EDIT_FKEY].setMaxLength(1);
EditArr[EDIT_PrioStart].SetBounds(55, 180, 22, 12);
EditArr[Edit_PrioEnd].SetBounds(120, 180, 22, 12);
EditArr[Edit_BoostStart].SetBounds(55, 240, 22, 12);
EditArr[Edit_BoostEnd].SetBounds(120, 240, 22, 12);

If LoadForm then
begin

If Me.Booleans[Bool_Player_Prayer] then
begin
CheckBoxArr[CheckBox_Abs].setVisible(False);
CheckBoxArr[CheckBox_Prayer].setState(cbChecked);
FittForm.SetBounds(400, 320, 180, 320);
CheckBoxArr[CheckBox_Prayer].SetBounds(15, 15, 150, 150);
LabelArr[1].setCaption('Prayer');
LabelArr[1].SetBounds(60, 155, 50, 50);
end;

If Me.Booleans[Bool_Player_Abs] then
begin
CheckBoxArr[CheckBox_Prayer].setVisible(False);
CheckBoxArr[CheckBox_Abs].setState(cbChecked);
FittForm.SetBounds(400, 320, 180, 320);
CheckBoxArr[CheckBox_ABS].SetBounds(15, 15, 150, 150);
LabelArr[1].setCaption('Absorption');
end;

If Me.Booleans[Bool_Player_Logout] then
CheckBoxArr[CheckBox_Logout].setState(cbChecked);

If Me.Booleans[Bool_Player_Track] then
begin
CheckBoxArr[CheckBox_Track].setState(cbChecked);
ComboBox.setEnabled(True);
EditArr[Edit_FKEY].setEnabled(True);
LabelArr[Label_FProg].setEnabled(True);
ComboBox.setCaption(Me.Strings[Str_Player_Skill]);
end;

EditArr[Edit_PrioStart].setCaption(IntToStr(Me.Integers[Int_Player_PrioStart]));
EditArr[Edit_PrioEnd].setCaption(IntToStr(Me.Integers[Int_Player_PrioEnd]));
EditArr[Edit_BoostStart].setCaption(IntToStr(Me.Integers[Int_Player_BoostStart]));
EditArr[Edit_BoostEnd].setCaption(IntToStr(Me.Integers[Int_Player_BoostEnd]));
EditArr[Edit_FKEY].setCaption(IntToStr(Me.Integers[Int_Player_fkey]));

end;

FittForm.ShowModal;
end;


procedure Free;
{$IFNDEF CODEINSIGHT}
native;
{$ENDIF}
begin
if (FittForm = nil) then
exit();
client.writeln('[FORM] Freeing form..');
FittForm.free;
end;


procedure ShowForm();
begin
try
sync(InitForm);
except
writeln('ERROR: Failed to initialize form');
finally
sync(Free);
end;
end;

Procedure LoadINI;
begin
If FileExists(ScriptPath + 'nmzsetup.ini')then
begin

Me.Strings[Str_Player_Skill] := ReadINI('nmz', 'skill', ScriptPath + 'nmzsetup.ini');

Me.Booleans[Bool_Player_Prayer] := StrToBoolDef(ReadINI('nmz', 'prayer', ScriptPath + 'nmzsetup.ini'), False);
Me.Booleans[Bool_Player_Abs] := StrToBoolDef(ReadINI('nmz', 'abs', ScriptPath + 'nmzsetup.ini'), False);
Me.Booleans[Bool_Player_Logout] := StrToBoolDef(ReadINI('nmz', 'logout', ScriptPath + 'nmzsetup.ini'), False);
Me.Booleans[Bool_Player_Track] := StrToBoolDef(ReadINI('nmz', 'track', ScriptPath + 'nmzsetup.ini'), False);

Me.Integers[Int_Player_PrioStart] := StrToIntDef(ReadINI('nmz', 'priostart', ScriptPath + 'nmzsetup.ini'), 0);
Me.Integers[Int_Player_PrioEnd] := StrToIntDef(ReadINI('nmz', 'prioend', ScriptPath + 'nmzsetup.ini'), 0);
Me.Integers[Int_Player_BoostStart] := StrToIntDef(ReadINI('nmz', 'booststart', ScriptPath + 'nmzsetup.ini'), 0);
Me.Integers[Int_Player_BoostEnd] := StrToIntDef(ReadINI('nmz', 'boostend', ScriptPath + 'nmzsetup.ini'), 0);
Me.Integers[Int_Player_fkey] := StrToIntDef(ReadINI('nmz', 'fkey', ScriptPath + 'nmzsetup.ini'), 0);

LoadForm := True;
end;
end;

{
END OF FORM CODE
}

{
NIGHTMARE ZONE CODE
}
procedure Debug(func, res, text: String);
var
S: String;
begin
S := '[NMZ] ' + Func;
If not (res = '') then
S := S + ': ' + res;

If not (text = '') then
S := S + ' - ' + Text;

Writeln(S);
end;

procedure Debug_screen(log: string);
begin
if (not directoryExists(ScriptPath + 'nmz\')) then
forceDirectories(ScriptPath + 'nmz\');

try
saveScreenshot(ScriptPath + 'nmz\' + theDate(DATE_FORMAL) + ', ' + log + '.png');
except
Writeln('Failed to save screenshot of: ' + log);
end;
end;

Procedure PrintSetup;
var
S: String;
begin
If Me.Booleans[Bool_Player_Prayer] then
begin
S := 'Prayer potions';
T[Timer_Flick_Prayer].START;
Me.Integers[Int_Prio_NextPot] := 7+Random(19);
end else
S := 'Absorption potions';

Writeln('[Setup]');
Writeln(' ' + S + ' - Start: ' + IntToStr(Me.Integers[Int_Player_PrioStart]) + ' End: ' + IntToStr(Me.Integers[Int_Player_PrioEnd]));
Writeln(' Overload potions - Start: ' + IntToStr(Me.Integers[Int_Player_BoostStart]) + ' End: ' + IntToStr(Me.Integers[Int_Player_BoostEnd]));
Writeln(' logOut when done: ' + BoolToStr(Me.Booleans[Bool_Player_Logout]));
Writeln(' Track experience: ' + BoolToStr(Me.Booleans[Bool_Player_Track]));
If Me.Booleans[Bool_Player_Track] then
begin
Writeln(' FKey for progress: ' + IntToStr(Me.Integers[Int_Player_fkey]));
Writeln(' Skill of choice: ' + Me.Strings[Str_Player_Skill] );
end;
Writeln('[End of Setup]');
end;

function getAbsText: integer;
var
I: Integer;
S: String;
begin
Result := 200;
For I:=8 downto 1 do
begin
S := getChatBoxText(I, 24320);
If (S = '')then
Continue;

S := GetNumbers(S);
Result := StrToIntDef(S, 200);
Break;
end;
end;

procedure mouseHandle(B: TBox; mouse_type: Integer);
begin
If Not mouseInBox(B)then
MouseBox(B, mouse_Type)
else
if Random(2) = 0 then
fastClick(mouse_Type)
else
MouseBox(B, mouse_Type);
end;

function MouseOnScreen: boolean;
var
x, y: integer;
begin
GetMousePos(x, y);
Result := PointInBox(Point(x, y), IntToBox(0, 0, 760, 500));
end;

procedure mouseOffScreen;
begin
If MouseOnScreen then
MMouseOffClient('rand');
end;

Procedure mightOffScreen;
begin
If Random(10) = 0 then
mouseOffScreen;
end;

function Tab(i: integer): boolean;
begin
Case Random(8)of
0: Result := FTab(I);
1..7: Result := gameTab(I);
end;
end;

procedure beHuman(i: Integer);
begin
If Not MouseOnScreen then
Exit;

Case Random(I)of
0..3: mouseOffScreen;
4..8: setCompass(Random(361));
9: randomMovement;
10: randomFKeys(True);
11: Tab(TAB_STATS);
12..16: SleepAndMoveMouse(200+Random(2000));
17: randomRClick;
end;
end;

procedure flickPrayer;
begin
If (Not isLoggedIn)or(Me.Booleans[Bool_Player_Prayer]) then
Exit;

If T[Timer_Flick_Prayer].timeElapsed() > Me.Integers[Int_Prayer_TimeTillflick] then
begin
Me.Integers[Int_Prayer_TimeTillflick] := 15000+Random(17000);
Debug('flickPrayer', 'clicking..', 'Next at ' + msToTime(Me.Integers[Int_Prayer_TimeTillflick], TIME_SHORT));
MouseBox(523, 96, 564, 114, 5, MOUSE_LEFT);
Wait(800+Random(500));
Case Random(3) of
0: MouseBox(523, 96, 564, 114, 5, MOUSE_LEFT);
1, 2: fastClick(MOUSE_LEFT);
end;

T[Timer_Flick_Prayer].START;
end;
end;

function InteractInv(startSearch, endSearch: Integer; upText: String): boolean;
var
I: Integer;
B: TBox;
S: String;
begin
If (Not isLoggedIn)or(Not Tab(TAB_INV)) then
Exit(False);

For I:=startSearch to endSearch do
If itemInSlot(I) then
begin
B := invBox(I);
mouseHandle(B, mouse_Move);
If waitUpTextMulti([upText, 'ial', 'teel'], 250+Random(100))then
begin

Debug('InteractInv', 'Found item in search area', '(Slot: ' + ToStr(I) + ' - Cords: ' + ToStr(B) + ')');
If waitUpTextMulti(['Vial', 'teel'], 50+Random(50))then
begin
Debug('InteractInv', 'Item is an vial', 'Vial -> Dropping');
interactSlot(I, 'Drop');
Continue;
end else
If (Random(10) = 0) then
begin
fastClick(mouse_Right);
if not waitOption('rink', 250+Random(100))then
Debug('waitOption', 'troubling with ''rink''', '');

end else
fastClick(mouse_Left);

Result := True;
Exit;
end;
end;
end;

Procedure drink_Potions;
var
t_Int: Integer;
begin
{If OverLoad then}
t_Int := getCurrentHealth;
If (t_Int > 50)and(not Me.Booleans[Bool_Boost_Out])and(T[Timer_Boost].timeElapsed > 40000) then
begin
Debug('drink_Potions', 'Full HP -> Overload', 'HP is ' + ToStr(t_Int));
If Not Me.Booleans[Bool_Boost_Out] then
Me.Booleans[Bool_Boost_Out] := (Not InteractInv(Me.Integers[Int_Player_BoostStart], Me.Integers[Int_Player_BoostEnd], 'load'));

If Me.Booleans[Bool_Boost_Out] then
Debug('drink_Potions', 'Out of overloads', '')
else
begin
beHuman(afterClick);
T[Timer_Boost].start;
end;
end;

{If LowPray then}
t_Int := getPrayerPoints;
If (t_Int < Me.Integers[Int_Prio_NextPot])and(Me.Booleans[Bool_Player_Prayer])and(Not Me.Booleans[Bool_Boost_Out])then
begin
Me.Integers[Int_Prio_NextPot] := 7+Random(19);
Debug('drink_Potions', 'Low prayer -> Prayer potion', 'Prayer is ' + ToStr(t_Int) + ' - Next pot at ' + ToStr(Me.Integers[Int_Prio_NextPot]));
If Not Me.Booleans[Bool_Prio_Out] then
Me.Booleans[Bool_Prio_Out] := (Not InteractInv(Me.Integers[Int_Player_PrioStart], Me.Integers[Int_Player_PrioEnd], 'rayer'));

If not t_Int = Me.Integers[Int_Player_BoostStart] then
Me.Integers[Int_Player_BoostStart] := t_Int;

If Me.Booleans[Bool_Boost_Out] then
Debug('drink_Potions', 'Out of prayer potions', '')
else
beHuman(afterClick);
end;

{If AbsLow then}
t_Int := getAbsText;
If (t_Int < 200)and(Not Me.Booleans[Bool_Prio_Pot])and(Me.Booleans[Bool_Player_Abs])and(not Me.Booleans[Bool_Prio_Out]) then
begin
Me.Integers[Int_DrinkDoses] := 3+Random(12);
T[Timer_WaitPot].start;
Me.Booleans[Bool_Prio_Pot] := True;
Me.Integers[Int_Prio_TimeTillPot] := 1000*Random(30);
Debug('drink_Potions', 'Int_DrinkDoses: ' + ToStr(Me.Integers[Int_DrinkDoses]) + ' - Time to pot: ' + msToTime(Me.Integers[Int_Prio_TimeTillPot], TIME_SHORT) + ' -> POT_Prio := True', '');
end;

{If Prio_Pot then}
If (Me.Booleans[Bool_Prio_Pot])and(T[Timer_WaitPot].timeElapsed() > Me.Integers[Int_Prio_TimeTillPot])then
begin
Debug('drink_Potions', 'Bool_Prio_Pot := False', '');
Me.Booleans[Bool_Prio_Pot] := False;
For t_Int:=1 to Me.Integers[Int_DrinkDoses] do
If Not Me.Booleans[Bool_Prio_Out] then
begin
flickPrayer;
Me.Booleans[Bool_Prio_Out] := (Not InteractInv(Me.Integers[Int_Player_PrioStart], Me.Integers[Int_Player_PrioEnd], 'rink'));
Wait(700+Random(500));
end;

If Me.Booleans[Bool_Prio_Out] then
Debug('drink_Potions', 'Out of absorption potions', '')
else
beHuman(afterClick);
end;
end;

function outside_NMZ: boolean;
var
I: Integer;
S: String
begin
For I:=8 downto 1 do
begin
S := getChatBoxText(I, 0);
If (S = '')then
Continue;

Result := (Pos('wake up feeling', S) > 1)
If Result then
Exit;
end;
end;

procedure Disconnected;
begin
If (Disconnect)or(isLoggedIn) then
begin
Debug('Disconnected', 'Seems like we re-connected', 'Ending timer');
Disconnect := False;
end;

If (Not isLoggedIn)and(Not Disconnect)then
begin
Debug('Disconnected', 'Not LoggedIn', 'Starting timer in case of reconnect');
Disconnect := True;
T[Timer_Disconnect].start;
end;

If (Disconnect)and(T[Timer_Disconnect].timeElapsed > 8000)then
begin
Debug('Disconnected', 'We have waited for 8 secs being logged out', 'Logging out/Terminate');
TerminateScript;
end;
end;

function findPowerUp: boolean;
var
I, H: Integer;
Colors, PS: TIntegerArray;
TPA, tTPA: TPointArray;
ATPA: T2DPointArray;
Boxes: TBoxArray;
begin
If Not IsLoggedIn then
Exit;

Colors := [8073615, 7876236, 9184925];
For I:=0 to 2 do
if FindColorsTolerance(tTPA, Colors[I], MSX1, MSY1, MSX2, MSY2, 10)then
TPA := CombineTPA(TPA, tTPA);

If Length(TPA) = 0 then
Exit;

ATPA := TPAtoATPA(TPA, 30);
H := High(ATPA);
For I:=0 to H do
begin
Inc(C);
SetLength(Boxes, C);
Boxes[C-1] := PointToBox(MiddleTPA(ATPA[I]), 10);
end;
OS_SMART.__Graphics.DrawBoxes(Boxes, clRed, False);

PS := pixelShiftMulti(Boxes, 400);
H := High(PS);
For I:=0 to H do
If PS[I] > 0 then
begin
mouse(MiddleBox(Boxes[I]), 0, 0, MOUSE_MOVE);
If waitUptext('apper', 200+Random(100))then
begin
Debug('findPowerUp', 'Found', 'PixelShift: ' + ToStr(PS[I]));
Case Random(4)of
0:
begin
fastClick(mouse_Right);
Result := waitOption('ctivate', 300+Random(100));
end;

1..3:
begin
fastClick(mouse_Left);
Result := didClick(True, 500+Random(250));
end;
end;
If Result then
Exit;
end;
end;
end;

begin
initAL;
SetLength(Me.Integers, 100);
SetLength(Me.Strings, 100);
SetLength(Me.Booleans, 100);


LoadINI;
ShowForm();
SaveFormINI;

If Not RunNMZ then
begin
Writeln('[Form] Exit form -> Script terminate');
TerminateScript;
end;

PrintSetup;
Debug('Mainloop', 'Entering loop', '');
repeat
drink_Potions;
flickPrayer;
beHuman(antiBan);
mightOffScreen;
Disconnected;
//findPowerUp;
until(outside_NMZ);


Debug('Mainloop', 'We woke from our dream', 'LoggedIn: ' + ToStr(isLoggedIn) + ' - outside_NMZ: ' + ToStr(outside_NMZ));
If Me.Booleans[Bool_Player_Logout] then
logoutPlayer;
end.

{
END OF NIGHTMARE ZONE CODE
}

TomTuff

2014-11-04 16:10:01

I doub you'll be accepted without a script made with the official SRL include.

Fitta

2014-11-04 16:51:29

From: TomTuff
I doub you'll be accepted without a script made with the official SRL include.


OSRS include is half broken.. I can write a script for it, but it won't work too good. If it's just for the show, converting this script into OSSRL will take about ~5 minutes!

Wetish

2014-11-04 16:53:39

I've got a bunch of other scripts too, but this one is the most recent!


Could you show us some of your other scripts? This one only has one use of TPAs. I'd like to see more of your work.

Fitta

2014-11-04 17:00:17

I don't fond DTM's for item detection, as there's easier way for it. See @ countInvSpot_Outline

Fletcher which got me to 99 fletching :)
program Le_sexyFletcher;
{$define smart}
{$i AeroLib/AeroLib.Simba}

const
Version = '0.5';

PICK_BANKCOLOR = 5731455;
PICK_TOL = 15;
XP_PER = 59;
LIMIT = 10000;

INPUT_YES = 6;
INPUT_NO = 7;
INPUT_CANCEL = 2;

OUTLINE_LOGS = 85;
OUTLINE_KNIFE = 60;
OUTLINE_LONGBOW = 68;

var
GLOBAL_HOVERBANK: Boolean;
GLOBAL_DONE, GLOBAL_LVLS: Integer;

Procedure SetupScript;
var
Info_s: String;
action: integer;
begin
If FileExists(ScriptPath + 'playersetup.ini')then
begin
Me.Name := ReadINI('playersetup', 'username', ScriptPath + 'playersetup.ini');
Me.Pass := ReadINI('playersetup', 'password', ScriptPath + 'playersetup.ini');
Me.Pin := ReadINI('playersetup', 'bankpin', ScriptPath + 'playersetup.ini');
action := MessageBox('Do you wish to use player ' + Me.Name, 'Player setup', 3);
end else
action := INPUT_NO;

Case action of
INPUT_YES: warn('Using player ' + Me.Name, WT_CORE);
INPUT_NO:
begin
InputQuery('Player setup', 'Username', Me.Name);
InputQuery('Player setup', 'Password', Me.Pass);
InputQuery('Player setup', 'Bankpin', Me.Pin);
WriteINI('playersetup', 'username', Me.Name, ScriptPath + 'playersetup.ini');
WriteINI('playersetup', 'password', Me.Pass, ScriptPath + 'playersetup.ini');
WriteINI('playersetup', 'bankpin', Me.Pin, ScriptPath + 'playersetup.ini');
end;
INPUT_CANCEL:
begin
warn('You choose to cancel, terminating script.', WT_SCRIPT);
TerminateScript;
end;
end;

If (Me.Name = '')then
begin
warn('No player info detected, terminating script..', WT_SCRIPT);
TerminateScript;
end;

Me.Active := True;
end;

Procedure DebugIt(S: String);
begin
warn(S + ' [LoggedIn]: ' + BoolToStr(isLoggedIn), WT_SCRIPT);
end;

procedure Fail(FailedAT: String);
begin
DebugIt('Failed: ' + FailedAT);
closeInterface;
logoutPlayer;
end;

function Hover_OptionMulti(Texts: TStringArray): Boolean;
var
B : TBox;
T : Timer;
i,X,Y,ms,
R,x2,y2 : Integer;
Options : array of TOptions;
begin
Options := getOptions();
if (Length(Options) < 1) then
Exit(False);
ms := MouseSpeed;
MouseSpeed := RandomRange(13,17);

for i:=0 to high(Options) do
begin
if ArrInStr(Texts, Options[i].Str) then
begin
B := Options[i].Bounds;
getMousePos(x2, y2);
R:= Min(((B.X2 - B.X1) shr 1), 5);
if not pointInBox(Point(x2,y2), B) then
mouseBox(B.x1+R, B.Y1, B.x2-R, B.Y1+5, R, MOUSE_MOVE)
else
fastClick(MOUSE_MOVE);

MouseSpeed := ms;
Exit(True);
end;
end;

exitMenu;
MouseSpeed := ms;
end;

function Hover_waitOptionMulti(S: TStringArray; Time: Integer): Boolean;
var
T : Timer;
begin
Result := False;
T.start();
while (T.timeElapsed() < Time) do
begin
if Hover_OptionMulti(S) then
Exit(True);
Wait(20 + Random(10));
end;
end;

function MouseOnScreen: boolean;
var
x, y: integer;
begin
GetMousePos(x, y);
Result := PointInBox(Point(x, y), IntToBox(0, 0, 760, 500));
end;

procedure Handle_MouseOffScreen;
begin
If MouseOnScreen then
MMouseOffClient('rand');
end;

procedure Handle_MightOffScreen;
begin
If Random(5) = 0 then
Handle_MouseOffScreen;
end;

Procedure CMHere(mousetype: integer);
var
x, y: Integer;
begin
GetMousePos(x, y);
Mouse(Point(x, y), 0, 0, mousetype);
end;

function didLevel: boolean;
begin
Result := CountColor(0, 181, 405, 366, 424) = 368;
end;

function interface_Fletch: boolean;
begin
Result := CountColor(128, 151, 361, 364, 382) = 408;
end;

function interface_EnterAmount: boolean;
begin
Result := (CountColor(0, 209, 391, 308, 409) = 277);
end;

function countInvSpot_Outline(inv: integer): integer;
var
CurBox: TBox;
begin
GameTab(TAB_INV);
CurBox := invBox(inv);
Result := (CountColor(65536, CurBox.X1, CurBox.Y1, CurBox.X2, CurBox.Y2));
end;

function countInv_Index(count_Outline: Integer): integer;
var
I: Integer;
CurBox: TBox;
begin
If Not isLoggedIn then
Exit;

For I:=1 to 28 do
If countInvSpot_Outline(I) = count_Outline then
Inc(Result);
end;

function find_KnifeSpot: Integer;
var
I: Integer;
begin
gameTab(TAB_INV);

For I:=1 to 28 do
If countInvSpot_Outline(I) = OUTLINE_KNIFE then
Break;

If I = 29 then
Result := -1
else
Result := I;

DebugIt('Found knife spot ' + ToStr(I));
end;

function Handle_PairItems: boolean;
var
Timer: double;
begin
If Not isLoggedIn then
Exit;

If interface_Fletch then
begin
Result := True;
Exit;
end;

If Not interactSlot(find_KnifeSpot, MOUSE_LEFT)then
begin
Fail('Handle_Fletch - KnifeSpot');
Exit;
end;

Wait(20+Random(300));

Case CountInv_Index(OUTLINE_LOGS) of
1..26:
interactSlot(28, mouse_left);

27:
Case Random(10)of
0..5: interactSlot(2, MOUSE_LEFT);
6..8: interactSlot(5, MOUSE_LEFT);
9: interactSlot(6, MOUSE_LEFT);
end;

end;
DebugIt('Found items, waiting for interface');
TObjTime.Mark(Timer);
While (TObjTime.Ellapsed(Timer) < 2000)and(interface_Fletch = False) do
Wait(50+Random(200));

DebugIt('Out of interface loop');
Result := interface_Fletch;
DebugIt('Interface fletch > ' + ToStr(Result));
end;

function handle_FletchInterface: boolean;
begin
If Not interface_Fletch then
Exit;

Wait(150+Random(200));
MouseBox(209, 383, 299, 441, 20, mouse_Right);
Result := waitOption('Make X', 500+Random(400));
If Not Result then
DebugIt('Make X? FletchInterface')
else
begin
Handle_MightOffScreen;
If Not WaitFunc(@interface_EnterAmount, 100, 1500)then
begin
fail('no Enter Amount?');
Result := False;
Exit;
end;
Handle_MightOffScreen;
typeSend(intToStrEx(RandomRange(27, 100)), True);
Handle_MightOffScreen;
end;
end;

function hover_PestControlBank: boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I: Integer;
P: TPoint;
begin
If Not isLoggedIn then
Exit;

Result := (IsUpText('Bank Bank Booth')or(menuOpen));
If Result then
Exit;

FindColorsSpiralTolerance(MSCX, MSCY, TPA, PICK_BANKCOLOR, MSCX-50, MSCY, MSCX+50, MSCY+50, PICK_TOL);

ATPA := TPAtoATPAEx(TPA, 25, 8);
SortATPASize(ATPA, True);
SortATPAFromMidPoint(ATPA, point(MSCx,MSCy+50));

If Length(ATPA) = 0 then
Exit;

For I:=0 to High(ATPA)do
begin
P := MiddleTPA(ATPA[I]);
mouse(Point(P.X, P.Y-8), 5, 5, MOUSE_MOVE);
If waitUptext('Bank Bank booth', 100+Random(200))then
begin
DebugIt('Bank found');
Case Random(5) of
0: CMHere(mouse_move);
1..4:
begin
CMHere(mouse_right);
Hover_waitOptionMulti(['Bank Bank booth'], 300+Random(500));
end;
end;
Result := True;
Exit;
end;
end;
end;

Procedure Progress;
begin
Writeln('[Script] ' + Version + ' Time: ' + ToStr(MSToTime(GetTimeRunning, TIME_SHORT)) + ' / Done: ' + ToStr(GLOBAL_DONE) + ' / XP: ' + ToStr(GLOBAL_DONE*XP_PER) + ' / Lvls: ' + ToStr(GLOBAL_LVLS));
end;

Procedure wait_Fletching;
var
at_Logs: Integer;
Hover: Boolean;
begin
If Not isLoggedIn then
Exit;

Handle_MightOffScreen;
Progress;
If GLOBAL_HOVERBANK then
begin
at_Logs := RandomRange(1, 15);
DebugIt('Will hover bank at ' + ToStr(at_Logs));
end;

repeat
Wait(150+Random(200));

If not Hover then
Handle_MouseOffScreen;

If ((GLOBAL_HOVERBANK) and (CountInv_Index(OUTLINE_LOGS) = at_Logs) and (Hover = False)) then
begin
DebugIt('Time to hover bank..');
Hover := True;
If Not hover_PestControlBank then
begin
DebugIt('Failed to hover bank');
GLOBAL_HOVERBANK := False;
end;

end;
until(Not isLoggedIn)or(CountInv_Index(OUTLINE_LOGS) = 0)or(didLevel);

If didLevel then
begin
DebugIt('Lvl''d');
Inc(GLOBAL_LVLS);
If Random(5) = 0 then
begin
ClickToContinue;
ClickToContinue;
end;
GLOBAL_HOVERBANK := False;
Exit;
end;

If GLOBAL_HOVERBANK then
begin
DebugIt('Done fletching, already hovering');
If (menuOpen) then
begin
CMHere(Mouse_LEFT);
DebugIt('Waiting for bank..');
waitFunc(@isBankOpen, 100+Random(100), RandomRange(2000, 3000));
end else
DebugIt('Hovering failed..');
end;

GLOBAL_HOVERBANK := False;
end;

function find_PestControlBank: boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I: Integer;
P: TPoint;
begin
If Not isLoggedIn then
Exit;

Result := isBankOpen;
If Result then
Exit;

FindColorsSpiralTolerance(MSCX, MSCY, TPA, PICK_BANKCOLOR, MSCX-50, MSCY, MSCX+50, MSCY+50, PICK_TOL);

ATPA := TPAtoATPAEx(TPA, 25, 8);
SortATPASize(ATPA, True);
SortATPAFromMidPoint(ATPA, point(MSCx,MSCy+50));

If Length(ATPA) = 0 then
Exit;

For I:=0 to High(ATPA)do
begin
P := MiddleTPA(ATPA[I]);
mouse(Point(P.X, P.Y-8), 5, 5, MOUSE_MOVE);
If waitUptext('Bank Bank', 100+Random(200))then
begin
DebugIt('Bank found');
CMHere(mouse_left);
Result := waitFunc(@isBankOpen, 100+Random(100), 3000);
Exit;
end;
end;
end;

Procedure Handle_Bank;
var
C: Integer;
begin
repeat
Inc(C);
until(C > 4)or(find_PestControlBank);

If C > 4 then
begin
Fail('Failed opening bank');
Exit;
end else
DebugIt('Opened bank in ' + ToStr(C) + ' try(ies)');

DebugIt('Depositing items..');
IncEx(GLOBAL_DONE, countInv_Index(OUTLINE_LONGBOW));
depositAllFrom(2);


DebugIt('Withdrawing items..');
if not withdrawPointEx(Point(426, 100), 0, ['aple'])then
begin
fail('withdrawpointEx');
Exit;
end;

DebugIt('Closing interface..');
closeInterface;
Wait(250+Random(500));
end;

Procedure SetupPlayer;
begin
setupBreak(200, 50, 200, 200);
compassMovement(0, 0, False);
SetAngle(ANGLE_HIGH);
end;

begin
initAL();
SetupScript;
If Not isLoggedIn then
begin
DebugIt('Player ' + Me.Name + ' loginPlayer');
loginPlayer(True);
end;
SetupPlayer;

Repeat
If Random(12) = 0 then
GLOBAL_HOVERBANK := True;

If CountInv_Index(OUTLINE_LOGS) > 0 then
begin
DebugIt('Logs > 0');
Handle_PairItems;
If Handle_FletchInterface then
wait_Fletching;
end;

If CountInv_Index(OUTLINE_LOGS) = 0 then
begin
DebugIt('Logs = 0');
Handle_Bank;
end;

{If breakHandler then
SetupPlayer;}

until(Me.Active = False)or(GLOBAL_DONE > LIMIT)or(not isLoggedIn);
If isLoggedIn then
begin
Progress;
DebugIt('We are done for today :)');
end;
end.


Woodcutter
{

[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]

[#] Dyslectic Scripts - Human-like Wcer, Willows&Draynor [#]
Made and maintained by FITTA
[#] [#]

[#] Cuts the trees in Draynor Village in Old-School runescape and [#]
banks the logs.
[#] [#]

[#] Thread for this script [#]

[#] [#]
Setup lines: 70-112
[#] [#]

[#] HAPPY BOTTIN' <3 [#]

[#] [#]

[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]



Example of progress report follows..

[Progress]
[Dyslectic Scripts - Human-like Wcer, Willows&Draynor]
By FITTA v1.0

Time running: 03h 03m 18s
Breaking in: 02h 45m 42s
Breaking for: 01h 00s
Total Logs: 1176
Total Lvls: 1
Total XP: 79717
Total Trips: 42
Total Breaks: 1

[Progress]

}

program WillowFITTA;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
{$I SRL-OSR\SRL\misc\SmartGraphics.simba}

{Don't change anything under this line}
const
STARTXP = 0;
STARTLVL = 1;
CURXP = 2;
CURLVL = 3;
TRIPS = 4;
LOGS = 5;
BREAKSTAKEN = 6;
TREECOUNT = 5;
Version = '1.0';
{Don't change anything above this line}

var
BreakAt, BreakTime, BreakTimer, BreaksUntilOverNight: Integer;
TakeBreaks, OverNightBreaks: Boolean;

{
[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]

[#] Dyslectic Scripts breaking system setup [#]

[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]}
Procedure SetBreaks;
begin
TakeBreaks := True; {True = Will take breaks / False = Will not take breaks}
OverNightBreaks := True; {True = Take long breaks / False = Will not take long breaks}
{Over night breaks only work in singleplayer}

BreakAt := RandomRange(30, 70); {Minutes range (minimum, maximum) until changeplayer/break}
BreakTime := RandomRange(Round(BreakAt div 3), Round(BreakAt div 2)); {Minutes it will break for}


If BreaksUntilOverNight = 0 then {DO NOT CHANGE THIS LINE(82)}
BreaksUntilOverNight := RandomRange(3, 4); {How many regular breaks until we take a really big one?}
end;
{
[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]
}


{
[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]

[#] PLAYER SETUP [#]

[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]}
procedure DeclarePlayer;
begin
SetBreaks;
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Member := True;

end;

{
[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]

[#] END OF PLAYER SETUP [#]

[#] RUN THE SCRIPT & HAPPY BOTTIN [#]

[#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#]}



type
Tree = record
ID: Integer; {ID when tree is alive}
Tile: TPoint; {Tile from which the ID will be taken}
end;
TTreeArray = Array of Tree; {Array of the trees}

var
Trees: TTreeArray;
CurrentTreeIndex: Integer;

Procedure SetupTrees;
begin
SetLength(Trees, TREECOUNT);

Trees[0].ID := 11763;
Trees[0].Tile := Point(3083, 3237);

Trees[1].ID := 11759;
Trees[1].Tile := Point(3085, 3235);

Trees[2].ID := 11755;
Trees[2].Tile := Point(3088, 3234);

Trees[3].ID := 11759;
Trees[3].Tile := Point(3087, 3231);

Trees[4].ID := 11761;
Trees[4].Tile := Point(3088, 3227);
end;

Procedure CMHere(left: Boolean);
var
x, y: Integer;
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, left);
end;

Procedure DrawAtPoint(P: TPoint);
begin
SMART_ClearCanvas;
SMART_DrawBox(IntToBox(P.X-20, P.Y-20, P.X+20, P.Y+20));
end;

function TreeToMS(Tile: TPoint): TPoint;
var
X, Y, Height: Integer;
begin
X := Round((Tile.X - (SmartGetFieldInt(SmartCurrentTarget, 0, client_baseX) * client_baseX_Multiplier) + 1.0) * 128);
Y := Round((Tile.Y - (SmartGetFieldInt(SmartCurrentTarget, 0, client_baseY) * client_baseY_Multiplier) + 1.0) * 128);
Height := R_GetTileHeight(Tile);
Result := R_TileToMSEx(X, Y, Height);
if (not PointInBox(Result, MSBox)) then
Result := Point(-1, -1);
end;

function TreeOnMS(tile: TPoint): boolean;
begin
Result := (PointInBox(TreeToMS(tile), IntToBox(MSX1, MSY1, MSX2, MSY2)));
end;

function r_TileOnMS(tile: TPoint): Boolean;
begin
Result := (PointInBox(r_TileToMS(tile), IntToBox(MSX1, MSY1, MSX2, MSY2)));
end;

Procedure DB(S: String);
begin
Writeln('[SCRIPT] ' + S + ' [TimeStamp]: ' + timeRunning);
end;

procedure Fail(FailedAT: String);
begin
DB('Failed: ' + FailedAT);
//logOut;
end;

function r_IsWC: boolean;
begin
Result := R_GetAnimation > 700;
end;


function MouseOnScreen: boolean;
var
x, y: integer;
begin
GetMousePos(x, y);
Result := PointInBox(Point(x, y), IntToBox(0, 0, 760, 500));
end;

procedure Handle_MouseOffScreen;
begin
If MouseOnScreen then
MMouseOffClient('rand');
end;

procedure RandomizeActions;
begin
If Not LoggedIn then
Exit;

Case Random(1000)of
0: GameTab(TAB_INV);
1: GameTab(TAB_STATS);
3..100: Handle_MouseOffScreen;
101..106: compassMovement(0, 360, False);
end;


end;

procedure Handle_AfterClick;
begin
Case Random(8) of
0,1: Handle_MouseOffScreen;
2,3: SleepAndMoveMouse(200+Random(2000));
4: MakeCompass(Random(361));
5..7: Wait(100+Random(200));
end;
end;

Procedure WaitWhileWalking;
begin
Handle_AfterClick;
Repeat
Wait(200+Random(300));
RandomizeActions;
Until(Not R_IsWalking);
end;

function TreeExists(index: Integer): boolean;
var
Tree: TRSObject;
begin
Tree := R_GetObjectAt(0, Trees[Index].Tile);
Result := (Tree.ID = Trees[Index].ID);
end;

function ClickTree(Index: Integer): boolean;
var
P: TPoint;
begin
If (Not TreeOnMS(Trees[Index].Tile))or(Not TreeExists(Index))then
begin
DB('ClickTree: Tree not on MS');
Exit;
end;

P := TreeToMS(Trees[Index].Tile);
DrawAtPoint(P);

MouseBox(P.X-20, P.Y-20, P.X+20, P.Y+20, MOUSE_Move);

Case Random(5)of
0:
begin
CMHere(False);
Result := WaitOption('Chop', 200+Random(200));
end;

1..4:
begin
Result := IsUpText('Chop');
If Result then
CMHere(True);
end;
end;

If Result then
begin
CurrentTreeIndex := Index;
DrawAtPoint(TreeToMS(Trees[CurrentTreeIndex].Tile));
Handle_AfterClick;
DrawAtPoint(TreeToMS(Trees[CurrentTreeIndex].Tile));
end;
end;

function getRandomIndex(CurIndex: Integer): Integer;
begin
Result := Random(TREECOUNT);
while (Result = CurrentTreeIndex)or(Result = CurIndex) do
Result := Random(TREECOUNT);
end;

function getClosestIndex: integer;
var
TreeTiles: TPointArray;
I, II: Integer;
begin
SetLength(TreeTiles, TREECOUNT);

For I:=0 to TREECOUNT-1 do
TreeTiles[I] := Trees[I].Tile;

SortTPAFrom(TreeTiles, R_GetTileGlobal);

For I:=0 to TREECOUNT-1 do
For II:=0 to TREECOUNT-1 do
If (TreeTiles[I].X = Trees[II].Tile.X) and (TreeTiles[I].Y = Trees[II].Tile.Y)then
begin
DB('Index ' + ToStr(II) + ' is the tree tile');
If Not TreeExists(II)then
begin
DB('Index ' + ToStr(II) + ' tree is down');
Continue;
end;
Result := II;
Exit;
end;
end;

Function FindTree: boolean;
var
Tries, TempInd: Integer;
begin
DB('FindTree executed');
repeat
TempInd := getClosestIndex;
Result := ClickTree(TempInd);

If Not Result then
begin
Inc(Tries);
If Not TreeOnMS(Trees[TempInd].Tile)then
begin
DB('Tree is not on MS, walking towards it');
r_WalkPathEx([Trees[TempInd].Tile], False, 0);
WaitWhileWalking;
end else
MakeCompass(Random(361));
end;


until(Result)or(Tries > 10)or(Not LoggedIn);

If Tries > 10 then
begin
Fail('FindTree > 10 fails');
Exit;
end;

If Result then
begin
CurrentTreeIndex := TempInd;
WaitWhileWalking;
end;
end;

Procedure WaitWC;
begin
If Not LoggedIn then
Exit;

DB('WaitWC executed');
Repeat
RandomizeActions;
DrawAtPoint(TreeToMS(Trees[CurrentTreeIndex].Tile));
//Writeln('LoggedIn: ' + ToStr(LoggedIn) + ' - TreeExists: ' + ToStr(TreeExists(CurrentTreeIndex)) + ' - WC ' + ToStr(r_IsWC) + ' - Index: ' + ToStr(CurrentTreeIndex));
Wait(100+Random(100));
Until(Not LoggedIn)or(Not TreeExists(CurrentTreeIndex)or(not r_IsWC));
SMART_ClearCanvas;
DB('WaitWC Out of loop');
If Not MouseOnScreen then
Wait(100+Random(4000));
end;

function InteractBankWait(Tile: TPoint; Timeout: Integer): Boolean;
var
i: Integer;
begin
Result:= false;
i := GetSystemTime;
repeat
R_MouseTile(Tile, 15, 15, MOUSE_Move);
DrawAtPoint(R_TileToMS(Tile));
Case Random(4)of
0:
begin
CMHere(False);
Result := WaitOption('Bank Bank booth', 150+Random(200));
end;

1..3:
begin
Result := WaitUpText('Bank ', 250+Random(200));
If Result then
CMHere(True);
end;

end;
until (((GetSystemTime - i) > Timeout) or (Result));
end;

Function myOpenBank: boolean;
var
BankBoothTiles: TPointArray;
Tries, CurInd: Integer;
P: TPoint;
begin
BankBoothTiles := [Point(3091, 3245), Point(3091, 3243), Point(3091, 3242)];
repeat
CurInd := Random(3);
If Not r_TileOnMS(BankBoothTiles[CurInd])then
begin
DB('Bank booth not on MS, walking towards it');
r_WalkPathEx([BankBoothTiles[CurInd]], False, 0);
WaitWhileWalking;
end;

Result := InteractBankWait(BankBoothTiles[CurInd], 4000);
Inc(Tries);
If Result then
begin
SMART_ClearCanvas;
WaitWhileWalking;
Wait(100+Random(200));
Result := BankScreen;
end;
until(BankScreen)or(Not LoggedIn)or(Tries > 6);
If Tries > 6 then
Result := False;
end;

function handle_BankMission: boolean;
begin
DB('In bank -> open bank');

If not myOpenBank then
begin
Fail('myOpenBank');
Exit;
end;

IncEx(Players[CurrentPlayer].Integers[LOGS], InvCount);
DB('Bank open -> Deposit');
Case Random(10)of
0, 1: Deposit(1, 28, True);
2: Deposit(1, 28, RandomRange(28, 100));
3..9: MouseBox(429, 297, 457, 326, Mouse_LEFT);
end;

If Random(5) = 0 then
CloseBank;

Inc(Players[CurrentPlayer].Integers[Trips]);
Result := True;
end;

Procedure Bank;
var
WalkArray: TPointArray; {[0] = Inside bank}
begin
WalkArray := [Point(3093, 3243), Point(3086, 3234)];

DB('Walk to bank');
If r_WalkPathEx(WalkArray, True, 0) then
WaitWhileWalking
else
begin
Fail('Failed walking to bank');
Exit;
end;

If Not handle_BankMission then
Exit;

DB('Back to the field..');
If r_WalkPathEx(WalkArray, False, 0) then
WaitWhileWalking
else
begin
Fail('Failed walking to bank');
Exit;
end;

end;

Procedure SetupPlayer;
begin
If R_GetCameraZ > -1250 then
begin
Writeln('Camera is too low');
SetAngle(SRL_ANGLE_HIGH);
end;

If Players[CurrentPlayer].Integers[STARTXP] = 0 then
begin
Players[CurrentPlayer].Integers[STARTXP] := R_GetSkillExp(SKILL_WOODCUTTING);
Players[CurrentPlayer].Integers[STARTLVL] := R_GetMaxSkillLevel(SKILL_WOODCUTTING);
DB('Start XP: ' + ToStr(Players[CurrentPlayer].Integers[STARTXP]) + ' / LVL: ' + ToStr(Players[CurrentPlayer].Integers[STARTLVL]));
end;

end;

Procedure Progress;
var
I, TotalCuts, TotalLvls, TotalXP, TotalTrips, TotalBreaks: Integer;
begin
Writeln('[Progress]');
Writeln(' [Dyslectic Scripts - Human-like Wcer, Willows&Draynor]');
Writeln(' By FITTA v' + Version);
Writeln('');
Writeln(' Time running: ' + msToTime(GetTimeRunning, TIME_SHORT));
If BreakAt*60*1000 > TimeFromMark(BreakTimer) then
begin
Writeln(' Breaking in: ' + msToTime(BreakAt*60*1000-TimeFromMark(BreakTimer), TIME_SHORT));
If (BreaksUntilOverNight = Players[CurrentPlayer].Integers[BREAKSTAKEN]+1)and(OverNightBreaks)then
Writeln(' Next break we will go to sleep.')
else
Writeln(' Breaking for: ' + msToTime(BreakTime*60*1000, TIME_SHORT));
end;

If HowManyPlayers > 1 then
begin
For I:=0 to HowManyPlayers-1 do
begin
IncEx(TotalCuts, Players[I].Integers[LOGS]);
IncEx(TotalLvls, Players[I].Integers[CURLVL]-Players[I].Integers[STARTLVL]);
IncEx(TotalXP, Players[I].Integers[CURXP]-Players[I].Integers[STARTXP]);
IncEx(TotalTrips, Players[I].Integers[TRIPS]);
IncEx(TotalBreaks, Players[I].Integers[BREAKSTAKEN]);
end;

Writeln(' Total Logs: ' + ToStr(TotalCuts));
Writeln(' Total XP: ' + ToStr(TotalXP));
Writeln(' Total Lvls: ' + ToStr(TotalLvls));
Writeln(' Total Trips: ' + ToStr(TotalTrips));
Writeln(' Total Switches: ' + ToStr(TotalBreaks));
For I:=0 to HowManyPlayers-1 do
Writeln(' P[' + ToStr(I) + '] Logs: ' + ToStr(Players[I].Integers[LOGS]) + ' XP: ' + ToStr(Players[I].Integers[CURXP]-Players[I].Integers[STARTXP]) + 'Lvls: ' + ToStr(Players[I].Integers[CURLVL]-Players[I].Integers[STARTLVL]) + ' Trips: ' + ToStr(Players[I].Integers[TRIPS]));
end else
begin
Writeln(' Total Logs: ' + ToStr(Players[I].Integers[LOGS]));
Writeln(' Total Lvls: ' + ToStr(Players[I].Integers[CURLVL]-Players[I].Integers[STARTLVL]));
Writeln(' Total XP: ' + ToStr(Players[I].Integers[CURXP]-Players[I].Integers[STARTXP]));
Writeln(' Total Trips: ' + ToStr(Players[I].Integers[TRIPS]));
Writeln(' Total Breaks: ' + ToStr(Players[I].Integers[BREAKSTAKEN]));
end;

Writeln('');
Writeln('[Progress]');
end;

Procedure Handle_Breaks(TimeInMinutes: Integer);
var
TimeMark, TimeToBreak: Integer;
begin
If (BreaksUntilOverNight = Players[CurrentPlayer].Integers[BREAKSTAKEN])and(OverNightBreaks) then
begin
BreaksUntilOverNight := 0;
TimeToBreak := 1000*60*RandomRange(300, 550);
MarkTime(TimeMark);
end else
begin
TimeToBreak := 1000*60*TimeInMinutes;
MarkTime(TimeMark);
end;
repeat
ClearDebug;
Progress;
If (OverNightBreaks) and (BreaksUntilOverNight = 0)then
Writeln('[Over-Night Break]')
else
Writeln('[Break]');
Writeln(' Breaking for another: ' + MSToTime(TimeToBreak-TimeFromMark(TimeMark), Time_Short));
Wait(9000+Random(5000));

until(TimeFromMark(TimeMark) > TimeToBreak);
end;

Procedure CheckBreaks;
begin
If TimeFromMark(BreakTimer) > BreakAt*60*1000 then
begin
DB('TimeFromMark(BreakTimer) > BreakAt');
If PlayersActive > 1 then
begin
DB('Switching players!');
NextPlayer(True);
SetupPlayer;
SetBreaks;
end else
begin
Inc(Players[CurrentPlayer].Integers[BREAKSTAKEN]);
LogOut;
Handle_Breaks(BreakTime);
LoginPlayer;
SetupPlayer;
SetBreaks;
end;
MarkTime(BreakTimer);
end;
end;

begin
setupSRL();
SetupReflection;
SetupTrees;

DeclarePlayer;

If Not LoggedIn Then
LoginPlayer;

SetupPlayer;
MarkTime(BreakTimer);
Repeat
If Not LoggedIn then
begin
NextPlayer(False);
SetupPlayer;
end else
begin
Players[CurrentPlayer].Integers[CurXP] := R_GetSkillExp(SKILL_WOODCUTTING);
Players[CurrentPlayer].Integers[CurLVL] := R_GetMaxSkillLevel(SKILL_WOODCUTTING);
end;

CheckBreaks;

Progress;

If Not r_IsWC then
FindTree;

WaitWC;

If InvFull then
begin
DB('Inventory is full');
Bank;
end;
until(AllPlayersInactive);
end.

Ashaman88

2014-11-04 17:01:33

From: Fitta
OSRS include is half broken.. I can write a script for it, but it won't work too good. If it's just for the show, converting this script into OSSRL will take about ~5 minutes!


Using Aerolib should be fine - I'll evaluate your scripts when I get home tonight

Hoodz

2014-11-04 17:09:13

From: Ashaman88
Using Aerolib should be fine - I'll evaluate your scripts when I get home tonight


i agree with you there asha.

masterBB

2014-11-04 17:28:44

From: TomTuff
I doub you'll be accepted without a script made with the official SRL include.


We've been flexibel with that in the past before. Aerolib is a high quality SRL include, the user can show his/her abilities with that aswel. As long as the script itself is of a high enough level. I don't know what the official statement is on that, but I think it is OK.

e:
No time to judge your script, but what do you think of shortening the amount of constants?
  Edit_FKEY = 0;
Edit_PrioStart = 1;
Edit_PrioEnd = 2;
Edit_BoostStart = 3;
Edit_BoostEnd = 4;

to

type
EditIDs = (FKey, PrioStart, PrioEnd, BoostStart, BoostEnd);

You can acces them directly like:

writeln(PrioStart);

or through their type

writeln(EditIDs.PrioStart);

You can also get their position in the list with Ord(x)

writeln(Ord(EditIDs.PrioStart));

Gu3st...

2014-11-04 17:34:47

I've seen enough, this is a yes from me! :)

Fitta

2014-11-04 17:44:17

From: masterBB
We've been flexibel with that in the past before. Aerolib is a high quality SRL include, the user can show his/her abilities with that aswel. As long as the script itself is of a high enough level. I don't know what the official statement is on that, but I think it is OK.

e:
No time to judge your script, but what do you think of shortening the amount of constants?
  Edit_FKEY = 0;
Edit_PrioStart = 1;
Edit_PrioEnd = 2;
Edit_BoostStart = 3;
Edit_BoostEnd = 4;

to

type
EditIDs = (FKey, PrioStart, PrioEnd, BoostStart, BoostEnd);

You can acces them directly like:

writeln(PrioStart);

or through their type

writeln(EditIDs.PrioStart);

You can also get their position in the list with Ord(x)

writeln(Ord(EditIDs.PrioStart));


Woah, that was really usefull feedback! Is there a tutorial on this?

Edit: Is this exclusively in lape?

masterBB

2014-11-04 17:49:14

From: Fitta
Woah, that was really usefull feedback! Is there a tutorial on this?

Edit: Is this exclusively in lape?


Only the type.enummeral is.

type
EditIDs = (FKey, PrioStart, PrioEnd, BoostStart, BoostEnd); //Lape + PS

writeln(PrioStart); //Lape + PS

writeln(EditIDs.PrioStart); //Lape only

writeln(Ord(PrioStart)); //Lape + PS

http://wiki.freepascal.org/Enumerated_types

Fitta

2014-11-04 18:09:45

Thanks :)

Daniel

2014-11-05 01:15:12

Yes. Good luck! :)

Janilabo

2014-11-05 08:40:08

Your script looks good and I really like your attitude, so I voted yes.
Good luck!

slacky

2014-11-05 12:21:04

From: Janilabo
Your script looks good and I really like your attitude, so I voted yes.
Good luck!

Because that ^ guy voted yes, I had to vote yes as well.

However I don't see anything fancy in the scripts above, but hey.. what can we expect from a swedish guy ( @Fitta )… :p

Clarity

2014-11-05 15:02:16

Yes from me. The script is decent, but I particularly like the posts you've made around the forum, and, as previously mentioned, your attitude. Good luck! :)

Fitta

2014-11-05 16:24:38

From: slacky
Because that ^ guy voted yes, I had to vote yes as well.

However I don't see anything fancy in the scripts above, but hey.. what can we expect from a swedish guy ( @Fitta )… :p


Are you swedish?! Where you from?


Thanks for the feedback, really glad about the comments about my posts. Thank you guys!

Gu3st...

2014-11-05 16:35:07

From: slacky
However I don't see anything fancy in the scripts above, but hey.. what can we expect from a swedish guy ( @Fitta )… :p
Hah, same thought's I had ;) Swedes, eh?
@Fitta; He's norwegian (Location: Norway)

Turpinator

2014-11-05 21:57:31

Well, since @slacky; chickened out, ill do it.
[14:24:51] <slacky> I kinda wanted to ask Fitta (regarding his app) to tell me what TPAtoATPA does.
[14:25:55] <slacky> Well.. I already voted yes, so.. it would be pointless now


Soo. What does TPAtoATPA do? O_O (and a bit more than just 'it converts a tpa to an atpa')

i luffs yeww

2014-11-06 01:43:31

From: Turpinator
Well, since @slacky; chickened out, ill do it.


Soo. What does TPAtoATPA do? O_O (and a bit more than just 'it converts a tpa to an atpa')


Source:

{/\
Splits the TPA to boxes with sidelength Dist and results them as a T2DPointArray.
/\}

function TPAtoATPA(const TPA: TPointArray; Dist: Integer): T2DPointArray;
var
a, b, c, l: LongInt;
Found: Boolean;
begin
SetLength(Result, 0);
l := High(tpa);
c := 0;
for a := 0 to l do
begin
Found := false;
for b := 0 to c -1 do
if (Round(sqrt(Sqr(TPA[a].X - Result[b][0].X) + Sqr(TPA[a].Y - Result[b][0].Y))) <= Dist) then
begin
Found := True;
Break;
end;
if Found then
// if (b < c) then
begin
SetLength(Result[b], Length(Result[b]) + 1);
Result[b][High(Result[b])] := TPA[a];
end else
begin
SetLength(Result, c + 1);
SetLength(Result[c], 1);
Result[c][0] := TPA[a];
Inc(c);
end;
end;
end;

From Simba/Units/MMLCore/tpa.pas.

The Mayor

2014-11-06 01:46:01

Voted yes. Hopefully you can bring some life back to the OSR section!

slacky

2014-11-06 05:18:51

From: i luffs yeww
Source:

...

err…
You are really missing the point of the question. The question was aimed at fitta, since fitta uses it in his script, and my guess was that he uses it without truly knowing what it does/what it spits out.

Fitta

2014-11-06 06:50:06

TPAToATPA makes all points in that area(given dist) into one ATPA[*]in a circle fashion.
We can then use our ATPA[*]with MiddleTPA for example, to get the middle of the circle(all TPoint's in the array).

I could paint pictures but my paint skills wouldn't stand in my favor..

rj

2014-11-10 20:37:11

Voted yes based off what other members have said, I don't have a members account to test this or anything but I did look at the form and it looks nice! It could be a little bit bigger though

Fitta

2014-11-11 18:43:58

From: Robert
Voted yes based off what other members have said, I don't have a members account to test this or anything but I did look at the form and it looks nice! It could be a little bit bigger though


Thanks for the feedback!

It started out being huge until I started it up on my VM(800x600), I should prob redo-think the form a bit though as you're right, might even throw in some bitmaps!

Gu3st...

2014-11-14 12:08:04

18 Yes, 4 No. In?

Ashaman88

2014-11-14 12:10:40

In indeed should be !

The Mayor

2014-11-14 15:41:49

@Daniel; @Coh3n;

King

2014-11-14 20:22:20

I just dropped by to see how the world of SRL was going, saw the application and decided to read through. The script is decent, I do not see why using Aerolib should be a problem. Based on just the script alone, I don't know if it demonstrates a broad enough range of knowledge for me, however your attitude really won me over. Voted yes after reading your posts!

Daniel

2014-11-17 00:15:00

Promoted.

Congratulations! :)