PDA

View Full Version : NpcFindNClick;//i must say it works good



ShowerThoughts
10-27-2007, 05:10 PM
updated!

program NPCFinder;
{.include SRL/SRL.Scar}

{==============================]
Function:FindClickNpc
by:Hermpie
Info:you could use it like this,
NPCFindNClick(Color1,Color2,'uptext1','uptext2','r ade',InFight,False,10);
[==============================}
Function NPCFindNClick( NPCColor1, NPCColor2:integer; UpText1,UpText2, COption:string;RepeatUntil, RightOrLeft:boolean;
HMTolerance:integer):boolean;
var
TMT :Integer;
Coord123X :Integer;
Coord123Y :Integer;
T:integer;
begin
TMT:=0;
repeat
FindTalk;
TMT:=TMT + 1
Wait(50+random(10));
if FindObjCustom(Coord123X, Coord123Y, [Uptext1, Uptext2], [NPCColor1, NPCColor2],HMTolerance) then//Thanks killerDou!:)
begin
T := GetSystemTime;
Wait(50+random(10));
Mouse(Coord123X, Coord123Y, 1, 1, RightOrLeft);
Wait(50+random(10));
if (RightOrLeft=False) then
begin
if ChooseOption(COption) then
begin
Result:=True;
WriteLn('Found Npc');
Break;
end;
end;
end;
until (RepeatUntil) or (TMT>10)
if RepeatUntil then Result:=true;
Writeln(IntToStr(GetSystemTime - T));
end;


Begin
SetupSrl;
NPCFindNClick(1,1,'uptext1','uptext2','rade',InFig ht,False,10);
end.


-Hermpie(pls change my first letter to a capital'H')

Bobzilla69
10-27-2007, 05:45 PM
i like this, think its a good idea, i might use it, not sure yet

ShowerThoughts
10-27-2007, 05:52 PM
just try ;)

Bobzilla69
10-27-2007, 07:43 PM
ok coz u ask nicely i will have a go, i might even add it into my script :P

ShowerThoughts
10-27-2007, 08:00 PM
kk ty ;)

Lacky
10-28-2007, 01:19 AM
Damn you're smexy... :p

Dumpin
10-28-2007, 03:25 PM
simple but efficient, Very usefully for beginners, especially when they are making their first script with walk / talk :)

ShowerThoughts
10-28-2007, 04:25 PM
thank you!

MasterKill
10-28-2007, 06:08 PM
nice but you got some much to fill in for those poor starting scripters :(

I made an sort of eddited version:
{************************************************* ******************************
Function FindAndClickNPC(NpcColors: TIntegerArray; UpTexts: TStringArray;
RChooseOption :string; RightOrLeftNpcClick:boolean; HMTolerance: integer;):boolean;
Started by: Hermpie.
modified by: MasterKill.
Description: Finds and clicks an NPC
Use: FindAndClickNPC([123456, 345678], ['ancelot', 'Sir'], 'Talk', False, 5)
************************************************** *****************************}
Function FindAndClickNPC(NpcColors: TIntegerArray; UpTexts: TStringArray; RChooseOption :string; RightOrLeftNpcClick:boolean; HMTolerance: integer):boolean;
var
Coord123X, Coord123Y :Integer;
begin
repeat
if FindObjCustom(Coord123X, Coord123Y, UpTexts, NpcColors, HMTolerance) then
begin
If RightOrLeftNpcClick then
begin
Mouse(Coord123X, Coord123Y, 0, 0, True);
Result := True;
WriteLn('Found NPC');
exit;
end else
begin
Mouse(Coord123X, Coord123Y, 0, 0, False);
Wait(50 + random(100));
if ChooseOption(RChooseOption) then
begin
Result:=True;
WriteLn('Found NPC');
Exit;
end else WriteLn('NPC missclick!');
end;
end else
begin
WriteLn('not found NPC!');
Result := False;
exit;
end;
until(False)
end;

didn't test it but should be working

ShowerThoughts
10-28-2007, 06:13 PM
kk lol but mine is better;) i mean got more options ;)

MasterKill
10-28-2007, 06:15 PM
i said THAT might be a problem, that's why i made A better one :) :D

I also used some T Arays

ShowerThoughts
10-28-2007, 06:15 PM
lol but more options is better less is EASIER not better ;)

MasterKill
10-28-2007, 06:18 PM
nope, it's harder to fill in, and you allways needed to pick 2 colors, you can easely use 1 color now.

most options you use are kinda unless ;)

you don't have to thank me...

ShowerThoughts
10-28-2007, 06:19 PM
my thing can loop and will wait after you can say until click to continue or this tries its a bit harder to fill in but if you know how to use its better ;)

msn?, you and me are spamming right now...

Santa_Clause
10-29-2007, 11:00 AM
For the colours, use a TIntegerArray so they can put as many colours as they like...

function FindNPC(Colours : TIntegerArray) : Boolean;
begin
for I := 0 to GetArrayLength(Colours) - 1 do


And so on...

MasterKill
10-29-2007, 01:43 PM
For the colours, use a TIntegerArray so they can put as many colours as they like...

function FindNPC(Colours : TIntegerArray) : Boolean;
begin
for I := 0 to GetArrayLength(Colours) - 1 do


And so on...

see post #9 m8 :)

ShowerThoughts
10-29-2007, 02:37 PM
you changed the credit! when you gave your ''easier but not better version'' to him you changed the credit!

