SRL Archive - OSR Help

why my bot wont att a bear?


sibeliina

2012-01-05 15:09:48

heres the code :
program new;
{$Define Smart}
{$i srl/srl.scar}

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

Players[0].Name :='ojd67';
Players[0].Pass :='';
Players[0].Nick :='jd67';
Players[0].Active:=True;
end;


function BearColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 3290164, MMX1, MMY1, MMX2, MMY2, 3);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
Exit;
end;

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

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 16.65) and (H <= 16.69) and (S >= 1.90) and (S <= 3.05) and (L >= 19.39) and (L <= 20.41) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 3.06) and (X <= 3.36) and (Y >= 3.26) and (Y <= 3.56) and (Z >= 3.25) and (Z <= 3.66) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);

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

procedure Bearkiller;
var x, y: integer;
begin
if FindObj(x, y, 'ttack', Bearcolor, 35) then
begin
Mouse(x, y, 2, 2, false);
ChooseOption('ttack');
end;

end;














begin
Smart_Server:= 11;
Smart_Members:= False;
Smart_Signed:= True;
ClearDebug();
SetupSRL();
DeclarePlayers;
LoginPlayer;
bearkiller;

end.
please help : l

ShawnjohnSJ

2012-01-05 15:14:48

To be honest it could be any number of things. I can't help since I don't have Simba, but you need to debug your script. For example, put "writeln('GOT HERE');" inside an "IF" statement to make sure its actually getting inside that IF statement like its supposed to. That will narrow down your problem.

wantonman

2012-01-05 15:15:36

"Bearcolor" Really? i hope you did not actually use this…. nvm would not compile anyways. no but seriously check your colors and make sure you have enough. Run Escape changes colors slightly after each log in so your going to have to compensate!:spongebob::spongebob::spongebob:

sibeliina

2012-01-05 15:26:32

From: wantonman
"Bearcolor" Really? i hope you did not actually use this…. nvm would not compile anyways. no but seriously check your colors and make sure you have enough. Run Escape changes colors slightly after each log in so your going to have to compensate!:spongebob::spongebob::spongebob:


lmao it compiles fine! :) i just used that color thing becAUSE i first tested it with sheeps by removing their wool with shears and it worked perfectly… but then i changed those things to ''ttack'' etc.. idk why it wont on bear lol

sibeliina

2012-01-05 16:49:00

bumb need help

bud_wis_er_420

2012-01-05 17:12:06

I finally found a black bear took a color from it (3487543). Click play and it found it no problem.

FindColorsSpiralTolerance(MMCX, MMCY, arP, 3487543 , MMX1, MMY1, MMX2, MMY2, 3);       

sibeliina

2012-01-06 10:37:49

oh it must change dif color coz had to restart smart everytime i tested that code : l is there a way that i dont need restart the client? i mean it would just start the script from client witch is already open? and how can i make it to right click then choose attack?

Mat

2012-01-06 12:07:01

FindColorsSpiralTolerance(MMCX, MMCY, arP, 3487543 , {MMX1, MMY1, MMX2, MMY2}, 3);       
In blue your saying if it finds the colour in the Mini Map.
Try this:
program new;
{$Define Smart}
{$i srl/srl.scar}

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

Players[0].Name :='ojd67';
Players[0].Pass :='';
Players[0].Nick :='jd67';
Players[0].Active:=True;
end;


function BearColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 3290164, MSX1, MSY1, MSX2, MSY2, 3);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
Exit;
end;

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

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 16.65) and (H <= 16.69) and (S >= 1.90) and (S <= 3.05) and (L >= 19.39) and (L <= 20.41) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 3.06) and (X <= 3.36) and (Y >= 3.26) and (Y <= 3.56) and (Z >= 3.25) and (Z <= 3.66) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);

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

procedure Bearkiller;
var x, y: integer;
begin
if FindObj(x, y, 'ttack', Bearcolor, 35) then
begin
Mouse(x, y, 2, 2, false);
ChooseOption('ttack');
end;

end;














begin
Smart_Server:= 11;
Smart_Members:= False;
Smart_Signed:= True;
ClearDebug();
SetupSRL();
DeclarePlayers;
LoginPlayer;
bearkiller;

end.
Mat

Sin

2012-01-06 12:21:39

Mat found your problem, you know what to do now :)

Mat

2012-01-06 12:50:07

Tip for the Future when using the Program to make the ACA there's a option at the bottom when you go to create the function Select Main Screen, as its default on MiniMap.
Mat

sibeliina

2012-01-06 13:31:39

lol i tought i changed that lol but i probs forgot to change it: l

sibeliina

2012-01-06 13:39:57

and how about that right click ? how can i get it to right click and then choose attack?:o

Griff

2012-01-06 13:43:24

From: sibeliina
and how about that right click ? how can i get it to right click and then choose attack?:o


Like Align did a few posts up,

Mouse(x, y, 2, 2, false);
ChooseOption('ttack');

(True in Mouse is left click, false is right)

sibeliina

2012-01-06 13:59:27

oh it must change dif color coz had to restart smart everytime i tested that code : l is there a way that i dont need restart the client?


how about that?

x[Warrior]x3500

2012-01-06 14:27:34

add:

Smart_Server := 10; // change 10 to whatever u want

add this before setupsrl;
the issue is that u keep connecting to different servers, thus having to completely restart smart every time

sibeliina

2012-01-06 15:11:18

does this mean that it wont find that color? or what is it?:
AutoColor = 10926783
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Successfully executed.

wantonman

2012-01-06 15:12:52

when using color you should always use the different colors they switch out every so often in my opinion, and also yohojo has a decent tutorial on youtube for find objTPA you might find that handy… its under the tree choping tut either 1 or 2 im not sure…:spongebob::spongebob::spongebob:



by the way
You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
this hast to do with coordinates… it doesnt necessarily mean it cant run but basically your client runs from (0, 0) till iono around (2000 , 2000 ) and if you put X - 5 or something the script thinks you go negative five… that's all…
:spongebob::spongebob::spongebob:

sibeliina

2012-01-06 15:14:28

i got this working ;P next need to learn sps walking :P

sibeliina

2012-01-06 15:18:59

ok 1 more question… how can i set bot to notice when npc like guard dies? and then waits like 2 secs?