SRL Archive - First Scripts

Bandit Thiever, Needing help


Littellj

2012-03-06 20:46:59

Ok, I'm trying to make a bandit thiever. I tried in Polliniveach and the colors were not easy to get right so i moved to where everyone attacks then for combat exp. The capes are an easy color to find. I've got the script to Find the color, find the bandit, right click, pickpocket, and continue. This is where i've run into a problem. These bandits add lockpicks and antipoisions to your invy. When it gets full you can't pickpocket. So i created a loop that will pickpocket untill(InvFull). Now i need to drop these 2 items which are random in order. A problem also with this is that i want to not drop the first 6 slots in order to have food there. Later i will add hp check —> eating, then when out of food running to nearby store —> drop first 6 spots (except 1(which contains noted food)) —>unnoteing 5 foods —> and then running back to position. Heres what i got so far.

Pickpocket :)
Dropping :)
Eating/HpCheck :unsure:
Running to bank :unsure:
Dropping first 6 :unsure:
Unnoteing :unsure:
Running back :unsure:

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


Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

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



procedure Antiban;
begin
case Random(90) of
20: HoverSkill('Thieving', False);
30: PickUpMouse;
40: RandomMovement;
50: BoredHuman;
59: ExamineInv;
end;
Writeln('Antiban in action!');
end;



function Bandit: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.42, 0.14);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 1714004, MSX1, MSY1, MSX2, MSY2, 7);
if (Length(arP) = 0) 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;







Procedure Pickpocket;
var
x, y: integer;
begin
repeat
if(not(LoggedIn))then
Exit;

x:=MSCX;
y:=MSCY;

If FindObjTPA(x, y, Bandit, 5, 2, 5, 10, 20,['Atta'])then

begin
WriteLn('Found Bandit');

GetMousePos(x, y);
Mouse(x, y, 10, 10, False);
WaitOption('Pick', 500)
Wait(100)
if pos( 'stunned', GetblackChatMessage) <> 0 then
Case Random(2) of
1:Wait(4000);
2:Antiban;
end;
end;
until(InvFull);
begin
FindNormalRandoms;
WriteLn('This is where we"ll drop');
Wait(15000);

//Droping

end;



end;






begin
Smart_Server := 0;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetUpSRL;
DeclarePlayers;
LoginPlayer;
repeat
FindNormalRandoms;
Pickpocket;
Until(false);

end.

Gucci

2012-03-06 21:00:27

E: oops for got to read if that not first six slots. Make DTM's for the lockpick and for antipoisons and just make a procedure for dropping that finds both items in inventory when InvFull and drop them. I recommend using Demise's DTM Tutorial. I'm sure there's a easier method also something that goes over the inv slots without finding the DTM it's a for..to…do statement, sorry I can't be of much help with the simpler method :p

Littellj

2012-03-06 21:03:15

From: Gucci
For dropping use:

procedure Dropping;
begin
if (InvFull) then

begin
DropAll; <-- Built into SRL and will drop everything in inventory.
end;
end;



How would i exclude certain inventory slots, I would like to have food stored in the first 6 slots and not have to drop them.

tehq

2012-03-06 21:40:12

From: Littellj
How would i exclude certain inventory slots, I would like to have food stored in the first 6 slots and not have to drop them.

Typing on my phone so we'll see how this comes out

For i:=(#inv slot first item to drop) to 28 do ..

Littellj

2012-03-06 22:24:16

Ok so i looked around at YoHoJo's tut and his powerminner and found a possible way to do it. I think i have the code correct except i get error

[Error] (87:3): Duplicate identifier 'DropPattern' at line 86
Compiling failed.

Ideas?


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


Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

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




procedure StatsGuise(wat:String);
begin
StatsGuise(wat);
Disguise(wat);
end;



procedure Antiban;
begin
case Random(90) of
20: HoverSkill('Thieving', False);
30: PickUpMouse;
40: RandomMovement;
50: BoredHuman;
59: ExamineInv;
end;
Writeln('Antiban in action!');
end;



function Bandit: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.42, 0.14);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 1714004, MSX1, MSY1, MSX2, MSY2, 7);
if (Length(arP) = 0) 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;

///////////////Taken from YoHoJo's powerminner////////////

