PDA

View Full Version : Problems With My Woodcutting Script.



in_jeopardy
10-29-2006, 12:49 PM
Below is my woodcutting script, it worked perfectly up until I made some changes, now it logs in and does nothing and I have no idea what is wrong with it. Can anyone help?



//---------------------------------------------------------//
// In_Jeopardy's //
// Normal Log Cutter //
// //
// *Instructions* //
// place character in an area that has lots of normal //
// trees, use the crosshair to select the ruenscape //
// client, set up lines 37 to 70 (and 79), press //
// play and enjoy //
// (have your axe equipped or it wont work) //
// //
// //
// *Features* //
// - will log in and out //
// - will switch players //
// - will cut a full load of normal logs //
// - will drop logs when inventory is full //
// - FindNormalRandoms //
// //
// *Credits* //
// By In_Jeopardy //
// With help from Sumilion =] //
// With some guidance on log dropping from JLewis //
// //
// //
//---------------------------------------------------------//


program BasicTreeCutter;
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\WoodCutting.scar}
Var
TempCount, CutMark, Mymark, MyTree, MyTime : integer;
A: integer;
frmDesign : TForm;
Button1 : TButton;

Const
NumberOfUsers = 1;
StartPlayer = 0;
Time = 360000 ; // Maximum amount of time you want it to spend on all accounts


const
Yew = 3096640;
Maple = 20608;
Willow = 3166296;
Oak = 3303512;
Normal = 403492;
Amount = 5; // number of loads

Procedure DeclarePlayers;
Begin
HowManyPlayers := NumberOfUsers;
NumberOfPlayers( HowManyPlayers );
CurrentPlayer := StartPlayer;

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

procedure Setup;
begin;
SetupSRL;
A:= 0
MouseSpeed := 20;
DeclarePlayers;
Cleardebug;
MyTree := Normal; // Put name of tree here.
end;

procedure buttonclick(sender: TObject);
begin
Writeln('**Script Started**');
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;

procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 100;
frmDesign.Top := 100;
frmDesign.Width := 200;
frmDesign.Height := 180;
frmDesign.Caption := 'Lets Begin!';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
Button1 := TButton.Create(frmDesign);
Button1.OnClick:= @buttonclick;
Button1.Parent := frmDesign;
Button1.Left := 60;
Button1.Top := 60;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Begin Script';
Button1.TabOrder := 8;
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 colourpick0;
begin;
If FindColorSpiralTolerance(x, y, MyTree, 000, 000, 516, 337, 5) Then;
begin;
Mouse(x, y, 3, 5, true);
TempCount := InvCount;
MarkTime(CutMark);
repeat
FindNormalRandoms;
Wait(200)
Until(InvCount = TempCount +1) Or (TimeFromMark(CutMark) >= 10000)
end;
end;

begin;
Setup
SafeInitForm
SafeShowFormModal
ActivateClient
If Not( LoggedIn ) Then LoginPlayer;
NextPlayer(true)
ChatsOff
wait(2000)
highestangle;
MakeCompass('N')
repeat
marktime(mymark);
repeat
colourpick0;
until(InvFull) Or (TimeFromMark(cutMark) >= 150000)
begin;
DropAllLogs;
A:=A+1
end;
Until(TimeFromMark(MyTime) >= Time) Or (A=Amount);
NextPlayer (true)
end.

YoHoJo
10-29-2006, 10:25 PM
change your main loop to this:
begin;
Setup
SafeInitForm
SafeShowFormModal
ActivateClient
If Not( LoggedIn ) Then LoginPlayer;
NextPlayer(true)
ChatsOff
wait(2000)
highestangle;
MakeCompass('N')
repeat
marktime(mymark);
repeat
colourpick0;
until(InvFull) Or (TimeFromMark(cutMark) >= 150000)
begin;
DropAllLogs;
A:=A+1
end;
Until(TimeFromMark(MyTime) >= Time) Or (A=Amount);
NextPlayer (true)
end.

and get rid of the form. its pointless.

in_jeopardy
10-29-2006, 10:58 PM
Thanks, and I know that it's pointless, but I wanted to see if I could use it...