SRL Archive - OSR Help

Talking to npc's


NoUserName

2012-06-03 17:05:14

Hey all

having a few problems talking to npc's ive been looking thro the text and chat files files and cant get anything to click the text for me any idears were im going wrong?


i would like to click yes please


if (ClickContinue(true, false)=true) then
begin
findNPCChatTextMulti(['Yes Please', 'please'], ClickLeft)
ClickContinue(true, false)
end;



thanks

P1ng

2012-06-03 17:55:07

If the text isn't working you could always try making a TBox of the area for it to click, maybe using the white colour from the writing as a check to make sure you should click

Paradoxium

2012-06-03 17:58:46

yeah what p1ng said or a MouseBox :D

NoUserName

2012-06-03 18:20:57

so my code is ok just need to use a diffent method whats this mouse box?

putonajonny

2012-06-03 18:23:32

I find the best thing for chat texts is DTMs:
Procedure HandleChat;
Var
ClickScreen, x, y : integer;
begin

ClickScreen := DTMFromString();
Repeat

if((CountColorTolerance(1137204, 230, 462, 293, 471, 5) > 30) or (CountColorTolerance(2470503, 230, 462, 293, 471, 5) > 30))then
TypeSendEx(' ', False);

if(FindDTM(ClickScreen, x, y, MCX1, MCY1, MCX2, MCY2))then
TypeSendEx('1', False);

Wait(Random(1500));

Until(ChatIsOver);

FreeDTM(ClickScreen);

end;
You can have multiple DTMs if you have multiple screens where you have options

Yago

2012-06-03 18:39:16

You can locate the specific type of text it is, use FindText or one of its variants, and click the x,y that is returned by the find function.

Rich

2012-06-03 18:44:25

From: putonajonny
I find the best thing for chat texts is DTMs:
Procedure HandleChat;
Var
ClickScreen, x, y : integer;
begin

ClickScreen := DTMFromString();
Repeat

if((CountColorTolerance(1137204, 230, 462, 293, 471, 5) > 30) or (CountColorTolerance(2470503, 230, 462, 293, 471, 5) > 30))then
TypeSendEx(' ', False);

if(FindDTM(ClickScreen, x, y, MCX1, MCY1, MCX2, MCY2))then
TypeSendEx('1', False);

Wait(Random(1500));

Until(ChatIsOver);

FreeDTM(ClickScreen);

end;
You can have multiple DTMs if you have multiple screens where you have options
I'd say bitmaps over DTMs for text checking. Not sure why I say that though…

NoUserName

2012-06-03 18:48:42

as i know what the text will be ive just simpley turned to useing

        if (ClickContinue(true, false)=true) then
begin
WriteLn('Talking to boat man...');
wait(1000+random(500));
TypeSendEx('1', False);
wait(1000+random(500));
ClickContinue(true, false);
end;

and as for dtmz i dont know why i feel like it would be a bad idear to reply on them for reading text but i do although your procedure was really nice =]

P1ng

2012-06-03 19:14:31

This procedure will check if the white text is in the chatbox and then if it is present it will click anywhere within the co-ordinates you put into MouseBox

procedure Example;
begin
if FindColorTolerance(x,y,WhiteTextColor,MCX1,MCY1,MCX2,MCY2,tol) then
MouseBox(x1,y1,x2,y2,mouse_Left) else
WriteLn('Didn''t find the text color');
end;

WhiteTextColor = Use colour picker to select the chatbox text color.
tol = Tolerance so it finds the colour every time.
x1,y1 = Start co-ordinates for where the option you want to select is.
x2,y2 = End co-ordinates for where the option you want to select is.

putonajonny

2012-06-03 19:25:49

From: NoUserName
and as for dtmz i dont know why i feel like it would be a bad idear to reply on them for reading text but i do although your procedure was really nice =]


In my experience they work really well, I used them for my quest runner which had a lot of chat screens and it had a perfect success rate for detecting them

NoUserName

2012-06-04 04:11:34

From: p1ng
This procedure will check if the white text is in the chatbox and then if it is present it will click anywhere within the co-ordinates you put into MouseBox

procedure Example;
begin
if FindColorTolerance(x,y,WhiteTextColor,MCX1,MCY1,MCX2,MCY2,tol) then
MouseBox(x1,y1,x2,y2,mouse_Left) else
WriteLn('Didn''t find the text color');
end;

WhiteTextColor = Use colour picker to select the chatbox text color.
tol = Tolerance so it finds the colour every time.
x1,y1 = Start co-ordinates for where the option you want to select is.
x2,y2 = End co-ordinates for where the option you want to select is.


god idea but wont it just click on no a % off the time as it will find the text no also?

CephaXz

2012-06-04 04:55:57

Isn't it because the text you typed is wrong?


if (ClickContinue(true, false)=true) then
begin
findNPCChatTextMulti(['Yes Please', 'please'], ClickLeft); //Should be Yes please, without capital P
//Or just use this:
//findNPCChatText('please', Clickleft);
ClickContinue(true, false);
end;

Correct me if I'm wrong. I'm using this function and it works perfectly for me :p

Fascinate

2012-06-04 04:59:32

Well can't you just use send keys? To select the first option using "1" or the second using "2"?

P1ng

2012-06-04 05:05:47

It will recognise the text colour of both options but make the bounds of the mousebox only around the option you want to click, that way it won't click the other one

NoUserName

2012-06-04 18:03:20

From: p1ng
It will recognise the text colour of both options but make the bounds of the mousebox only around the option you want to click, that way it won't click the other one



jolly good point!

Brandon

2012-06-04 18:09:28


DoConversation('es', True);
FindNPCChatText('es', ClickLeft);
DoConversation('', True);