Procedure DropJunk;
var
x, y, Needle, Antipoision, I: Integer;
SlotBox:TBox;
DropPattern:TIntegerArray; <----Error Line

begin
Lockpick:= DTMFromString('mrAAAAHic42BgYOhjZmCYD8QzgHgiELcDcQsQtwJxDxBXMDIwFAJxHhAXAXE9ELcAcQcQ1wKxnbU10BQmPBg/YCSAYQAA5GsJNg==');
Antipoision:= DTMFromString('mAAEAAHiclc0xDkBQFETRebTWYGmCgiBYhpKSRiKhQmzRTX6j9G9ymmkmklSEToUaLXp0KJEiQYYch0kjJizYzG0nblzYsWLG8DS8BB7+F8M8fXsB8IkOcA==');
DropPattern:= [9,13,17,21,25,10,14,18,22,26,7,11,15,19,23,27,8,12,16,20,24,28];

for I:= 0 to 21 do
Begin
SlotBox:= InvBox(DropPattern[I]);
if FindDTM(Lockpick,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Or
FindDTm(Antipoision,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
Begin
MouseItem(DropPattern[I], False);
WaitOption('Dro', 500);
end;
end;

FreeDTM(Needle);
FreeDTM(Antipoision);

end;

Procedure Pickpocket;
var
x, y: integer;
begin
repeat
if(not(LoggedIn))then
Exit;

x:=MSCX;
y:=MSCY;

If FindObjTPA(x, y, Bandit, 5, 2, 5, 10, 20,['Atta'])then

begin
WriteLn('Found Bandit');

GetMousePos(x, y);
Mouse(x, y, 10, 10, False);
WaitOption('Pick', 500)
Wait(100)
if pos( 'stunned', GetblackChatMessage) <> 0 then
Case Random(2) of
1:Wait(4000);
2:Antiban;
end;
end;
until(InvFull);
begin
FindNormalRandoms;
WriteLn('Dropping');
DropJunk;
//Droping

end;


end;






begin
Smart_Server := 0;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetUpSRL;
DeclarePlayers;
LoginPlayer;
repeat
FindNormalRandoms;
Pickpocket;
Until(false);

end.

tehq

2012-03-07 15:06:34

From: Littellj
Ok so i looked around at YoHoJo's tut and his powerminner and found a possible way to do it. I think i have the code correct except i get error

[Error] (87:3): Duplicate identifier 'DropPattern' at line 86
Compiling failed.

Ideas?


Try using DropPattern(dp_Random);

Littellj

2012-03-07 18:55:53

Had to use a different method but got the Dropping working, going back over my code to try and make the AutoColor only run once instead of doing it every round like it is doing. This should make it pick faster = more exp :)

Psilocybin

2012-03-07 19:01:19

i wouldnt use autocolor on anything but on the minimap. everything else just pick color and find it with some tolerance. You already know how to use ACA it shouldnt be hard to figure out how to use that and find ur bandit effectively!

Littellj

2012-03-07 20:56:47

From: Psilocybin
i wouldnt use autocolor on anything but on the minimap. everything else just pick color and find it with some tolerance. You already know how to use ACA it shouldnt be hard to figure out how to use that and find ur bandit effectively!


Ok ill play around with this until there's a way to make it a constant integer.

Update:

Got the dropping working :)

It sometimes finds the blackchat 'fail' and does the correct procedure of wait, antiban, or HpCheck but most of the time misses this and keeps clicking pick while stunned… Which could be a big problem if it misses a bunch in a row b/c it does a HpCheck if stunned. So if anyone has a fix to this, help a brother out 'lol'. :)


I know the code looks ugly but ill worry about that once i get it working.




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



Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

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




procedure StatsGuise(wat:String);
begin
StatsGuise(wat);
Disguise(wat);
end;



procedure Antiban;
begin
case Random(90) of
20: HoverSkill('Thieving', False);
30: PickUpMouse;
40: RandomMovement;
50: BoredHuman;
59: ExamineInv;
end;
Writeln('Antiban in action!');
Wait(2000 + Random(500));
end;



function Bandit: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.42, 0.14);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 1714004, MSX1, MSY1, MSX2, MSY2, 7);
if (Length(arP) = 0) 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;



Procedure FastDropSlot(Slot: Integer);
Var
TB: TBox;
begin
Case Slot of

