SRL Archive - SRL Archives

2 new npc things


1337_macro

2006-10-02 02:26:42

Ya i was bored and i rly want to help out srl so i was scanning though srl to see what they dont have then the npcs came up…so i made a procedure and a funtion for em

Note these are for use with talking to npcs such ass the rune ess guy and like the armor smithing guy (lol i dont play rs too much) lol not atking npcs





{*******************************************************************************
Function ScanForNpc(Name: String; NpcColor, Timeout, Tolerence:Integer):boolean;
By: 1337_Macro
Description:Will scan the main screen for a npc in a ever widining circle untill found then returns true
Arguments: Name=Name of the npc, Timeout is the max time in seconds u want it to run before it stops, Tolerance of the color.
*******************************************************************************}
Function ScanForNpc(Name: String; NpcColor, Timeout, Tolerence:Integer):boolean;
var
a1, b1, c1, d1:Integer;
x1,y1,timeouttime: Integer;
Found:boolean;
begin
Result:=false;
Marktime(timeouttime)
a1 := 184;
b1 := 118;
c1 := 311;
d1 := 219;
repeat
if (FindColorTolerance(x1, y1, NpcColor,A1,B1,C1,D1, Tolerence)) then
MMouse(x1, y1, 5, 5)
if (IsUpText(Name)) then
begin
Mouse(x1,y1,3,3,true)
Break;
Found:=True;
end
if (not(IsUpText(Name))) then
begin
a1 := a1+10;
b1 := b1+10;
c1 := c1+10;
d1 := d1+10;
end;
until (Timefrommark(timeouttime)/1000>=timeout) or (result) ;
end;


This one is the same as the above but this will phisicly click the npc when forund


{*******************************************************************************
Procedure ScanAndClickNpc(Name: String; NpcColor, Timeout, Tolerence:Integer);
By: 1337_Macro
Description:Will scan the main screen for a npc in a ever widining circle untill found then Click on npc
Arguments: Name=Name of the npc, Timeout is the max time in seconds u want it to run before it stops, Tolerance of the color.
*******************************************************************************}
Procedure ScanAndClickNpc(Name: String; NpcColor, Timeout, Tolerence:Integer);
var
a1, b1, c1, d1:Integer;
x1,y1,timeouttime: Integer;
Found:boolean;
begin
Marktime(timeouttime)
a1 := 184;
b1 := 118;
c1 := 311;
d1 := 219;
Found:=false;
repeat
if (FindColorTolerance(x1, y1, NpcColor,A1,B1,C1,D1, Tolerence)) then
MMouse(x1, y1, 5, 5)
if (IsUpText(Name)) then
begin
Mouse(x1,y1,3,3,true)
Break;
Found:=True;
end
if (not(IsUpText(Name))) then
begin
a1 := a1+10;
b1 := b1+10;
c1 := c1+10;
d1 := d1+10;
end;
until (Timefrommark(timeouttime)/1000>=timeout) or (found) ;
end;


Yakman

2006-10-02 02:36:11

you can use that for anything, not just NPCs, anything that has an UpText

warship45

2006-10-02 07:15:29

code looks good however i perfer to use my own functions to do the same job i will give them a try when i get back onto my pc later tonight

1337_macro

2006-10-02 13:10:46

Hey u guys rly fail to realize what srl is all about… Making the best include to make it easy to make complex scripts that have a high rate of accuracy.

yakman i know it can be use for anything not just npcs but its nice to have for newbie srl scripters to come in and find that in there. saves em like a half hour of making it on their own

Ruroken

2006-10-20 17:25:10

i like them….

warship45

2006-10-20 17:40:24

yes but also srl is for people to still have to have skill to program them other wise it is just the dev's that are doing the realy programing the rest of use would just be like linking procedurs that is not programing. srl is to make things easyer but also to keep part of the scar programing alive and rs cheating with it.

Mutant Squirrle

2006-10-20 18:40:13

looks pretty good

YoHoJo

2006-10-20 19:39:17

this:
repeat if (FindColorTolerance(x1, y1, NpcColor,A1,B1,C1,D1, Tolerence)) then
MMouse(x1, y1, 5, 5) if (IsUpText(Name)) then begin
Mouse(x1,y1,3,3,true)

is detectable change it to

repeat if (FindColorTolerance(x1, y1, NpcColor,A1,B1,C1,D1, Tolerence)) then
MMouse(x1, y1, 5, 5) if (IsUpText(Name)) then begin
Mouse(x1,y1,0,0true)//change this to 0,0

1337_macro

2006-12-03 13:08:05

lol maybe uim not understanding… ur saying the 3,3 is more detectable than the 0,0? no the 3,3 is more undetectable because it travles a random 3 pixals off ot the color…

Boreas

2006-12-03 13:42:02

You are moving to a point and then milliseconds (the time it takes to check uptext) later you are moving to another point.

I think yohojo meant to put getmousepos(x1,y1) before the mouse. This way it will click in the same place it moved to.

yohojo's (and my) way is makes it look like you are clicking normally, because there is time in between moving and and pressing the mouse button normally, and that time is where the uptext check is. Thats if the uptext is found, if not, then it will look like just a movement.

marpis

2009-05-06 08:44:20


if (FindColorTolerance(x1, y1, NpcColor,A1,B1,C1,D1, Tolerence)) then
MMouse(x1, y1, 5, 5)
if (IsUpText(Name)) then
begin
GetMousePos(x1, y1);
Mouse(x1,y1,0,0,true)
Break;
Found:=True;
end
this is what Boreas meant above.

Nice functions, but you could make it possible for users to declare the center of the 'circle', which is actually a growing square. And your first function now leftclicks the object, and was that what you wanted it to do?

Also you could name it something else, because you can look many other things than NPCs too.

Hobbit

2009-05-06 09:52:37

old much?

Boreas last reply -> 12-03-2006, 10:42 AM