SRL Archive - Help

[I'm a newbiie] Locating Npc's and clicking on them


0wned2death1

2012-05-01 01:44:16

Alright, sorry if this sounds stupid as hell but I'm pretty new at this stuff.

I've seen a few tutorials but they're all mainly involve clicking on a tree which I know is FindObj. I'm pretty sure a npc is not an object so here I am..

How would I make it locate a nearby npc and click on it?


If anyone could be helpful or link me to a tutorial on that, I'll greatly appreciate it c:

Thanks

Abu

2012-05-01 01:50:05

You can find a lot of tutorials in the Tutorial Island

However for what you are looking for:
http://villavu.com/forum/showthread.php?t=76005

0wned2death1

2012-05-01 01:55:15

From: abu_jwka
You can find a lot of tutorials in the Tutorial Island

However for what you are looking for:
http://villavu.com/forum/showthread.php?t=76005


Thanks for your help; I'v searched on tutorial island and haven't found one. In fact, the only one I did find was the one that you suggested and for some reason, it gives me errors :\

YoHoJo

2012-05-01 02:09:56

This should also help a lot.
http://www.youtube.com/watch?v=98wVrr6GwyU&feature=youtu.be

Abu

2012-05-01 02:11:03

From: 0wned2death1
Thanks for your help; I'v searched on tutorial island and haven't found one. In fact, the only one I did find was the one that you suggested and for some reason, it gives me errors :\


You should follow tutorials more carefully. As well as copying the procedures (just fine), you should try and learn in the process. :)

johnbrown8976

2012-05-01 02:24:00

From: 0wned2death1
Alright, sorry if this sounds stupid as hell but I'm pretty new at this stuff.

I've seen a few tutorials but they're all mainly involve clicking on a tree which I know is FindObj. I'm pretty sure a npc is not an object so here I am..

How would I make it locate a nearby npc and click on it?


If anyone could be helpful or link me to a tutorial on that, I'll greatly appreciate it c:

Thanks


I believe, NPC is also an object. Everything is an object. The function FindObj() finds anything with the given color, tolerance and upText.
A rough example to find Banker would be

var
x, y, color, tolerance: Integer;

Function findBanker:Boolean;
begin
Result := FindObj(x, y, 'anker', color, tolerance);
end;

0wned2death1

2012-05-01 02:34:45

From: YoHoJo
This should also help a lot.
http://www.youtube.com/watch?v=98wVrr6GwyU&feature=youtu.be


I already know how to use that :p


And to everyone else, thanks heaps for the support x3 Specially Johnny, thanks for that info!


Edit: By the way, that just means the bot puts the mouse over the banker but doesn't actually click on him, right?

Abu

2012-05-01 02:42:45

From: 0wned2death1

Edit: By the way, that just means the bot puts the mouse over the banker but doesn't actually click on him, right?


In the example John gave, it won't do that either. It simply send back the co-ordinates the object/npc was found at. You then have to move the mouse yourself via MMouse or Mouse.

0wned2death1

2012-05-01 02:46:10

From: abu_jwka
In the example John gave, it won't do that either. It simply send back the co-ordinates the object/npc was found at. You then have to move the mouse yourself via MMouse or Mouse.


I'm so confused.. Is it okay if I post my code so far and you can check why I'm getting an error?

It says:

SRL Compiled in 0 msec
SMART Initialized.
Loaded: Server 41, Members: False, Signed: True, Super Detail: False.
Error: Exception: Access violation at line 142
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]

Abu

2012-05-01 02:47:05

From: 0wned2death1
I'm so confused.. Is it okay if I post my code so far and you can check why I'm getting an error?


Sure. :)

0wned2death1

2012-05-01 02:49:17

Thanks heaps :3

program RuneSpan_Soul;
{$DEFINE SMART}
{$DEFINE SMART}
//{$I SRL/SRL.scar}
{$i srl/srl.simba}
//{$I MyFunc.scar}
{$i sps/sps.simba}


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

Players[0].Name :=''; //username
Players[0].Pass :=''; //password
Players[0].Nick :=''; //nick
Players[0].Active:=True;
end;



function EsswraithColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 1.73);

if not (FindColorsTolerance(arP, 13283397, MSX1, MSY1, MSX2, MSY2, 25)) 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;
Writeln('AutoColor = ' + IntToStr(arC));
Break;
end;

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

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



begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
end.

Abu

2012-05-01 02:51:55

lol!

Don't mean to laugh but you had your slash's (/) the wrong way round :p

Should be this way:
{$i srl\srl.simba
{$i sps\sps.simba}

Now compiles :D

0wned2death1

2012-05-01 02:56:08

From: abu_jwka
lol!

Don't mean to laugh but you had your slash's (/) the wrong way round :p

Should be this way:
{$i srl\srl.simba
{$i sps\sps.simba}

Now compiles :D


Lmfaoo, just did and still got same error haha. Do you have msn or somethingg?

Abu

2012-05-01 02:59:41

Sorry but I have to go now :(

Are you sure this doesn't compile?

{$DEFINE SMART}
{$DEFINE SMART}
{$i srl\srl.simba}
{$i sps\sps.simba}


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

Players[0].Name :=''; //username
Players[0].Pass :=''; //password
Players[0].Nick :=''; //nick
Players[0].Active:=True;
end;



function EsswraithColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 1.73);

if not (FindColorsTolerance(arP, 13283397, MSX1, MSY1, MSX2, MSY2, 25)) 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;



begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
end.

0wned2death1

2012-05-01 03:02:06

From: abu_jwka
Sorry but I have to go now :(

Are you sure this doesn't compile?

{$DEFINE SMART}
{$DEFINE SMART}
{$i srl\srl.simba}
{$i sps\sps.simba}


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

Players[0].Name :=''; //username
Players[0].Pass :=''; //password
Players[0].Nick :=''; //nick
Players[0].Active:=True;
end;



function EsswraithColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 1.73);

if not (FindColorsTolerance(arP, 13283397, MSX1, MSY1, MSX2, MSY2, 25)) 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;



begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
end.



Yeah, heres a screenshot

http://screensnapr.com/v/oetx0l.jpg

Element17

2012-05-01 09:01:51

{$i srl\srl.simba}
{$i sps\sps.simba}


{$DEFINE SMART}
{$i srl\srl.simba}
{$i sps\sps.simba}


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

Players[0].Name :=''; //username
Players[0].Pass :=''; //password
Players[0].Nick :=''; //nick
Players[0].Active:=True;
end;



function EsswraithColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 1.73);

if not (FindColorsTolerance(arP, 13283397, MSX1, MSY1, MSX2, MSY2, 25)) 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;



begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
end.

Works for me, also you do no this is just giving you the color.