7: TB := IntToBox(648,250,682,280);
8: TB := IntToBox(690,250,724,280);

9: TB := IntToBox(564,286,598,316);
10: TB := IntToBox(606,286,640,316);
11: TB := IntToBox(648,286,682,316);
12: TB := IntToBox(690,286,724,316);

13: TB := IntToBox(564,322,598,352);
14: TB := IntToBox(606,322,640,352);
15: TB := IntToBox(648,322,682,352);
16: TB := IntToBox(690,322,724,352);

17: TB := IntToBox(564,358,598,388);
18: TB := IntToBox(606,358,640,388);
19: TB := IntToBox(648,358,682,388);
20: TB := IntToBox(690,358,724,388);

21: TB := IntToBox(564,394,598,424);
22: TB := IntToBox(606,394,640,424);
23: TB := IntToBox(648,394,682,424);
24: TB := IntToBox(690,394,724,424);

25: TB := IntToBox(564,430,598,460);
26: TB := IntToBox(606,430,640,460);
27: TB := IntToBox(648,430,682,460);
28: TB := IntToBox(690,430,724,460);
end;

MouseSpeed := RandomRange(26,39);
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, mouse_right);
WaitOptionMulti(['Drop', 'rop R', 'op R'], 400);
end;



Procedure DropRemaining;
Var
I: Integer;
begin

For I := 8 downto 7 do
begin
if (I = 9) then
Break;
FastDropSlot(I);
end;

For I := 9 to high(12) do
begin
if (I = 13) then
Break;
FastDropSlot(I);
end;

For I := 16 downto 13 do
begin
if (I = 17) then
Break;
FastDropSlot(I);
end;

For I := 17 to high(20) do
begin
if (I = 21) then
Break;
FastDropSlot(I);
end;

For I := 24 downto 21 do
begin
if (I = 25) then
Break;
FastDropSlot(I);
end;

For I := 25 to high(28) do
begin
if (I = 29) then
Break;
FastDropSlot(I);
end;
end;



procedure EatFood;
var
Food: integer;
x, y: integer;
begin
//change to lobs**
Food := DTMFromString('mAAEAAHic42FgYJjAzMAwBYg7gbgFijuhYjOBeAEUzwXieUAcxsjAEAjFIHYMECcAcRwQx0LZkUAcBMS+QBzgbgu0hYkETBpgJBEjAwDd9gw2');
GameTab(tab_Inv);
wait(100+random(20));
FindNormalRandoms;

if FindBitmapToleranceIn(Food, x, y, MIX1, MIY1, MIX2, MIY2, 20) then
begin
Mouse(x, y, 2, 2, true); // leftclick food
writeln('Eat yo Food!');
wait(1000+random(200));

end;
FreeBitmap(Food);
end;



Procedure HpCheck;
begin
WriteLn('Checking HP');
if (HPPercent < 40) then
begin
repeat
FindNormalRandoms;
EatFood;
until(HPPercent > 90) //should eat all 5 foods in invy --> need to restock
//begin
//walk to store
//sell noted
//buy unnoted
//return to spot
//end; ---> Will return into pickpocketing procedure.
end;
if (HPPercent > 40) then

Case Random(2) of
1:AntiBan;
2:Wait(3500 + Random(500));
end;
end;


Procedure Pickpocket;
var
x, y: Integer;
begin
repeat
if(not(LoggedIn))then
Exit;

SetAngle(SRL_ANGLE_HIGH);
x:=MSCX;
y:=MSCY;

If FindObjTPA(x, y, Bandit, 5, 2, 5, 10, 20,['Atta'])then

begin
WriteLn('Found Bandit');

GetMousePos(x, y);
Mouse(x, y, 5, 5, False);
WaitOption('Pick', 500)
end;


If FindBlackChatMessage('ail') Then
begin
WriteLn('Stunned')
HpCheck;
end;
//find Fail here
//begin
//HpCheck; //Antiban or Wait if HPPercent > 40

//maybe put if (not(find fail) continue???
until(InvFull);

begin
FindNormalRandoms;
WriteLn('Droping');

DropRemaining;

end;


end;




begin
Smart_Server := 0;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetUpSRL;
DeclarePlayers;
LoginPlayer;
repeat
FindNormalRandoms;
Pickpocket;
Until(AllPlayersInactive);

end.