SRL Archive - Help and Support

Help with specific TPA Clicking..


Aegis

2011-12-10 21:09:58

I'm trying to light two incense burners. For now, I've been using a cheap alternative method, but I'd like to "upgrade" the accuracy of it. With this, I can get them to eventually be clicked, but it's not smooth/stable at all. Here's some needed info:

  • I need to click two objects (that look exactly the same)
  • Only click them once
  • ONLY The uptext changes once it's clicked; the object stays the same (that's how I know it's been lit)

What I'm trying to use:
procedure RightClickBurner;
var
InsTPA : TPointArray;
InsPoint : TPoint;
x, y, i : Integer;
begin
x := MSCx;
y := MSCy;
FindColorsSpiralTolerance(x, y, InsTPA, 2409460, MSx1, MSy1, MSx2, MSy2, 10);
if Length(InsTPA) = 0 then
Exit;
for i := 0 to 1 do
begin
InsPoint := InsTPA[i];
MMouse (InsPoint.x, InsPoint.y, 0, 0);
if (IsUpTextMultiCustom(['Inc','se bu','ner'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False); //Right-clicks because I loop until ChooseOption('Light')
Wait(500 + Random(500));
end;
end;
end;

I have this placed within a loop until ChooseOption('Light'), so that's why I have it set to right-click. If this is a problem, I could easily change it. So, right now, this either repeatedly jumps inbetween the two burners, right clicks them and does nothing, right-clicks the same one several times, or it actually lights the burner. Also, I kinda rushed into whole concept of TPAs, so I might just not be correctly/effectively using them.

As stated before, I can eventually get them lit, but it looks terrible. Once this step is perfected, I'll be posting the script. Any help and insight is much appreciated, thanks.

YoHoJo

2011-12-10 21:15:38

So what's wrong :/?
There's two objects, and they look exactly the same.
And once one of them is 'interacted with' we'll call it, the uptext changes?
And what do you want the code to do?

E: To fix the repeatedly jumping, either add a wait before the IsUpTextMultiCustom milti line, OR change it into a
function WaitUpTextMulti(S: TStringArray; Time: integer): Boolean;
By: Marpis & N1ke!
Description: Waits for a TStringArray of UpText, returns true if found

E:
Do the same with your ChooseOption, turn that into a
function WaitOption(S: String; Time: Integer): Boolean;
By: N1ke!
Description: Waits for an Option and selects it

I think the checks are happening right after the mouse moves/right clicks and script doesn't have enough time to call the UpText/Option functions or the text isn't visible so quickly right after.


Also, are the burners always in the same place relative to each other? Like is one burner always '3 squares to the left' (as an example) of the other?

Aegis

2011-12-10 21:17:42

From: YoHoJo
So what's wrong :/?
There's two objects, and they look exactly the same.
And once one of them is 'interacted with' we'll call it, the uptext changes?
And what do you want the code to do?


After arriving at a specific location..

'interacted with' burner 1.
'interacted with' burner 2.

Continue with the rest of the script.

Basically, with how I've got the method setup, I want it to simply right-click the object.

So, right now, this either repeatedly jumps inbetween the two burners, right clicks them and does nothing, right-clicks the same one several times, or it actually lights the burner.

YoHoJo

2011-12-10 21:20:38

Look up, edited post twice ^ :D

Aegis

2011-12-10 21:30:55

From: YoHoJo
So what's wrong :/?
There's two objects, and they look exactly the same.
And once one of them is 'interacted with' we'll call it, the uptext changes?
And what do you want the code to do?

E: To fix the repeatedly jumping, either add a wait before the IsUpTextMultiCustom milti line, OR change it into a
function WaitUpTextMulti(S: TStringArray; Time: integer): Boolean;
By: Marpis & N1ke!
Description: Waits for a TStringArray of UpText, returns true if found

E:
Do the same with your ChooseOption, turn that into a
function WaitOption(S: String; Time: Integer): Boolean;
By: N1ke!
Description: Waits for an Option and selects it

I think the checks are happening right after the mouse moves/right clicks and script doesn't have enough time to call the UpText/Option functions or the text isn't visible so quickly right after.


Also, are the burners always in the same place relative to each other? Like is one burner always '3 squares to the left' (as an example) of the other?


Oh, those two are nice to know! I'll implement those now. I just assumed it waited. Yeah, they are in the same position relative to eachother. And now I feel completely retarded for not even thinking about that..

I think I've got it from here. Thanks!

YoHoJo

2011-12-10 21:51:46

Sweet. Yeah I freaking LOVE the Wait(anything) functions in SRL, SO GOOD for speed.
Don't be afraid to set the wait for super long because remember, it waits until the menu is up, or the time is up (basically a failure), so having longer times like 2000 (2 seconds) is perfectly acceptable!