SRL Archive - SRL Suggestions

Updated FindNPCChatText + ContinueChat


Flight

2011-12-14 23:58:09


Function FindNPCChatText_F(Option: String; Action: fnct_ActionOptions): Boolean;
var
X,Y: Integer;
begin
Result := False;

if Option = '' then
begin
srl_Warn('FindNPCChatText', 'txt is empty', warn_AllVersions);
Exit;
end;

if FindText(X, Y, Option, UpChars, MCX1, MCY1, MCX2, MCY2) then
begin
Result := True;
case Action of
Move: MMouse(X, Y + 2, Random(Length(Option) * 5), 4);
ClickLeft: Mouse(X, Y + 2, Random(Length(Option) * 5), 4, True);
ClickRight: Mouse(X, Y + 2, Random(Length(Option) * 5), 4, False);
end;
end;
end;
^ Works the same way as FindNPCChatText.


Function ContinueChat: Boolean;
var
X,Y,BMP: Integer;
begin
Result := False;

BMP := BitmapFromString(10, 12, 'meJxjYCAAlFVUzp07v3v3HgFBQU' +
'zZt+/e/f33D4iAagwNjfAoADICAgIxFQA1QhQAUX5BAZMMii1AS+f' +
'MmQtXMGfuXDTt1TU1q1ev2bx5y8WLl7p7epClgFygLNDMyVOmRERE' +
'MIlxw6WAWlrb2oCyQMPt7R3gUsxMjECfAmWBWoBIWVkF08FLly4DS' +
'vHy8WEPLz5GEMIAAML5W78=');

if FindBitmapToleranceIn(BMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) then
begin
TypeByte(vk_Space);
Result := True;
end else
Result := False;

FreeBitmap(BMP);
end;
^ The bitmap is of the small arrow in the green button.

Tested both, they work just fine. Use them however you wish.

mormonman

2011-12-15 00:02:28

It's not hard to add the third option…you might as well do it yourself to save the devs the trouble ;)

Aegis

2011-12-15 00:05:39

Thanks! I'll be implementing these now.

Flight

2011-12-15 00:11:07

From: mormonman
It's not hard to add the third option…you might as well do it yourself to save the devs the trouble ;)


Done and done.

Harry

2011-12-15 08:08:06

Why load a bitmap every time instead of using simple colors?

Wizzup?

2011-12-15 08:15:01

From: Harry
Why load a bitmap every time instead of using simple colors?


Shouldn't really matter a lot…

Home

2011-12-15 09:02:51

Bitmaps are ugly :P


~Home

legoace

2011-12-15 10:23:59

Thanks Flight! These look great. Is there any easy way to get the average color of an area? That would be a way to tell whether the button is pressed or not.

YoHoJo

2011-12-16 01:16:12

Someone commit this shiz?
Or is there already a fix for this committed?

NCDS

2011-12-16 01:18:24

I didn't even see this. :redface:

I just committed a fix for ClickContinue that should work out alright. Does the other still need to be committed?

StevenV

2011-12-16 05:02:22

I have updated MSI, SRL and PSP, and know i'm getting an error:
[Error] C:\Program Files (x86)\Simba\Includes\SRL/SRL/core/text.scar(387:6): Unknown identifier 'Option' at line 386
Compiling failed.

and this is about 'option' in the FindNPCChatText-function