SRL Archive - Research & Development Lounge

ClickMultiMessage


Da 0wner

2009-02-05 20:45:59

Clicks an option in a message like the fletching message that says would you like to make 15 arrows, crossbow shaft etc. Returns true when the message is found. If the message is found but the option is not it returns false.


function ClickMultiMessage(Option : string; Left : boolean; rx, ry : integer) : boolean;
var
x, y : integer;
begin
if FindText(x, y, lowercase(Option), NPCChars, MCX1, MCY1, MCX2, MCY2) then
begin
Mouse(x, y, rx, ry, left);
result := true;
end;
end;

This is an example. Run it when the fletching menu is open.


Program Example;
{.include SRL/SRL.scar}

var
x, y : integer;

function ClickMultiMessage(Option : string; Left : boolean; rx, ry : integer) : boolean;
var
x, y : integer;
begin
if FindText(x, y, lowercase(Option), NPCChars, MCX1, MCY1, MCX2, MCY2) then
begin
Mouse(x, y, rx, ry, left);
result := true;
end;
end;

Begin
SetupSRL;
WriteLn(BoolToStr(ClickMultiMessage('rro', false, 10, 10)));
End.

ian.

2009-02-05 21:26:32

hmm.. no?

if you want this to make like 15 arrow shafts, you have to mousebox in a certain area, right click (or left click, it's different for some things) then chooseoption..

so this wouldn't work (if that's what you're trying to do)

Da 0wner

2009-02-05 21:37:45

Heh, did you test lol…
This works.

To make it make 15 arrow shafts once do this

ClickMultiMessage('hat would', 'arro', true, 7, 7);

to make it click more then that do this

ClickMultiMessage('hat would', 'arro', false, 7, 7);
Wait(300 + random(200)); // w/e you want.
ChooseOption('ake 10'); // or w/e you want.

ian.

2009-02-05 21:51:34

I didn't test because I don't play rs :\

I made one for someone else and use MouseBox( );.. and I always forget that you can find text in the chat box :p

Da 0wner

2009-02-05 21:54:49

Not to advertise my site but instead of uploading to youtube I uploaded to it…
http://quantum-gaming.net/clip0012.avi
Proof.
My wait in between typing the amount to make was to short so it didn't type so that's why it took a while. I typed 5 myself. :p

Kyle Undefined

2009-02-05 22:41:58

I don't see the difference between using a FindText then Mouse. The message part I don't understand. Your message segment never come up in fletching. And if your going to make it right click if told so, why not have it type in the amount you want it to do?

function ClickMultiMessage(Option : string; Left : boolean; Amount, rx, ry : integer) : boolean;
var
x, y : integer;
begin
if FindText(x, y, lowercase(Option), NPCChars, MCX1, MCY1, MCX2, MCY2) then
begin
Mouse(x, y, rx, ry, left);
if (Left = False) then
TypeSend(IntToStr(Amount));
Result := True;
end else
Result := false;
end;

~Camo

Da 0wner

2009-02-05 22:45:54

The message segment is the message that shows at the top middle of the box. In this case it is "What would you like to make?"


Kyle Undefined

2009-02-05 22:51:45

But there wont always be a message there. If it finds "arro" then that's all it needs.

~Camo

Da 0wner

2009-02-05 22:52:55

There usually is. This function I made was for fletching only really so I decided to post it.

Alright, edited the first post and removed msg.