SRL Archive - First Scripts

Triax's AutoFletcher


triax

2008-11-04 12:29:01

For the folks that are confused: This is my script and it's linked to http://www.sythe.org/showthread.php?t=493264. I'm the same person as snappie so don't call me a script stealer ;)

Just read the Description and you will be able to setup it yourself.

Please post proggies.


program AutoFletcher

{.include SRL/SRL.scar}
{############################ Description. READ! ##############################)
(## Version: 0.1 ##)
(## Created by: Snappie1000 ##)
(## ##)
(## Requiments: Knife in first inventory slot and 27 logs in the other 27 ##)
(## slots and some logs in first bank slot ##)
(## ##)
(## Futher information: ##)
(## At line 23 you will find "Bank = '';. Here you have to enter in which ##)
(## bank you are. Fill in one with of the following commands: ##) ##)
(## 'feb' (Falador East Bank) ##)
(## 'fwb' (Falador West Bank) ##)
(## 'veb' (Varrock East Bank) ##)
(## 'vwb' (Varrock West Bank) ##)
(## 'db' (Draynor Bank) ##)
(## 'akb' (Al-Kharid Bank) ##)
(##############################################################################}

const
Bank2 = 'veb'; //Check description for futher information
Loads2= 10;

{########### Don't change this except when you know what your doing ###########}
var
x, y, LoadsDone, LogsCut : Integer;
frmDesign : TForm;
Label1 : TLabel;
Label2 : TLabel;
Label3 : TLabel;
username : TEdit;
password : TEdit;
nickname : TEdit;
start : TButton;


procedure ButtonClick(sender: TObject);
begin
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;

procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 480;
frmDesign.Top := 180;
frmDesign.Width := 400;
frmDesign.Height := 200;
frmDesign.Caption := 'Snappie''s AutoFletcher';
frmDesign.Color := clBlack;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
username := TEdit.Create(frmDesign);
username.Parent := frmDesign;
username.Left := 20;
username.Top := 28;
username.Width :=170 ;
username.Height := 17;
username.TabOrder := 8;
username.Text := '';
password := TEdit.Create(frmDesign);
password.Parent := frmDesign;
password.Left := 20;
password.Top := 78;
password.Width := 170;
password.Height := 17;
password.TabOrder := 9;
password.Text := '';
nickname := TEdit.Create(frmDesign);
nickname.Parent := frmDesign;
nickname.Left := 20;
nickname.Top := 128;
nickname.Width := 170;
nickname.Height := 17;
nickname.TabOrder := 10;
nickname.Text := '';
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 20;
Label1.Top := 10;
Label1.Width := 164;
Label1.Height := 10;
Label1.Caption := 'Username:';
Label1.Font.Color := clYellow;
Label1.Font.Height := -13;
Label1.Font.Name := 'Comic Sans MS';
Label1.Font.Style := [];
Label2 := TLabel.Create(frmDesign);
Label2.Parent := frmDesign;
Label2.Left := 20;
Label2.Top := 60;
Label2.Width := 164;
Label2.Height := 10;
Label2.Caption := 'Password:';
Label2.Font.Color := clYellow;
Label2.Font.Height := -13;
Label2.Font.Name := 'Comic Sans MS';
Label2.Font.Style := [];
Label3 := TLabel.Create(frmDesign);
Label3.Parent := frmDesign;
Label3.Left := 20;
Label3.Top := 110;
Label3.Width := 164;
Label3.Height := 32;
Label3.Caption := 'Nickname:';
Label3.Font.Color := clYellow;
Label3.Font.Height := -13;
Label3.Font.Name := 'Comic Sans MS';
Label3.Font.Style := [];
start := TButton.Create(frmDesign);
start.OnClick := @buttonclick;
start.Parent := frmDesign;
start.Left := 210;
start.Top := 28;
start.Width := 145;
start.Height := 120;
start.Caption := 'Start Fletching';
start.TabOrder := 12;
end;


procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;

procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := username.Text;
Players[0].Pass := password.Text;
Players[0].Nick := nickname.Text;
Players[0].Active := True;
end;


procedure AntiRandoms;
begin
FindNormalRandoms;
if FindFight then
RunAway('N', True, 1, 5000);
end;


procedure AntiBan;
begin
case random(20) of
0: PickUpMouse;
1: BoredHuman;
2: HoverSkill('Fletching', False);
3,4: begin
MakeCompass('N');
wait(10+random(5));
MakeCompass('S');
wait(10+random(5));
MakeCompass('N');
end;
end;
end;


procedure Fletch;
begin
if not LoggedIn then LoginPlayer;
wait(500+random(1000));
AntiRandoms;
MouseItem(1, true); // click knife
wait(500+random(1000));
MouseItem(2, true); // click log
wait(500+random(1000));
Mouse(214+random(94), 381+random(58), 1, 1, false) // click longbow
wait(500+random(1000));
ChooseOption('X');
Wait(500+random(1000));
AntiRandoms;
Case Random(10) of
0: TypeSend(AddMistakes('27', 20));
1: TypeSend(AddMistakes('27', 20));
2: TypeSend(AddMistakes('28', 20));
3: TypeSend(AddMistakes('29', 20));
4: TypeSend(AddMistakes('38', 20));
5: TypeSend(AddMistakes('39', 20));
6: TypeSend(AddMistakes('51', 20));
7: TypeSend(AddMistakes('60', 20));
8: TypeSend(AddMistakes('89', 20));
9: TypeSend(AddMistakes('99', 20));
end;
Writeln ('Fletching logs.');
Wait(500+random(1000));
AntiBan;
wait(51000+random(500));
end;


procedure GoBank;
begin
if not LoggedIn then Exit;
AntiRandoms;
LogsCut:=LogsCut+27;
LoadsDone:=Loadsdone+1;
Writeln ('######## Report #####################');
Writeln ('## Fletched: ' +IntToStr(LogsCut)+ ' log(s).');
Writeln ('## Fletched: ' +IntToStr(Loadsdone)+' load(s).');
Writeln ('## Ran for: ' +TimeRunning+'.');
Writeln ('#####################################');
OpenBankQuiet(bank2);
wait(500+random(1000));
if (BankScreen=false) then
begin
writeln('Couldn''t find bank, terminating script');
logout;
terminatescript;
end;
if (BankScreen=true) then
begin
Mouse(612, 232, 4, 4, false);
Wait(200+random(500));
ChooseOption('All');
Wait(200+random(500));
Mouse(51, 109, 4, 4, false);
Wait(200+random(500));
ChooseOption('X');
Wait(200+random(500));
Case Random(10) of
0: TypeSend(AddMistakes('27', 20));
1: TypeSend(AddMistakes('27', 20));
2: TypeSend(AddMistakes('28', 20));
3: TypeSend(AddMistakes('30', 20));
4: TypeSend(AddMistakes('33', 20));
5: TypeSend(AddMistakes('51', 20));
6: TypeSend(AddMistakes('71', 20));
7: TypeSend(AddMistakes('88', 20));
8: TypeSend(AddMistakes('89', 20));
9: TypeSend(AddMistakes('99', 20));
end;
Wait(250+random(500));
CloseBank;
end;
end;

begin
SetupSRL;
SafeInitForm;
SafeShowFormModal;
DeclarePlayers;
Repeat
Fletch;
GoBank;
until(Loadsdone >= Loads2);
end.

joelster134

2008-11-04 15:31:34

GREAT try for first script! ill take alook through it later..

Sandstorm

2008-11-04 17:14:14

  Writeln ('Fletching logs.');
Wait(500+random(1000));
AntiBan;
wait(51000+random(500));


I took a quick look, and beside that, doesn't look to bad.

You should make it do something like this:


While FindDtm(Params here) Do
begin
Wait(100)
Antiban;
end;

And make it check if it still finds logs in the inventory.

noidea

2008-11-04 17:27:56

From: Sand Storm

You should make it do something like this:


While FindDtm(Params here) Do
begin
Wait(100)
Antiban;
end;

And make it check if it still finds logs in the inventory.


OOOoooo!!!! I HATE that way! there is no fail safe! If there a gained lvl, your character stops fletching. The script will be sitting there forever.

Back to topic…
Instead of this
Case Random(10) of
0: TypeSend(AddMistakes('27', 20));
1: TypeSend(AddMistakes('27', 20));
2: TypeSend(AddMistakes('28', 20));
3: TypeSend(AddMistakes('29', 20));
4: TypeSend(AddMistakes('38', 20));
5: TypeSend(AddMistakes('39', 20));
6: TypeSend(AddMistakes('51', 20));
7: TypeSend(AddMistakes('60', 20));
8: TypeSend(AddMistakes('89', 20));
9: TypeSend(AddMistakes('99', 20));
end;
You could do this.
Typesend(inttostr(random(23423)))

Sandstorm

2008-11-04 17:36:22

From: noidea
OOOoooo!!!! I HATE that way! there is no fail safe! If there a gained lvl, your character stops fletching. The script will be sitting there forever.

Back to topic…
Instead of this
Case Random(10) of
0: TypeSend(AddMistakes('27', 20));
1: TypeSend(AddMistakes('27', 20));
2: TypeSend(AddMistakes('28', 20));
3: TypeSend(AddMistakes('29', 20));
4: TypeSend(AddMistakes('38', 20));
5: TypeSend(AddMistakes('39', 20));
6: TypeSend(AddMistakes('51', 20));
7: TypeSend(AddMistakes('60', 20));
8: TypeSend(AddMistakes('89', 20));
9: TypeSend(AddMistakes('99', 20));
end;
You could do this.
Typesend(inttostr(random(23423)))


Yes, I realize that, but I was just putting out a quick suggestion. He could make a custom level up function, or use a ClickToContinue (does that still work?) check, etc.

benjaa_reborn

2008-11-05 01:28:42

 if (BankScreen=true) then
begin
Mouse(612, 232, 4, 4, false);
Wait(200+random(500));
ChooseOption('All');
Wait(200+random(500));
Mouse(51, 109, 4, 4, false);
Wait(200+random(500));
ChooseOption('X');
Wait(200+random(500));
Case Random(10) of
0: TypeSend(AddMistakes('27', 20));
1: TypeSend(AddMistakes('27', 20));
2: TypeSend(AddMistakes('28', 20));
3: TypeSend(AddMistakes('30', 20));
4: TypeSend(AddMistakes('33', 20));
5: TypeSend(AddMistakes('51', 20));
6: TypeSend(AddMistakes('71', 20));
7: TypeSend(AddMistakes('88', 20));
8: TypeSend(AddMistakes('89', 20));
9: TypeSend(AddMistakes('99', 20));
end;
Wait(250+random(500));
CloseBank;
end;

You could also substitute DTM into this as well, blind mouse clicking maybe isn't the best option. If you need any help on DTM's, PM me.

Also could maybe use a simple reports system? Just using a variable for Banks and Arrows/Bows fletched.

Keep up the good work though, very impressive first script.

buckwheat09

2009-02-26 20:24:28

im looking for a good fletcher and this looks like a good one in the making