Log in

View Full Version : getting error while learning to script.



tvjj
04-07-2012, 03:14 AM
hey every one i am getting some errors with the script i am learning to make from yohojos tuts. im getting

Error: Out Of Range at line 30
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]


i know the issue is with my declareplayers but here is my progress on it so far,

//TVJJ'S First PowerChopper//

program PowerChopper;
//{$include srl/srl/misc/smart.simba}
{$I SRL/SRL.simba}
{$I srl/srl/misc/debug.simba}
{$I sps/sps.simba}
{$Include SRL/SRL/skill/fighting.simba}

Const
SRLStats_Username = ''; //Your SRL stats Username.
SRLStats_Password = ''; //Your SRL stats Password.
BreakEvery = '3'; //How many minutes to break after.
BreakFor = '1'; //How long to break for.
Version = '1.0a'; // No need to touch.
NumbOfPlayers = 1; //How many players are you using
StartPlayer = 0; // Player to start autoing with (0 means first char)

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];


With Players[i] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
End;
end;// declare players


Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;



Function CheckAndClick(UpText, Option:String; x,y:integer; RClick:Boolean) :Boolean;
Begin
MMouse(x, y, 5, 5);
if WaitUpText (UpText, 1500+Random(500)) Then
Begin
Result:=True;
GetMousePos(x, y);
If RClick Then
Begin
Mouse(x, y, 0, 0, False);
Result:= WaitOption (Option, 2000);
If Result Then FFlag (0);
End else
Begin
Mouse(x, y, 0, 0, True);
Wait (100+Random(50));
FFlag(0);
End;
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Woodcut', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;


Procedure FailSafe (Reason:String);
Begin
Players [CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;


Function ChopDown: Boolean;
Var
X, Y: Integer;
begin
//Ex. FindObjCustom(x, y, ('att', 'ack'), [123456, 345678], 5);//
If FindObjCustom(X, Y, ['Chop', 'Down', 'p d'], [1383966, 2832959, 1911338, 1450787], 30) Then
WriteLn('Hooray, we found a tree')
End;


begin
SetupSRL;
DeclarePlayers;
//Repeat
Chopdown;
//Until(false);
End.

any help is greatly appricated :D thanks in advance

Edit: also alot of this has been copypasted from other scripts so if you see anything that is really nooby please let me know lol.

Sex
04-07-2012, 03:17 AM
You need to put:
HowManyPlayers := NumbOfPlayers;
before:
NumberOfPlayers(NumbOfPlayers);

tvjj
04-07-2012, 03:28 AM
still getting issue, now just saying line 31 cause of the entry of the new line. i got this error:

Error: Out Of Range at line 31
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]



procedure DeclarePlayers;
var i:integer;
begin
HowManyPlayers := NumbofPlayers;
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];


With Players[i] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
End;
end;// declare players

tvjj
04-07-2012, 03:32 AM
ah, got it nevermind :D im so impressed withmyself right now as simple as it was i feel accomplishment.

what i did to fix it.


procedure DeclarePlayers;
var i:integer;
begin
HowManyPlayers := NumbOfPlayers;
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
//for i := 0 to NumbOfPlayers-1 do
//Players[i].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];


With Players[i] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
End;
end;// declare players

ShawnjohnSJ
04-07-2012, 03:35 AM
Try this:


//TVJJ'S First PowerChopper//

program PowerChopper;
//{$include srl/srl/misc/smart.simba}
{$I SRL/SRL.simba}
{$I srl/srl/misc/debug.simba}
{$I sps/sps.simba}
{$Include SRL/SRL/skill/fighting.simba}

Const
SRLStats_Username = ''; //Your SRL stats Username.
SRLStats_Password = ''; //Your SRL stats Password.
BreakEvery = '3'; //How many minutes to break after.
BreakFor = '1'; //How long to break for.
Version = '1.0a'; // No need to touch.
NumbOfPlayers = 1; //How many players are you using
StartPlayer = 0; // Player to start autoing with (0 means first char)

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;

