SRL Archive - OSR Help

Exception in Script: Unknown procedure


Im fkn rare

2013-03-04 11:38:41

I get this error:
Exception in Script: Unknown procedure

When my script runs. (I wrote it myself)

Script:
program RareAIOThiever; //Written by Im Fkn Rare (Credits to PowerChop & WordPocket for Snippets!)

{$i srl/srl.simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$i P07Include.simba}

var
ManColor1, ManColor, FarmerColor, FarmerColor1, x, y, XPPH, noTimes, pickPH: Integer; PBox: TBox; xz: Integer; xyz, xzy : Integer; lol : String; woMan: Integer;
DsgnForm:TForm;
StartTime:Integer;
NPCCombo,AxeCombo: TComboBox;
TLabel0,TLabel1,TLabel3,TLabel4,TLabel2: TLabel;
TButton10: TButton;
Username,Password: TEdit;

const
default = 'Times new roman';
FONT = 9;
Version = '1.0';

procedure DTM;
begin
ManColor := 5982280;
ManColor1 := 4545382;
FarmerColor := 8564671;
FarmerColor1 := 6132646;
end;


Function AntiBan: Boolean;
begin
case random(300) of
0: P07_HoverSkill('thieving', random(5000));
end;
End;
//woman is: 5572950.
procedure Progress;
begin
pickPH := Round((noTimes * 3600) / (GetTimeRunning / 1000));
XPPH := Round(((noTimes * 8) * 3600) / (GetTimeRunning / 1000));
ClearDebug;
Writeln('Pickpocketed: ' + IntToStr(noTimes) + ' (' + IntToStr(pickPH) + ' per hour)');
Writeln('Experience earned: ' + IntToStr(noTimes * 8)+ ' (' + IntToStr(XPPH) + ' per hour)');
Writeln('Total time running: ' + TimeRunning);
end;
Function arewePocketing: Boolean;
var
PBox: TBox;
Begin
PBox := IntToBox(240, 158, 285, 198);
Result := (AveragePixelShift(PBox, 250, 350) > 90);
End;
procedure Thieve;
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
PBox := IntToBox(240, 158, 285, 198);
If AveragePixelShift(PBox, 250, 350) < 100 then
If FindColorSpiralTolerance(x, y, 5982280, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 7) then
MMouse(x, y, 1, 0);
ClickMouse2(mouse_Right);
wait(randomRange(200, 300));
P07_ChooseOptionMulti(['ickpocket']);
repeat
wait(randomRange(200, 300));
until AveragePixelShift(PBox, 250, 350) < 100;
noTimes := noTimes + 1;
end;
procedure Thieve1;
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
PBox := IntToBox(240, 158, 285, 198);
If AveragePixelShift(PBox, 250, 350) < 100 then
If FindColorSpiralTolerance(x, y, 8564671, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 7) then
MMouse(x, y, 1, 0);
ClickMouse2(mouse_Right);
wait(randomRange(200, 300));
P07_ChooseOptionMulti(['ickpocket']);
repeat
wait(randomRange(200, 300));
until AveragePixelShift(PBox, 250, 350) < 100;
noTimes := noTimes + 1;
end;
procedure ThieveNPC;
var x, y: integer;
begin
case NPCCombo.ITEMINDEX of
0:
Begin
Thieve;
End;
1:
Begin
Thieve1;
End;
End;
End;

