SRL Archive - General Botting Help

[ERROR-WOULD LOVE HELP]-First script and having a lot of issues.


mangolee

2013-04-15 00:26:37

Hi, I have been having a lot of issues with Simba and now i'm at my wits end.
Code;

program PowerMiner;

//{$DEFINE SMART8}
{$i SRL\SRL.simba}
{$i sps/sps.simba}
//{$i SRL\SRL\Misc\paintsmart.simba}
{$i P07Include.simba}
Const
SRLStats_Username = 'bonestriper2';
SRLStats_Password = '';
BreakEvery = 120;
BreakFor = 5;
NumbOfPlayers = 1;
StartPlayer = 0;
procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Active := True;
Integers[1] := 4; //1=BrightCopper,2=DarkCopper,3=Tin,4=Iron.
Integers[2] := 4; //Seconds to try mining rock before clicking another.
end;

end;
Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;
Procedure Antiban;
Begin
Case Random(1) Of

0:Begin WAIT(1) End;
1:Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); PickUpMouse; End;
2:Begin P07_TabInventoryTab(4); End;
3:Begin RandomAngle(SRL_ANGLE_HIGH); SetAngle(SRL_ANGLE_HIGH); End;
4:Begin Wait(1) End;
5:Begin P07_HoverSkill('random',RandomRange(2500,3500)); P07_TabInventoryTab(4); End;

End;
End;
Var
X,Y,OreTime,Slot,SlotPlus,OreDat,I: Integer;
LogPattern:TIntegerArray;
SlotBox:Tbox;
Procedure Drop;
Begin
If FindDTM(OreDat, X, Y, Slotbox.X1,SlotBox.Y1,SlotBox.X2,SlotBox.Y2) then
WriteLn('lolol') Else
writeLn('Polo');
End;
Procedure DropOre;
Begin
OreDat := DTMFromString('mAAEAAHic42FgYBAEYnEglgdiUSBmB2JOIOYFYikgloXKg/gMUFoMqoYRql4YiKWh+lmBmAmqlh+I7ZQloCqJw/8ZSAPEmwzByAAA7yYC/Q==');
LogPattern := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27];
For I:=1 to 27 Do
Begin
SlotBox:=InvBox(LogPattern[I]);
//Drop;
Begin
MouseItem(LogPattern[I],0);
ChooseOption('Drop');
End;
End;
End;
Procedure Ore;
Begin
If FindObjCustom(X, Y, ['mine', 'rocks'], [2174545, 1450298], 4) Then
End;
Procedure ClickRock;
Begin
Slot:= SlotPlus;
X:=MSCX;
Y:=MSCY;
MouseSpeed:= 12;
Ore();
Mouse(X ,Y ,10 ,5 ,True);
MarkTime(OreTime);
SlotPlus:= Slot + 1;
WriteLn(Slot);
Wait(10000);
End;
Begin
SetupSRL;
DeclarePlayers;
ActivateClient;
//Repeat
//ClickRock;
//Antiban;
//Until(Slot > 25);
FreeDTM(OreDat);
Drop;
//Ore;
//DropOre;
//Wait(12000);
End.

Having issues like;

1. If statements not working in the same Procedure/Function. (Worked around this by pasting into a separate Function/Procedure and calling.)
2.


Error at line 57 (BOLD);

Error: Exception: The given DTM Index[0] doesn't exist at line 57
[B]If FindObjCustom(X, Y, ['mine', 'rocks'], [2174545, 1450298], 4) Then [/B]


Also the script will compile without error but when I try to run it will halt with this error. All help will be appreciated, don't worry if you're stumped this does not look like normal behavior. PLEASE :D :redface: ALSO, SORRY ABOUT THE ATROCIOUS LAYOUT, I UNDERSTAND ITS VERY VERY MESSY, PLEASE DON'T SALT THE WOUND LOLOL

Iambubbleman

2013-04-15 00:37:50

Hi there, It appears one of your problems has to do with declaring your DTM.

The DTM OreDat is declared as an Integer globally, but the actual definition of what OreDat is only declared locally, within the procedure DropOre;

it appears that you aren't using the DTM OreDat in DropOre, so you can simple move it to the procedure Drop;

This is what the change looks like

Procedure Drop;
Begin
OreDat := DTMFromString('mAAEAAHic42FgYBAEYnEglgdiUSBmB2JOIOYFYikgloXKg/gMUFoMqoYRql4YiKWh+lmBmAmqlh+I7ZQloCqJw/8ZSAPEmwzByAAA7yYC/Q==');
If FindDTM(OreDat, X, Y, Slotbox.X1,SlotBox.Y1,SlotBox.X2,SlotBox.Y2) then
WriteLn('FAG') Else
writeLn('Polo');
End;
Procedure DropOre;
Begin
LogPattern := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27];
For I:=1 to 27 Do
Begin
SlotBox:=InvBox(LogPattern[I]);
//Drop;
Begin
MouseItem(LogPattern[I],0);
ChooseOption('Drop');
End;
End;
End;

Hope I helped!

mangolee

