SRL Archive - OSR Help

Check this?


Element17

2012-02-19 21:42:10

program WildyMiner;
//{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}

Const
SERVER = 61; // Enter "0" to pick a random server.
MEMBERS = False; // Set to True if using a RS-Members account. False if F2P.
SRLStats_Username = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
NumbOfPlayers= 1; //How many players are you using
StartPlayer= 0; //Player to start auoting with! (0 means first char)
Version= '1.0'; //NO TOUCHY!

Var
TooLong:Integer;

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.
Nick := ''; //Player nickname - 3-4 letters of Player username.
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;

Function CheckAndClick(X,Y:Integer):Boolean;
Begin
MMouse(x, y, 5, 5);
{Wait(100 + Random(50));
If CountUpColor('B', 41, 5, 86, 24, 70, 140) Then}
If WaitUpTextMulti(['Mine','ine'], 150) Then
Begin
Result:=True;
GetMousePos(x, y);
Mouse(x, y, 0, 0,True);
Wait(100+Random(50));
FFlag(0);
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Mining', 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;
Terminatescript;
End;
function OreColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.05, 0.44);

if not (FindColorsTolerance(arP, 2305354, MSX1, MSY1, MSX2, MSY2, 12)) then
begin
//Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;

Function MineOre: Boolean;
Var
X, Y, PlusOne, OreCounter: Integer;
Begin
MarkTime(TooLong);
FindNormalRandoms;
PlusOne:= InvCount +1;
X:=MSCX;
Y:=MSCY;
If FindObjTPA(X, Y, OreColor, 5, 1, 25, 25, 350, ['Min']) Then
Begin
StatsGuise('We found ore');
GetMousePos(X, Y);

Case Random(2) of
0: Mouse(X, Y, 5, 5, True);
1: Begin
Mouse(X, Y, 5, 5, False);
WaitOption('Mine', 500);
End;
End;

Flag;
MarkTime(OreCounter);
If (TimeFromMark(Toolong) > 25000) Then
FailSafe('Could not find ore');
Repeat;
If (TimeFromMark(Toolong) > 25000) Then
FailSafe('Could not find ore');
FindNormalRandoms;
StatsGuise('AntiBan and Waiting');
Antiban;
Wait(100);
If InvCount=PlusOne Then
Writeln('Ore mined');
Until (InvCount=PlusOne) or (TimeFromMark(OreCounter) > 5000)
End;
End;

Procedure DropOre;
Var
X, Y, OreDTM, I:Integer;
Slotbox:Tbox;
OrePattern:TIntegerArray;