procedure SaveFormInfo(Sender: TObject);
begin
DsgnForm.ModalResult := mrOk;
StartTime := GetSystemTime;
P07_PlayerName := Username.TEXT
P07_PlayerPass := Password.TEXT // Saving the text, before we close the form
DsgnForm.CLOSE;
end;
procedure InitForm;
begin
DsgnForm:=TForm.Create(nil);
with DsgnForm do
begin
Caption:='AIO Thiever from Im Fkn Rare';
Left:=346;
Top:=419;
Width:=350;
Height:=140;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel0:=TLabel.Create(DsgnForm);
with TLabel0 do
begin
Parent:=DsgnForm;
Caption:='AIO Thiever v1.0';
Left:=50;
Top:=10;
Width:=41;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=13;
end;
TLabel1:=TLabel.Create(DsgnForm);
with TLabel1 do
begin
Parent:=DsgnForm;
Caption:='NPC';
Left:=40;
Top:=40;
Width:=41;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel3:=TLabel.Create(DsgnForm);
with TLabel3 do
begin
Parent:=DsgnForm;
Caption:='Username';
Left:=206;
Top:=51;
Width:=49;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel4:=TLabel.Create(DsgnForm);
with TLabel4 do
begin
Parent:=DsgnForm;
Caption:='Password';
Left:=206;
Top:=80;
Width:=47;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
Username:=TEdit.Create(DsgnForm);
with Username do
begin
Parent:=DsgnForm;
Text:='Username';
Left:=257;
Top:=48;
Width:=80;
Height:=21;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
Username.MaxLength:=25;
end;
Password:=TEdit.Create(DsgnForm);
with Password do
begin
Parent:=DsgnForm;
Text:='Password';
Left:=257;
Top:=80;
Width:=80;
Height:=21;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
Password.MaxLength:=25;
Password.PasswordChar:=#;
end;
TButton10:=TButton.Create(DsgnForm);
with TButton10 do
begin
Parent:=DsgnForm;
Caption:='Start';
Left:=50;
Top:=110;
Width:=75;
Height:=25;
OnClick:=@SaveFormInfo;
end;
NPCCombo:=TComboBox.Create(DsgnForm);
with NPCCombo do
begin
Parent:=DsgnForm;
Left:=100;
Top:=40;
Width:=80;
Height:=21;
Items.Add('Man');
Items.Add('Farmer');
Text := Items[0];
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;


procedure ShowFormModal;
begin
DsgnForm.ShowModal;
end;


procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
SafeInitForm;
SafeShowFormModal;
SetupP07Include;
ActivateClient;
Wait(100);

If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
end;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
DTM;
AddOnTerminate('FreeDTMss')
AntiBan;
TerminateScript;
end;
End.

Sjoe

2013-03-04 11:43:30

From: Im fkn rare
I get this error:
Exception in Script: Unknown procedure

When my script runs. (I wrote it myself)


Could u post your script please?

Put
[./SIMBA] tags around your script.

So it would look like the following example
[SIMBA]
program new;
{$i srl/srl.simba}

procedure simbatags;
begin
end;

begin
end.

Easier for people to read

Im fkn rare

2013-03-04 11:48:46

From: Sjoekeloe
Could u post your script please?

Put
[./SIMBA] tags around your script.

So it would look like the following example
[SIMBA]
program new;
{$i srl/srl.simba}

procedure simbatags;
begin
end;

begin
end.

Easier for people to read


Added, this is probably extremely messy. It's my first script.

Ian

2013-03-04 11:53:12

Which line gets highlighted?

Kevin

2013-03-04 11:53:46

What is the exact error it gives you? It should highlight the failing line making it easier to find your issue.

Sjoe

2013-03-04 11:54:05

From: BMWxi
Which line gets highlighted?


Error while playing script.
I don't know how forms work :p

The Killer

2013-03-04 11:56:36

AddOnTerminate('FreeDTMss');
there isn't a procedure called FreeDTMss :P
O and btw, you don't have any dtms, so you don't need to free any :P

Sjoe

2013-03-04 11:57:44

From: The Killer
AddOnTerminate('FreeDTMss');
there isn't a procedure called FreeDTMss :P
O and btw, you don't have any dtms, so you don't need to free any :P


LOL I missed something so obvious. ;)

The Killer

2013-03-04 11:58:53

From: Sjoekeloe
LOL I missed something so obvious. ;)


Some times I wonder if its OP or you that wants to know more ;)

Sjoe

2013-03-04 12:07:54

From: The Killer
Some times I wonder if its OP or you that wants to know more ;)


I wanted to de-rep this but