With Players[0] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
end;// declare players


Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;



Function CheckAndClick(UpText, Option:String; x,y:integer; RClick:Boolean) :Boolean;
Begin
MMouse(x, y, 5, 5);
if WaitUpText (UpText, 1500+Random(500)) Then
Begin
Result:=True;
GetMousePos(x, y);
If RClick Then
Begin
Mouse(x, y, 0, 0, False);
Result:= WaitOption (Option, 2000);
If Result Then FFlag (0);
End else
Begin
Mouse(x, y, 0, 0, True);
Wait (100+Random(50));
FFlag(0);
End;
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Woodcut', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;


Procedure FailSafe (Reason:String);
Begin
Players [CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;


Function ChopDown: Boolean;
Var
X, Y: Integer;
begin
//Ex. FindObjCustom(x, y, ('att', 'ack'), [123456, 345678], 5);//
If FindObjCustom(X, Y, ['Chop', 'Down', 'p d'], [1383966, 2832959, 1911338, 1450787], 30) Then
WriteLn('Hooray, we found a tree')
End;


begin
SetupSRL;
DeclarePlayers;
//Repeat
Chopdown;
//Until(false);
End.


EDIT: Don't use the code you fixed. It may look fixed, but if you try to use more than one account per script, it won't work.

EDIT2: I updated the code again, use that. It should be pretty easy for you to add another account if you wish.

tvjj
04-07-2012, 03:51 AM
Try this:


//TVJJ'S First PowerChopper//

program PowerChopper;
//{$include srl/srl/misc/smart.simba}
{$I SRL/SRL.simba}
{$I srl/srl/misc/debug.simba}
{$I sps/sps.simba}
{$Include SRL/SRL/skill/fighting.simba}

Const
SRLStats_Username = ''; //Your SRL stats Username.
SRLStats_Password = ''; //Your SRL stats Password.
BreakEvery = '3'; //How many minutes to break after.
BreakFor = '1'; //How long to break for.
Version = '1.0a'; // No need to touch.
NumbOfPlayers = 1; //How many players are you using
StartPlayer = 0; // Player to start autoing with (0 means first char)

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;

With Players[0] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
end;// declare players


Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;



Function CheckAndClick(UpText, Option:String; x,y:integer; RClick:Boolean) :Boolean;
Begin
MMouse(x, y, 5, 5);
if WaitUpText (UpText, 1500+Random(500)) Then
Begin
Result:=True;
GetMousePos(x, y);
If RClick Then
Begin
Mouse(x, y, 0, 0, False);
Result:= WaitOption (Option, 2000);
If Result Then FFlag (0);
End else
Begin
Mouse(x, y, 0, 0, True);
Wait (100+Random(50));
FFlag(0);
End;
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Woodcut', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;


Procedure FailSafe (Reason:String);
Begin
Players [CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;


Function ChopDown: Boolean;
Var
X, Y: Integer;
begin
//Ex. FindObjCustom(x, y, ('att', 'ack'), [123456, 345678], 5);//
If FindObjCustom(X, Y, ['Chop', 'Down', 'p d'], [1383966, 2832959, 1911338, 1450787], 30) Then
WriteLn('Hooray, we found a tree')
End;


begin
SetupSRL;
DeclarePlayers;
//Repeat
Chopdown;
//Until(false);
End.


EDIT: Don't use the code you fixed. It may look fixed, but if you try to use more than one account per script, it won't work.

EDIT2: I updated the code again, use that. It should be pretty easy for you to add another account if you wish.

awesome thank you, now i dont plan on using multiple accounts, but if i was to what would the code be to add in different ones? like what would i add/remove?

ShawnjohnSJ
04-07-2012, 03:55 AM
For every player you need this code in DeclarePlayers; the 0 is the index of the player.. say you have 2 players, the first player would be 0 and the second player would be 1 and so on. You would also have to change the NumbOfPlayers to the right amount.


With Players[0] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;

tvjj
04-07-2012, 03:58 AM
awesome thank you for the help greatly appriciated +rep :D