2013-04-15 00:47:30

Thanks, this sorted the compiling problems and Simba is returning

SRL Compiled in 0 msec
Compiled successfully in 702 ms.
Successfully executed.

But, its not doing anything and it should right clicking on the Iron Ore (Expresses in the DTM) and selecting the 'Drop' option. I have made sure that the window is selected as the target every thing else works fine. Any suggestions?

Le Jingle

2013-04-15 01:07:56

Just a revision of the code posted in your main post.
Note the logical rework (also omitted code due to it not being utilized)


program PowerMiner;
//{$DEFINE SMART8}
{$include_once SRL-OSR/SRL/SRL.simba}
//{$include_once SRL/SRL/misc/PaintSmart.simba}

var
OreDTM: Integer;

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

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Active := True;
Integers[1] := 4; //1=BrightCopper,2=DarkCopper,3=Tin,4=Iron.
Integers[2] := 4; //Seconds to try mining rock before clicking another.
BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];
end;
end;

procedure Antiban();
begin
case Random(25) of
0 :
begin
PickUpMouse;
SleepAndMoveMouse(3000 + Random(500));
PickUpMouse;
end;
1 : GameTab(Tab_Inv);
2 :
begin
RandomAngle(SRL_ANGLE_HIGH);
SetAngle(SRL_ANGLE_HIGH);
end;
3 :
begin
HoverSkill('random', False);
Wait(RandomRange(2500, 3000));
GameTab(Tab_Inv);
end;
end;
end;

function FindMainScreenOre(ClickRocks: Boolean): Boolean;
var
x, y: Integer;
begin
Result := FindObjCustom(X, Y, ['mine', 'rocks'], [2174545, 1450298], 15);
if (Result) and (Clickrocks) then
Mouse(x, y, 5, 5, Mouse_Left);
end;

procedure SetupGlobals();
begin
OreDTM := DTMFromString('mAAEAAHic42FgYBAEYnEglgdiUSBmB2JOIOYFYikgloXKg/gMUFoMqoYRql4YiKWh+lmBmAmqlh+I7ZQloCqJw/8ZSAPEmwzByAAA7yYC/Q==');
end;

procedure FreeGlobals();
begin
FreeDTM(OreDTM);
end;

procedure DropOreFromInv();
var
i, x, y: Integer;
b: TBox;
begin
for i := 1 to 28 do
begin
b := InvBox(i);
if (FindDTM(OreDTM, x, y, b.X1, b.Y1, b.X2, b.Y2)) then
begin
MouseItem(i, Mouse_Right);
WaitOption('rop', 800);
end;
end;
end;

begin
DeclarePlayers;
SetupSRL;
ActivateClient;
LoginPlayer;
SetupGlobals();
AddOnTerminate('FreeGlobals');
repeat
FindMainScreenOre(true);
Antiban();
until(InvCount = 28);
DropOreFromInv();
end.

This isn't so much meant to ``solve'' your problem(s), but it's supposed to help show a better standard that you may or may not learn from. :]
Cheers,
Lj

mangolee

2013-04-15 22:35:26

From: Le Jingle
Just a revision of the code posted in your main post.
Note the logical rework (also omitted code due to it not being utilized)


program PowerMiner;
//{$DEFINE SMART8}
{$include_once SRL-OSR/SRL/SRL.simba}
//{$include_once SRL/SRL/misc/PaintSmart.simba}

var
OreDTM: Integer;

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

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Active := True;
Integers[1] := 4; //1=BrightCopper,2=DarkCopper,3=Tin,4=Iron.
Integers[2] := 4; //Seconds to try mining rock before clicking another.
BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];
end;
end;

procedure Antiban();
begin
case Random(25) of
0 :
begin
PickUpMouse;
SleepAndMoveMouse(3000 + Random(500));
PickUpMouse;
end;
1 : GameTab(Tab_Inv);
2 :
begin
RandomAngle(SRL_ANGLE_HIGH);
SetAngle(SRL_ANGLE_HIGH);
end;
3 :
begin
HoverSkill('random', False);
Wait(RandomRange(2500, 3000));
GameTab(Tab_Inv);
end;
end;
end;

function FindMainScreenOre(ClickRocks: Boolean): Boolean;
var
x, y: Integer;
begin
Result := FindObjCustom(X, Y, ['mine', 'rocks'], [2174545, 1450298], 15);
if (Result) and (Clickrocks) then
Mouse(x, y, 5, 5, Mouse_Left);
end;

procedure SetupGlobals();
begin
OreDTM := DTMFromString('mAAEAAHic42FgYBAEYnEglgdiUSBmB2JOIOYFYikgloXKg/gMUFoMqoYRql4YiKWh+lmBmAmqlh+I7ZQloCqJw/8ZSAPEmwzByAAA7yYC/Q==');
end;

procedure FreeGlobals();
begin
FreeDTM(OreDTM);
end;