Damnit :(

Im fkn rare

2013-03-04 12:15:26

Alright, I fixed it like I was told, now when I select Farmer, enter username and password, and hit start nothing happens.

(Well, it does the login protocol and then stands there.)

Sjoe

2013-03-04 12:18:20

From: Im fkn rare
Alright, I fixed it like I was told, now when I select Farmer, enter username and password, and hit start nothing happens.

(Well, it does the login protocol and then stands there.)


U did not call Thieve; or Thieve1; in your mainloop

The Killer

2013-03-04 12:20:58

begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
DTM;
AddOnTerminate('FreeDTMss')
AntiBan;
TerminateScript;
end; //this end shouldn't be here
End.
this is your mainloop, here is where you call your procedures and functions. Without calling them in your mainloop they won't be used.

Im fkn rare

2013-03-04 12:26:34

Main Loop:
begin
SafeInitForm;
SafeShowFormModal;
SetupP07Include;
ActivateClient;
Wait(100);
If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
end;

repeat
until (Not P07_LoggedIn)
TerminateScript;
End.

Im fkn rare

2013-03-04 12:31:22

If they have an option, shouldn't the SafeInitForm/SafeShowFormModal work for initiating the procedures that are Thieve1 and Thieve2?

Sjoe

2013-03-04 12:58:24

From: Im fkn rare
If they have an option, shouldn't the SafeInitForm/SafeShowFormModal work for initiating the procedures that are Thieve1 and Thieve2?


Thought someone would reply, so I didn't.

Anyway it doesnt' work that way I believe, gotta call it in the mainloop


begin
SafeInitForm;
SafeShowFormModal;
SetupP07Include;
ActivateClient;
Wait(100);
If (Not P07_LoggedIn) Then
P07_LogInPlayer;

repeat
ThieveNPC; // Put all the functions u want here
until (Not P07_LoggedIn)
TerminateScript;
End.

Well I don't know what u want between the loop, since it's your script.
U know it better ;)

Im fkn rare

2013-03-04 13:20:40

From: Sjoekeloe
Thought someone would reply, so I didn't.

Anyway it doesnt' work that way I believe, gotta call it in the mainloop


begin
SafeInitForm;
SafeShowFormModal;
SetupP07Include;
ActivateClient;
Wait(100);
If (Not P07_LoggedIn) Then
P07_LogInPlayer;

repeat
ThieveNPC; // Put all the functions u want here
until (Not P07_LoggedIn)
TerminateScript;
End.

Well I don't know what u want between the loop, since it's your script.
U know it better ;)


I've tried numerous things, take a look at the script I looked at for reference:
program PowerChop;
{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$I P07Include.Simba}

var
ChopWaitT,invcount1, invcount2,ChopWaitTime,OakColor1,TreeColor1,YewColor1, TreeColor,WillowColor,WillowColor1,MapleColor, YewColor, OakColor,Lagg: integer;
DsgnForm:TForm;
StartTime:Integer;
LogCombo,AxeCombo: TComboBox;
WieldAxe:Boolean;
TLabel0,TLabel1,TLabel3,TLabel4,TLabel2: TLabel;
TButton10: TButton;
Username,Password: TEdit;
const
default = 'Times new roman';
FONT = 9;
Version = '1.0';

procedure DTM;
begin
Lagg := 750;
ChopWaitTime := 99999999999;
TreeColor := 4162679;
TreeColor1 := 2645590;
OakColor := 1589301;
OakColor1 := 2184264;
WillowColor := 2506563;
WillowColor1 := 3565920;
MapleColor := 12910;
YewColor := 1986631;
YewColor1 := 1853512;
end;
procedure WaitHumanClick;
begin
case random(600) of
1..450: Wait(RandomRange(0, 100));
451..570: Wait(RandomRange(0, 200));
571..590: Wait(RandomRange(0, 600));
591..600: Wait(RandomRange(400, 1100));
end;
end;
Function IsWcing: Boolean;
var
PBox: TBox;
Begin
PBox := IntToBox(238, 149, 286, 186);
Result := (AveragePixelShift(PBox, 250, 350) > 150);
Writeln(IntToStr(AveragePixelShift(PBox, 500, 650)));
End;

Procedure DropLogs;
Begin
If (Not P07_LoggedIn) Then
Begin
P07_LogInPlayer;
End;
if (WieldAxe = True) then
Begin
P07_DropAll;
End;
if (WieldAxe = False) then
Begin
P07_DropAllExcept([1]);
End;
End;
Function AntiBan: Boolean;
begin
case random(300) of
0: P07_HoverSkill('woodcutting', random(5000));
end;
End;