the scar noob
10-30-2007, 12:32 PM
nice but you got some much to fill in for those poor starting scripters :(

I made an sort of eddited version:
{************************************************* ******************************
Function FindAndClickNPC(NpcColors: TIntegerArray; UpTexts: TStringArray;
RChooseOption :string; RightOrLeftNpcClick:boolean; HMTolerance: integer;):boolean;
Started by: Hermpie.
modified by: MasterKill.
Description: Finds and clicks an NPC
Use: FindAndClickNPC([123456, 345678], ['ancelot', 'Sir'], 'Talk', False, 5)
************************************************** *****************************}
Function FindAndClickNPC(NpcColors: TIntegerArray; UpTexts: TStringArray; RChooseOption :string; RightOrLeftNpcClick:boolean; HMTolerance: integer):boolean;
var
Coord123X, Coord123Y :Integer;
begin
repeat
if FindObjCustom(Coord123X, Coord123Y, UpTexts, NpcColors, HMTolerance) then
begin
If RightOrLeftNpcClick then
begin
Mouse(Coord123X, Coord123Y, 0, 0, True);
Result := True;
WriteLn('Found NPC');
exit;
end else
begin
Mouse(Coord123X, Coord123Y, 0, 0, False);
Wait(50 + random(100));
if ChooseOption(RChooseOption) then
begin
Result:=True;
WriteLn('Found NPC');
Exit;
end else WriteLn('NPC missclick!');
end;
end else
begin
WriteLn('not found NPC!');
Result := False;
exit;
end;
until(False)
end;

didn't test it but should be working
Heheh, I saw his functino were you could input 2 colors, I thought, I'll tell hem to use TIntegerArray.
I scrolled down the page and I saw your edited version, which includes TIntegerArray:D

However, good try hermpie, we finally see something better from you:).

-Tsn.

Naum
10-30-2007, 05:48 PM
Very Good Altough if someone was a 'poor scripter' they would want to use the function but keep frogetting it. I liked MasterKill's Version better because it is easier to understand but who knows?

->{Nauamn}<-

ShowerThoughts
10-30-2007, 07:36 PM
updated!

removed the realy realy ussless stuff and keep the good stuff it got 1/2 more options then masterkills one but its better i swear ;)

MasterKill
10-30-2007, 09:32 PM
updated!

removed the realy realy ussless stuff and keep the good stuff it got 1/2 more options then masterkills one but its better i swear ;)

i would not say that hermpie.... :fiery:

this version looks better then your first one.

mat_de_b
10-30-2007, 09:40 PM
Put in arrays! :mad:

man slaughter
11-02-2007, 02:36 PM
im not sure how different this scrip is and the one modified by master kill is but, in heavy world like in varorck shop world 1. it mistakes the shop seller for a player. it happens about once in every 8 times. i eddited the script to make it check if it opened the store trade dialog. its good now. i think this one is better though since it includes a loop. i made a loop personally for master kills one.

ShowerThoughts
11-02-2007, 02:39 PM
im not sure how different this scrip is and the one modified by master kill is but, in heavy world like in varorck shop world 1. it mistakes the shop seller for a player. it happens about once in every 8 times. i eddited the script to make it check if it opened the store trade dialog. its good now. i think this one is better though since it includes a loop. i made a loop personally for master kills one.

thats the point you can do and fill in in my thing like Until foundshopdialog check my version there is somthing called repeat until fill in there the name of your findshopdialog procedure and it works fine ;)

Raskolnikov
11-17-2007, 03:14 AM
updated!

removed the realy realy ussless stuff and keep the good stuff it got 1/2 more options then masterkills one but its better i swear ;)

I am so using this in my next function for pickpocketing people. There are no SRL skill functions for Theiving.

Czepa
11-17-2007, 06:05 AM
Begin
SetupSrl;
NPCFindNClick(1,1,'uptext1','uptext2','rade',InFig ht,False,10);
end.

if you were to use this function in a script you would not SetupSrl; would you?

ShowerThoughts
02-10-2008, 10:16 AM
dude my funtion uses some funtions out of srl duh :S

mixster
02-10-2008, 10:41 AM
You really should turn to the MK side - arrays would be much better for it because you can use as many or as little as you want - afterall, how many uptexts can one shopkeeper have (unless he works shift with a friend). Otherwise, it's a nice little function and I wish I could use it in my next script (alas, not much room for a NPC clicker in a bank'n'chopper).

ShowerThoughts
02-10-2008, 10:47 AM
you can use it for a tree to like this:

Procedure FindOak;
var
TMT,b: Integer;
begin
TMT := 0;
Check;
if (TreeGone = False) then exit;
repeat
TMT := TMT + 1
B := GetSystemTime
if FindObjCustom(X, Y, ['Oak', 'ak'], [OakColor, OakColor2], 10) then
begin
Wait(50+random(20));
Mouse(X, Y, 1, 1, False);
Wait(50+random(20));
if ChooseOption('hop') then
begin
WriteLn('Found Oak');
Break;
end;
end;
until (TMT > 10)
end;

mixster
02-10-2008, 11:13 AM
The only thing is I don't like using FindObj/Custom - much prefer using my own way of doing it - unless it's for uniquely coloured things.

Negaal
02-10-2008, 11:23 AM
11-17-2007

Bit late to answer? :p

Oh anyways, it's basically findobj and clicking...good to learn from it...(I mean failsafes and obj finding):)
Good to see you back...

Edit:
Quess why you gravedigged? You are the *spammasta*
:p:D

ShowerThoughts
02-10-2008, 05:43 PM
spam F
spam U
spam C
spam K

spam Y
spam O
spam U

spam just kidding :P

thanks mate ;)

(you always gravedig like that :S?)

Hermpie