procedure DropOreFromInv();
var
i, x, y: Integer;
b: TBox;
begin
for i := 1 to 28 do
begin
b := InvBox(i);
if (FindDTM(OreDTM, x, y, b.X1, b.Y1, b.X2, b.Y2)) then
begin
MouseItem(i, Mouse_Right);
WaitOption('rop', 800);
end;
end;
end;

begin
DeclarePlayers;
SetupSRL;
ActivateClient;
LoginPlayer;
SetupGlobals();
AddOnTerminate('FreeGlobals');
repeat
FindMainScreenOre(true);
Antiban();
until(InvCount = 28);
DropOreFromInv();
end.

This isn't so much meant to ``solve'' your problem(s), but it's supposed to help show a better standard that you may or may not learn from. :]
Cheers,
Lj

Thanks for the rewrite but I would love it if people could help fix my script as I wrote it myself and I would not feel right if I was using someone elses.
Cheers.

Le Jingle

2013-04-15 22:42:47

From: mangolee
Thanks for the rewrite but I would love it if people could help fix my script as I wrote it myself and I would not feel right if I was using someone elses.
Cheers.


The main suggestion I would give towards your snippet is to look at the format/standards (can also make use of the built in format-er under Parser tab in Simba) of the code and make sure you understand the logic behind calls , which is illustrated through many tutorials (for different topics usually) in the tutorials section.

mangolee

2013-04-15 23:12:05

From: mangolee
Thanks, this sorted the compiling problems and Simba is returning

SRL Compiled in 0 msec
Compiled successfully in 702 ms.
Successfully executed.

But, its not doing anything and it should right clicking on the Iron Ore (Expresses in the DTM) and selecting the 'Drop' option. I have made sure that the window is selected as the target every thing else works fine. Any suggestions?


Anyone help me with this issue? I have improved my code a little with help of 'Le Jingle', cheers btw, but still I have the same issue.


program PowerMiner;

//{$DEFINE SMART8}
{$i SRL\SRL.simba}
{$i sps/sps.simba}
//{$i SRL\SRL\Misc\paintsmart.simba}
{$i P07Include.simba}
Const
SRLStats_Username = 'bonestriper2';
SRLStats_Password = '';
BreakEvery = 120;
BreakFor = 5;
NumbOfPlayers = 1;
StartPlayer = 0;
procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Active := True;
Integers[1] := 4; //1=BrightCopper,2=DarkCopper,3=Tin,4=Iron.
Integers[2] := 4; //Seconds to try mining rock before clicking another.
end;

end;
Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;
Procedure Antiban;
Begin
Case Random(1) Of

0:Begin WAIT(1) End;
1:Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); PickUpMouse; End;
2:Begin P07_TabInventoryTab(4); End;
3:Begin RandomAngle(SRL_ANGLE_HIGH); SetAngle(SRL_ANGLE_HIGH); End;
4:Begin Wait(1) End;
5:Begin P07_HoverSkill('random',RandomRange(2500,3500)); P07_TabInventoryTab(4); End;

End;
End;
Var
X,Y,OreTime,Slot,SlotPlus,OreDat: Integer;
procedure DropOreFromInv();
var
i, x, y: Integer;
b: TBox;
begin
OreDat := DTMFromString('mAAEAAHic42FgYBBkgABeIBYHYlkgloLyOYGYHYhFgVgeKg8S54fqYQJiVqi8NBALQ9UzQvWKAbGdsgRUhDj8n4E0QLzJEIwMAOk2Av0=');
for i := 1 to 28 do
begin
b := InvBox(i);
if (FindDTM(OreDat, x, y, b.X1, b.Y1, b.X2, b.Y2)) then
begin
MouseItem(i, Mouse_Right);
WaitOption('rop', 800);
end;
end;
end;
Procedure Ore;
Begin
If FindObjCustom(X, Y, ['mine', 'rocks'], [2174545, 1450298], 4) Then
End;
Procedure ClickRock;
Begin
Slot:= SlotPlus;
X:=MSCX;
Y:=MSCY;
MouseSpeed:= 12;
Ore;
Mouse(X ,Y ,10 ,5 ,True);
MarkTime(OreTime);
SlotPlus:= Slot + 1;
WriteLn(Slot);
Wait(10000);
End;
Procedure FreeDTMOre;
Begin
FreeDTM(OreDat);
End;
Begin
SetupSRL;
DeclarePlayers;
ActivateClient;
//Repeat
//ClickRock;
//Antiban;
//Until(Slot > 25);
DropOreFromInv;
FreeDTMOre;
//Wait(12000);
End.

Le Jingle

2013-04-15 23:18:42

From: mangolee
Anyone help me with this issue? I have improved my code a little with help of 'Le Jingle', cheers btw, but still I have the same issue.

.


Try messing around with new DTM's and also try putting a Writeln('yes found it etc. etc.'); before you click on the item when trying to drop it (this way you know if you've entered this part of the code or not)

mangolee

2013-04-16 02:21:23

Ok ill try later tonite, ill get back to you.

Rich

2013-04-16 15:34:24

Begin
If FindObjCustom(X, Y, ['mine', 'rocks'], [2174545, 1450298], 4) Then
End;
I don't think that would even compile, would it?