Function isMoving1: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(237, 162, 282, 205);
Result := (AveragePixelShift(PBox, 250, 500) > 90);
Writeln(IntToStr(AveragePixelShift(PBox, 250, 500)));
end;
procedure SetAxe;
begin
case LogCombo.ITEMINDEX of
0:
Begin
WieldAxe := True;
End;
1:
Begin
WieldAxe := False;
End;
End;
End;
procedure Chop;
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
If P07_FindObj(x, y, 'Tree', TreeColor, 5) or
P07_FindObj(x, y, 'Tree', TreeColor, 5) Then
begin
WaitHumanClick
//writeln( CountColorTolerance(13093380, 0, 0, 243, 20, 30));

if Random(2) = 1 then
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
end;
end
else
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
P07_ChooseOptionMulti(['hop']);
end;
end;
end
else
begin
P07_MakeCompassDegree(30);
end;
P07_FFlag;
wait (lagg);
end;
procedure Chop1;
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
If P07_FindObj(x, y, 'Oak', OakColor1, 5) or
P07_FindObj(x, y, 'Oak', OakColor, 5) then
begin
WaitHumanClick
//writeln( CountColorTolerance(13093380, 0, 0, 243, 20, 30));

if Random(2) = 1 then
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
end;
end
else
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
P07_ChooseOptionMulti(['hop']);
end;
end;
end
else
begin
P07_MakeCompassDegree(30);
end;
P07_FFlag;
wait (lagg);
end;
procedure Chop2;
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
If P07_FindObj(x, y, 'Willow', WillowColor1, 5) or
P07_FindObj(x, y, 'Willow', WillowColor, 5) Then
begin
WaitHumanClick
//writeln( CountColorTolerance(13093380, 0, 0, 243, 20, 30));

if Random(2) = 1 then
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
end;
end
else
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
P07_ChooseOptionMulti(['hop']);
end;
end;
end
else
begin
P07_MakeCompassDegree(30);
end;
P07_FFlag;
wait (lagg);
end;
procedure Chop3;
var x, y: integer;
begin
If not IsWcing then
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
If P07_FindObj(x, y, 'Maple', MapleColor, 5) Then
begin
WaitHumanClick
//writeln( CountColorTolerance(13093380, 0, 0, 243, 20, 30));

if Random(2) = 1 then
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
end;
end
else
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
P07_ChooseOptionMulti(['hop']);
end;
end;
end
else
begin
P07_MakeCompassDegree(30);
end;
P07_FFlag;
wait (lagg);
end;
procedure Chop4;
var x, y: integer;
begin
If not IsWcing then
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
If P07_FindObj(x, y, 'Yew', YewColor, 5) or
P07_FindObj(x, y, 'Yew', YewColor, 5) Then
begin
WaitHumanClick
//writeln( CountColorTolerance(13093380, 0, 0, 243, 20, 30));