Begin
MarkTime(TooLong);
OreDTM := DTMFromString('m1gAAAHic42JgYHBmYmCwAGI7IHYCYg8gDgRiHyC2B2JjKNZhZGBQBWJZIFYEYnkg1gRiEyC2gtLaQGwkKwo0lYkITBxgJBIjAAA1UATS');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
StatsGuise('Dropping Ore:' + IntToStr(I));
For I:=0 To 27 Do
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTm(OreDTM, X, Y, SlotBox.X1, SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
Begin
FindNormalRandoms;
MouseItem(OrePattern [I],Mouse_Right);
ChooseOption('Dro');
End;
End;
MarkTime(TooLong);

End;


begin

SetupSRL;
DeclarePlayers;
Repeat
MineOre;
DropOre;
Until(false);


end.



You guys see anything wrong in there? Anything I can fix/add? I got a lot of information and used some of YoHoJo stuff from his mining script. I got my own DTM and found my own ore color with ACA. When I run the script it just moves the mouse all over the ground and never clicks anywhere and when it drops ore it drops it and then tries to drop on the same spot again. Any suggestions? Thank you in advance and thank you to YoHoJo for your videos they helped a lot so far.

poopy2177

2012-02-19 22:42:35

Procedure DropOre;
Var
X, Y, OreDTM, I:Integer;
Slotbox:Tbox;
OrePattern:TIntegerArray;

Begin
MarkTime(TooLong);
OreDTM := DTMFromString('m1gAAAHic42JgYHBmYmCwAGI7IHYCYg8gDgRiHyC2B2JjKNZhZGBQBWJZIFYEYnkg1gRiEyC2gtLaQGwkKwo0lYkITBxgJBIjAAA1UATS');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
StatsGuise('Dropping Ore:' + IntToStr(I));
For I:=0 To 27 Do
Repeat////here
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTm(OreDTM, X, Y, SlotBox.X1, SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
Begin
FindNormalRandoms;
MouseItem(OrePattern [I],Mouse_Right);
ChooseOption('Dro');
End;
End;
until(InvEmpty);//////to here
MarkTime(TooLong);

End;
that should fix it… also make sure you are in tolerence 2 in aca sounds like you have some wrong color in there

YoHoJo

2012-02-19 23:03:35

Please post in correct section next time.
This belongs in scripting help section, not tutorials.

Element17

2012-02-20 14:43:23

I changed a few things now it goes to one rock but doesn't click it and will not drop ores at all now.

program WildyMiner;
//{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}

Const
SERVER = 61; // Enter "0" to pick a random server.
MEMBERS = False; // Set to True if using a RS-Members account. False if F2P.
SRLStats_Username = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
NumbOfPlayers= 1; //How many players are you using
StartPlayer= 0; //Player to start auoting with! (0 means first char)
Version= '1.0'; //NO TOUCHY!

Var
TooLong:Integer;

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.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;
end;

end;

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

Function CheckAndClick(X,Y:Integer):Boolean;
Begin
MMouse(x, y, 5, 5);
{Wait(100 + Random(50));
If CountUpColor('B', 41, 5, 86, 24, 70, 140) Then}
If WaitUpTextMulti(['Mine','ine'], 150) Then
Begin
Result:=True;
GetMousePos(x, y);
Mouse(x, y, 0, 0,True);
Wait(100+Random(50));
FFlag(0);
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Mining', 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;
Terminatescript;
End;
function OreColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.05, 0.44);

if not (FindColorsTolerance(arP, 2305354, MSX1, MSY1, MSX2, MSY2, 12)) then
begin
//Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;

Function MineOre: Boolean;
Var
X, Y, PlusOne, OreCounter: Integer;
Begin
If Not LoggedIn then
Exit;
MarkTime(TooLong);
FindNormalRandoms;
PlusOne:= InvCount +1;
X:=MSCX;
Y:=MSCY;
If (Not (FindObjCustom(X, Y, ['Min', 'ine'], [OreColor, OreColor], 7))) Then
Begin
StatsGuise('We found ore');
GetMousePos(X, Y);

Case Random(2) of
0: Mouse(X, Y, 5, 5, True);
1: Begin
Mouse(X, Y, 5, 5, False);
WaitOption('ine', 500);
End;
End;

Flag;
MarkTime(OreCounter);
If (TimeFromMark(Toolong) > 25000) Then
FailSafe('Could not find ore');
Repeat;
If (TimeFromMark(Toolong) > 25000) Then
FailSafe('Could not find ore');
FindNormalRandoms;
StatsGuise('AntiBan and Waiting');
Antiban;
Wait(100);
If InvCount=PlusOne Then
Writeln('Ore mined');
Until (InvCount=PlusOne) or (TimeFromMark(OreCounter) > 5000)
End;
End;

Procedure DropOre;
Var
X, Y, OreDTM, I:Integer;
Slotbox:Tbox;
OrePattern:TIntegerArray;

Begin
MarkTime(TooLong);
OreDTM := DTMFromString('m1gAAAHic42JgYHBmYmCwAGI7IHYCYg8gDgRiHyC2B2JjKNZhZGBQBWJZIFYEYnkg1gRiEyC2gtLaQGwkKwo0lYkITBxgJBIjAAA1UATS');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
StatsGuise('Dropping Ore:' + IntToStr(I));
For I:=0 To 27 Do
Repeat
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTm(OreDTM, X, Y, SlotBox.X1, SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
Begin
FindNormalRandoms;
MouseItem(OrePattern [I],Mouse_Right);
ChooseOption('Dro');
End;
End;
Until(InvEmpty);
MarkTime(TooLong);

End;

begin

SetupSRL;
DeclarePlayers;
Repeat
MineOre;
DropOre;
Until(false);


end.

I don't understand why it wont click the rock, it goes straight to it.
Also could I just use DropAll for the drop function? How much I put that in?
Also in the debug box it says "[Hint] (113:10): Variable 'Result' never used at line 112" Which is Function MineOre: Boolean;

Appreciate any help I get.

poopy2177

2012-02-20 22:39:15

Function MineOre: Boolean;
Var
X, Y, PlusOne, OreCounter: Integer;
Begin
If Not LoggedIn then
Exit;
MarkTime(TooLong);
FindNormalRandoms;
PlusOne:= InvCount +1;
X:=MSCX;
Y:=MSCY;
If (Not (FindObjCustom(X, Y, ['Min', 'ine'], [OreColor, OreColor], 7))) Then //not sure why you put If Not..
Begin
StatsGuise('We found ore');
GetMousePos(X, Y);

Case Random(2) of
0: Mouse(X, Y, 5, 5, True);
1: Begin
Mouse(X, Y, 5, 5, False);
WaitOption('ine', 500);
End;
End;

Flag;
MarkTime(OreCounter);
If (TimeFromMark(Toolong) > 25000) Then
FailSafe('Could not find ore');
Repeat;
If (TimeFromMark(Toolong) > 25000) Then
FailSafe('Could not find ore');
FindNormalRandoms;
StatsGuise('AntiBan and Waiting');
Antiban;
Wait(100);
If InvCount=PlusOne Then
Writeln('Ore mined');
Until (InvCount=PlusOne) or (TimeFromMark(OreCounter) > 5000)
End;
End;



 If (FindObjCustom(X, Y, ['Min', 'ine'], [OreColor, OreColor], 7))then
try that

Rezozo

2012-02-20 22:40:50

If your making a script, and you wish for a tester, I'm your man!
Got to the link in my sig!

Element17

2012-02-22 17:51:03

Poopy thank you that fixed the mining issue, but do you see anything wrong with my drop procedure? I mad the DTM and it matches all the ores and it reads in "Dropping ore 0" but never drops the ores. Could I use drop all? How would I put that in my script?

poopy2177

2012-02-22 18:51:52

Procedure DropOre;
Var
X, Y, OreDTM, I:Integer;
Slotbox:Tbox;
OrePattern:TIntegerArray;

Begin
if InvFull then //try this
begin
MarkTime(TooLong);
OreDTM := DTMFromString('m1gAAAHic42JgYHBmYmCwAGI7IHYCYg8gDgRiHyC2B2JjKNZhZGBQBWJZIFYEYnkg1gRiEyC2gtLaQGwkKwo0lYkITBxgJBIjAAA1UATS');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
StatsGuise('Dropping Ore:' + IntToStr(I));
For I:=0 To 27 Do
Repeat
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTm(OreDTM, X, Y, SlotBox.X1, SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
Begin
FindNormalRandoms;
MMouseItem(OrePattern [I]); //Hmmmm try this I dont know why
Mouse(x,y, 2,2,mouse_Right); // Its not working thats odd
ChooseOption('Dro');
End;
End;
Until(InvEmpty);
MarkTime(TooLong);
end; //to here
End;
I don't know it seems right idk…

Element17

2012-02-22 20:06:31

Its still not working, I think I'm going to just write a new drop process.

lilcmp1

2012-02-22 20:13:08

If you want to use DropAll; you just add in the script instead of your whole drop procedure. Simply

If InvFull Then
Begin
Writeln('Dropping');
DropAll;
End;

Element17

2012-02-23 10:37:25

Thank you for that, I figured out a dropping procedure that works, but is the drop all random? humanlike?