if Random(2) = 1 then
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
end;
end
else
begin
if(CountColorTolerance(13093380, 70, 0, 146, 20, 50) > 10) then
begin
Mouse(RandomRange(X - 5, X + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
P07_ChooseOptionMulti(['hop']);
end;
end;
end
else
begin
P07_MakeCompassDegree(30);
end;
P07_FFlag;
wait (lagg);
end;

procedure ChopTree;
var x, y: integer;
begin
case LogCombo.ITEMINDEX of
0:
Begin
If P07_FindObj(x, y, 'Tree', TreeColor, 10) or
P07_FindObj(x, y, 'Tree', TreeColor1, 10) Then
Chop;
End;
1:
Begin
If P07_FindObj(x, y, 'Oak', OakColor, 10) or
P07_FindObj(x, y, 'Oak', OakColor1, 10) Then
Chop1;
End;
2:
Begin
If P07_FindObj(x, y, 'Willow', WillowColor, 10) or
P07_FindObj(x, y, 'Willow', WillowColor1, 10) Then
Chop2;
End;
3:
Begin
If P07_FindObj(x, y, 'Maple', MapleColor, 10) Then
Chop3;
End;
4:
Begin
If P07_FindObj(x, y, 'Yew', YewColor, 10) or
P07_FindObj(x, y, 'Yew', YewColor1, 10) Then
Chop4;
End;
End;
End;
procedure SaveFormInfo(Sender: TObject);
begin
DsgnForm.ModalResult := mrOk;
StartTime := GetSystemTime;
P07_PlayerName := Username.TEXT
P07_PlayerPass := Password.TEXT // Saving the text, before we close the form
DsgnForm.CLOSE;
SetAxe;
ChopTree;
end;


procedure InitForm;
begin
DsgnForm:=TForm.Create(nil);
with DsgnForm do
begin
Caption:='PowerChop From Grand01';
Left:=346;
Top:=419;
Width:=350;
Height:=140;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel0:=TLabel.Create(DsgnForm);
with TLabel0 do
begin
Parent:=DsgnForm;
Caption:='PowerChop 1.3';
Left:=50;
Top:=10;
Width:=41;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=13;
end;
TLabel1:=TLabel.Create(DsgnForm);
with TLabel1 do
begin
Parent:=DsgnForm;
Caption:='Tree';
Left:=40;
Top:=40;
Width:=41;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel2:=TLabel.Create(DsgnForm);
with TLabel2 do
begin
Parent:=DsgnForm;
Caption:='Wield Axe';
Left:=40;
Top:=80;
Width:=48;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel3:=TLabel.Create(DsgnForm);
with TLabel3 do
begin
Parent:=DsgnForm;
Caption:='Username';
Left:=206;
Top:=51;
Width:=49;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel4:=TLabel.Create(DsgnForm);
with TLabel4 do
begin
Parent:=DsgnForm;
Caption:='Password';
Left:=206;
Top:=80;
Width:=47;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
Username:=TEdit.Create(DsgnForm);
with Username do
begin
Parent:=DsgnForm;
Text:='Username';
Left:=257;
Top:=48;
Width:=80;
Height:=21;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
Username.MaxLength:=12;
end;
Password:=TEdit.Create(DsgnForm);
with Password do
begin
Parent:=DsgnForm;
Text:='Password';
Left:=257;
Top:=80;
Width:=80;
Height:=21;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
Password.MaxLength:=21;
Password.PasswordChar:=#;
end;
TButton10:=TButton.Create(DsgnForm);
with TButton10 do
begin
Parent:=DsgnForm;
Caption:='Start';
Left:=50;
Top:=110;
Width:=75;
Height:=25;
OnClick:=@SaveFormInfo;
end;
LogCombo:=TComboBox.Create(DsgnForm);
with LogCombo do
begin
Parent:=DsgnForm;
Left:=100;
Top:=40;
Width:=80;
Height:=21;
Items.Add('Tree');
Items.Add('Oak');
Items.Add('Willow');
Items.Add('Maple');
Items.Add('Yew');
Text := Items[0];
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
AxeCombo:=TComboBox.Create(DsgnForm);
with AxeCombo do
begin
Parent:=DsgnForm;
Left:=100;
Top:=80;
Width:=80;
Height:=21;
Items.Add('Yes');
Items.Add('No');
Text := Items[0];
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
end;


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


procedure ShowFormModal;
begin
DsgnForm.ShowModal;
end;


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

begin
SafeInitForm;
SafeShowFormModal;
SetupP07Include;
ActivateClient;
SetAxe;
Wait(100);

If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
end;

P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
DTM;
AddOnTerminate('FreeDTMss')
MarkTime(ChopWaitT);
invcount2 := 28;

AntiBan;

repeat


if(P07_InvFull) then
begin
DropLogs;
end;
begin
if((invcount2 >= invcount1) or not isMoving1) then
begin
ChopTree;
invcount2 := 0;
end;
begin
if(random(10) = 1) then
begin
MMouse(random(800), random(550), 0, 0);
end;
end;
end;

until (Not P07_LoggedIn)
TerminateScript;
end.

Sjoe

2013-03-04 13:24:03

The most effective way is to make some debug lines then
If FindColorSpiralTolerance(x, y, 8564671, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 7) then
Writenln(' found the color')

Do that for most of the if then statements.
See where your script cramps up!
And then u know where your script malfunctions.

Im fkn rare

2013-03-04 13:53:57

I think I've figured it out. If you explain to me what a DTM is a little further than what was given in the guide I read, I can fix this. A DTM is a variable?

The Killer

2013-03-04 13:57:35

From: Im fkn rare
I think I've figured it out. If you explain to me what a DTM is a little further than what was given in the guide I read, I can fix this. A DTM is a variable?

There's loads of DTM tutorials, in the scripting tutorial section here.
Just a few I like:
http://villavu.com/forum/showthread.php?t=68018
http://villavu.com/forum/showthread.php?t=24858
:)

Im fkn rare

2013-03-04 13:59:04

Here is the final version, it still doesn't work, and I can't figure out what's wrong with it.
program RareAIOThiever; //Written by Im Fkn Rare (Credits to PowerChop & WordPocket for Snippets!)

{$i srl/srl.simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$i P07Include.simba}

var
x, y, ManColor, FarmerColor, XPPH, noTimes, pickPH: Integer; PBox: TBox; DsgnForm: TForm; StartTime: Integer; NPCCombo: TComboBox;
TLabel0,TLabel1,TLabel3,TLabel4: TLabel; TButton10: TButton; Username, Password: TEdit;

const
default = 'Times new roman';
FONT = 9;
Version = '1.0';
procedure DTM;
begin
ManColor := 5982280;
FarmerColor := 1460062;
end;
procedure Progress;
begin
pickPH := Round((noTimes * 3600) / (GetTimeRunning / 1000));
XPPH := Round(((noTimes * 8) * 3600) / (GetTimeRunning / 1000));
ClearDebug;
Writeln('Pickpocketed: ' + IntToStr(noTimes) + ' (' + IntToStr(pickPH) + ' per hour)');
Writeln('Experience earned: ' + IntToStr(noTimes * 8)+ ' (' + IntToStr(XPPH) + ' per hour)');
Writeln('Total time running: ' + TimeRunning);
end;
//Where I began adding things is below this line
procedure Thieve; //Man
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
PBox := IntToBox(240, 158, 285, 198);
If AveragePixelShift(PBox, 250, 350) < 100 then
If FindColorSpiralTolerance(x, y, 5982280, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 7) then
MMouse(x, y, 1, 0);
ClickMouse2(mouse_Right);
wait(randomRange(200, 300));
P07_ChooseOptionMulti(['ickpocket']);
repeat
wait(randomRange(200, 300));
until AveragePixelShift(PBox, 250, 350) < 100;
noTimes := noTimes + 1;
end;
procedure Thieve1; //Farmer
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
PBox := IntToBox(240, 158, 285, 198);
If AveragePixelShift(PBox, 250, 350) < 100 then
If FindColorSpiralTolerance(x, y, 8103863, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 7) then
Writeln('found the color');
MMouse(x, y, 1, 0);
ClickMouse2(mouse_Right);
wait(randomRange(200, 300));
P07_ChooseOptionMulti(['ickpocket']);
repeat
wait(randomRange(200, 300));
until AveragePixelShift(PBox, 250, 350) < 100;
noTimes := noTimes + 1;
end;
procedure ThieveNPC;
begin
case NPCCombo.ITEMINDEX of
0:
Begin
If P07_FindObj(x, y, 'Man', ManColor, 10) then
Thieve;
End;
1:
Begin
If P07_FindObj(x, y, 'Farmer', FarmerColor, 10) then
Thieve1;
End;
End;
End;

procedure SaveFormInfo(Sender: TObject);
begin
DsgnForm.ModalResult := mrOk;
StartTime := GetSystemTime;
P07_PlayerName := Username.TEXT
P07_PlayerPass := Password.TEXT // Saving the text, before we close the form
DsgnForm.CLOSE;
end;
procedure InitForm;
begin
DsgnForm:=TForm.Create(nil);
with DsgnForm do
begin
Caption:='AIO Thiever from Im Fkn Rare';
Left:=346;
Top:=419;
Width:=350;
Height:=140;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel0:=TLabel.Create(DsgnForm);
with TLabel0 do
begin
Parent:=DsgnForm;
Caption:='AIO Thiever v1.0';
Left:=50;
Top:=10;
Width:=41;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=13;
end;
TLabel1:=TLabel.Create(DsgnForm);
with TLabel1 do
begin
Parent:=DsgnForm;
Caption:='NPC';
Left:=40;
Top:=40;
Width:=41;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel3:=TLabel.Create(DsgnForm);
with TLabel3 do
begin
Parent:=DsgnForm;
Caption:='Username';
Left:=206;
Top:=51;
Width:=49;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel4:=TLabel.Create(DsgnForm);
with TLabel4 do
begin
Parent:=DsgnForm;
Caption:='Password';
Left:=206;
Top:=80;
Width:=47;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
Username:=TEdit.Create(DsgnForm);
with Username do
begin
Parent:=DsgnForm;
Text:='Username';
Left:=257;
Top:=48;
Width:=80;
Height:=21;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
Username.MaxLength:=25;
end;
Password:=TEdit.Create(DsgnForm);
with Password do
begin
Parent:=DsgnForm;
Text:='Password';
Left:=257;
Top:=80;
Width:=80;
Height:=21;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
Password.MaxLength:=25;
Password.PasswordChar:=#;
end;
TButton10:=TButton.Create(DsgnForm);
with TButton10 do
begin
Parent:=DsgnForm;
Caption:='Start';
Left:=50;
Top:=110;
Width:=75;
Height:=25;
OnClick:=@SaveFormInfo;
end;
NPCCombo:=TComboBox.Create(DsgnForm);
with NPCCombo do
begin
Parent:=DsgnForm;
Left:=100;
Top:=40;
Width:=80;
Height:=21;
Items.Add('Man');
Items.Add('Farmer');
Text := Items[0];
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;


procedure ShowFormModal;
begin
DsgnForm.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
SafeInitForm;
SafeShowFormModal;
SetupP07Include;
ActivateClient;
ThieveNPC;
Wait(100);

If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
end;

P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
DTM;


repeat

until (Not P07_LoggedIn)
TerminateScript;
end.

The Killer

2013-03-04 14:26:13

From: Im fkn rare
Here is the final version, it still doesn't work, and I can't figure out what's wrong with it.
program RareAIOThiever; //Written by Im Fkn Rare (Credits to PowerChop & WordPocket for Snippets!)

{$i srl/srl.simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$i P07Include.simba}

var
x, y, ManColor, FarmerColor, XPPH, noTimes, pickPH: Integer; PBox: TBox; DsgnForm: TForm; StartTime: Integer; NPCCombo: TComboBox;
TLabel0,TLabel1,TLabel3,TLabel4: TLabel; TButton10: TButton; Username, Password: TEdit;

const
default = 'Times new roman';
FONT = 9;
Version = '1.0';
procedure DTM;
begin
ManColor := 5982280;
FarmerColor := 1460062;
end;
procedure Progress;
begin
pickPH := Round((noTimes * 3600) / (GetTimeRunning / 1000));
XPPH := Round(((noTimes * 8) * 3600) / (GetTimeRunning / 1000));
ClearDebug;
Writeln('Pickpocketed: ' + IntToStr(noTimes) + ' (' + IntToStr(pickPH) + ' per hour)');
Writeln('Experience earned: ' + IntToStr(noTimes * 8)+ ' (' + IntToStr(XPPH) + ' per hour)');
Writeln('Total time running: ' + TimeRunning);
end;
//Where I began adding things is below this line
procedure Thieve; //Man
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
PBox := IntToBox(240, 158, 285, 198);
If AveragePixelShift(PBox, 250, 350) < 100 then
If FindColorSpiralTolerance(x, y, 5982280, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 7) then
MMouse(x, y, 1, 0);
ClickMouse2(mouse_Right);
wait(randomRange(200, 300));
P07_ChooseOptionMulti(['ickpocket']);
repeat
wait(randomRange(200, 300));
until AveragePixelShift(PBox, 250, 350) < 100;
noTimes := noTimes + 1;
end;
procedure Thieve1; //Farmer
var x, y: integer;
begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
PBox := IntToBox(240, 158, 285, 198);
If AveragePixelShift(PBox, 250, 350) < 100 then
If FindColorSpiralTolerance(x, y, 8103863, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 7) then
Writeln('found the color');
MMouse(x, y, 1, 0);
ClickMouse2(mouse_Right);
wait(randomRange(200, 300));
P07_ChooseOptionMulti(['ickpocket']);
repeat
wait(randomRange(200, 300));
until AveragePixelShift(PBox, 250, 350) < 100;
noTimes := noTimes + 1;
end;
procedure ThieveNPC;
begin
case NPCCombo.ITEMINDEX of
0:
Begin
If P07_FindObj(x, y, 'Man', ManColor, 10) then
Thieve;
End;
1:
Begin
If P07_FindObj(x, y, 'Farmer', FarmerColor, 10) then
Thieve1;
End;
End;
End;

procedure SaveFormInfo(Sender: TObject);
begin
DsgnForm.ModalResult := mrOk;
StartTime := GetSystemTime;
P07_PlayerName := Username.TEXT
P07_PlayerPass := Password.TEXT // Saving the text, before we close the form
DsgnForm.CLOSE;
end;
procedure InitForm;
begin
DsgnForm:=TForm.Create(nil);
with DsgnForm do
begin
Caption:='AIO Thiever from Im Fkn Rare';
Left:=346;
Top:=419;
Width:=350;
Height:=140;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel0:=TLabel.Create(DsgnForm);
with TLabel0 do
begin
Parent:=DsgnForm;
Caption:='AIO Thiever v1.0';
Left:=50;
Top:=10;
Width:=41;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=13;
end;
TLabel1:=TLabel.Create(DsgnForm);
with TLabel1 do
begin
Parent:=DsgnForm;
Caption:='NPC';
Left:=40;
Top:=40;
Width:=41;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel3:=TLabel.Create(DsgnForm);
with TLabel3 do
begin
Parent:=DsgnForm;
Caption:='Username';
Left:=206;
Top:=51;
Width:=49;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
TLabel4:=TLabel.Create(DsgnForm);
with TLabel4 do
begin
Parent:=DsgnForm;
Caption:='Password';
Left:=206;
Top:=80;
Width:=47;
Height:=14;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
Username:=TEdit.Create(DsgnForm);
with Username do
begin
Parent:=DsgnForm;
Text:='Username';
Left:=257;
Top:=48;
Width:=80;
Height:=21;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
Username.MaxLength:=25;
end;
Password:=TEdit.Create(DsgnForm);
with Password do
begin
Parent:=DsgnForm;
Text:='Password';
Left:=257;
Top:=80;
Width:=80;
Height:=21;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
Password.MaxLength:=25;
Password.PasswordChar:=#;
end;
TButton10:=TButton.Create(DsgnForm);
with TButton10 do
begin
Parent:=DsgnForm;
Caption:='Start';
Left:=50;
Top:=110;
Width:=75;
Height:=25;
OnClick:=@SaveFormInfo;
end;
NPCCombo:=TComboBox.Create(DsgnForm);
with NPCCombo do
begin
Parent:=DsgnForm;
Left:=100;
Top:=40;
Width:=80;
Height:=21;
Items.Add('Man');
Items.Add('Farmer');
Text := Items[0];
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=9;
end;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;


procedure ShowFormModal;
begin
DsgnForm.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
SafeInitForm;
SafeShowFormModal;
SetupP07Include;
ActivateClient;
ThieveNPC;
Wait(100);

If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
end;

P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
DTM;


repeat

until (Not P07_LoggedIn)
TerminateScript;
end.

You still don't call actual thieving in your script.
repeat

until (Not P07_LoggedIn)
does nothing :/ go back over basics some more tutorials if you're unsure :)

edit: you also load your colours during the end when they should be before you need them (should be before theiveNPC)

Sjoe

2013-03-04 14:31:00

Also Call DTM; at the beginning of the script, to load the colors for ThieveNPC;
If the are not called before they are used. They will have a value of 0.

Im fkn rare

2013-03-04 15:14:40

That doesn't work, it's not doing anything. It logs in, and sits there.