SRL Archive - OSR Help

How do I tell Simba to check if what I told it do happened


rsbots2013

2013-05-12 23:06:46

What the title says

Heres what I want for example:

I want Simba to "FindColorSpiralTolerance" and move the mouse to NPC by "MoveMouse" and checking that where the mouse is correct by "P07_WaitUpTextMultiCustom" then right clicking my "mouse(x,y,false)" and clicking the option I want by "P07_ChooseOptionMulti".

Basically I want to tell Simba how to check if all that happened correctly. How do I do that?

Would it be easier If I actually put a sample of simba code to explain what I want?

Justin

2013-05-12 23:13:19

Something like this

return P07_ChooseOptionMulti(["blah", "option", "what"]);

Flight

2013-05-12 23:19:26

Give me a second and I'll make an example function for you. I will edit this post.


Function foundNPC: Boolean;
var
mPnt: TPoint;
i,CTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result := False;
if not LoggedIn then
Exit;
FindNormalRandoms;
CTS := GetColorToleranceSpeed;

ColorToleranceSpeed(2); //Change to whatever CTS you want
SetColorSpeed2Modifiers(1.15, 1.99); //Hue/Sat mods
FindColorsSpiralTolerance(MSCX, MSCY, TPA, NPC_COLOR, MSX1, MSY1, MSX2, MSY2, COLOR_TOLERANCE); //Color & tolerance of your NPC
SetColorSpeed2Modifiers(0.02, 0.02); //Reset back to default CTS
ColorToleranceSpeed(CTS); //Reset back to default CTS

if (Length(TPA) < 1) then //None of the color was found, so exit
Exit;

SplitTPAExWrap(TPA, 34, 34, ATPA); //Split our colors into 34x34 boxes
SortATPAFromMidPoint(ATPA, Point(MSCX,MSCY)); //Sort these TPAs starting from the center of the screen

for i:=0 to High(ATPA) do //For each and every TPA do...
begin
mPnt := MiddleTPA(ATPA[i]); //Get the middle of the current TPA
MMouse(mPnt.X, mPnt.Y, 7, 7); //Move the mouse to the middle of that TPA, with a 7 X/Y randomness
if WaitUpTextMulti(['NPC UpTextA','NPC UpTextB','NPC UpTextC'], 300) then //If the UpText is what we want then...
begin
if WaitOptionMulti(['Right-click option A','Right-click option B'], 300) then //If we chose the correct option then...
begin
Result := True; //The function was a success, result = true
Exit; //Exit the function so we don't continue to search for the NPC
end;
end;
end;
end;

This is made with SRL-OSR in mind, not the unofficial P07 include. Like always I recommend you use the official SRL-OSR include.

rsbots2013

2013-05-12 23:20:25

From: Justin
Something like this

return P07_ChooseOptionMulti(["blah", "option", "what"]);


You didnt understand what I was saying. I'll give a better example.

How do I tell Simba to check if all this happened correctly before going to the next procedure.

procedure Boat1;

var
t,x,y: integer;

begin

marktime(t);

repeat
If FindColorSpiralTolerance(x, y, MonkOfEntrana1, 5, 5, 514, 336, 5) then
begin
MoveMouse(x, y);
If P07_WaitUpTextMultiCustom(['qqq', 'wwww', 'eeee'], 1000) Then
Mouse(X,Y,5,5,false);
P07_ChooseOptionMulti(['oat']);
break;
end;
until (timefrommark(t) > 60000);
end;

StickToTheScript

2013-05-12 23:34:05

From: rsbots2013
You didnt understand what I was saying. I'll give a better example.

How do I tell Simba to check if all this happened correctly before going to the next procedure.

procedure Boat1;

var
t,x,y: integer;

begin

marktime(t);

repeat
If FindColorSpiralTolerance(x, y, MonkOfEntrana1, 5, 5, 514, 336, 5) then
begin
MoveMouse(x, y);
If P07_WaitUpTextMultiCustom(['qqq', 'wwww', 'eeee'], 1000) Then
Mouse(X,Y,5,5,false);
P07_ChooseOptionMulti(['oat']);
break;
end;
until (timefrommark(t) > 60000);
end;


You would want to make it a function. Preferably a boolean. To lean about them, look at this:

http://villavu.com/forum/showthread.php?t=58935

rsbots2013

2013-05-12 23:59:18

From: Flight
Give me a second and I'll make an example function for you. I will edit this post.


Function foundNPC: Boolean;
var
mPnt: TPoint;
i,CTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result := False;
if not LoggedIn then
Exit;
FindNormalRandoms;
CTS := GetColorToleranceSpeed;

ColorToleranceSpeed(2); //Change to whatever CTS you want
SetColorSpeed2Modifiers(1.15, 1.99); //Hue/Sat mods
FindColorsSpiralTolerance(MSCX, MSCY, TPA, NPC_COLOR, MSX1, MSY1, MSX2, MSY2, COLOR_TOLERANCE); //Color & tolerance of your NPC
SetColorSpeed2Modifiers(0.02, 0.02); //Reset back to default CTS
ColorToleranceSpeed(CTS); //Reset back to default CTS

if (Length(TPA) < 1) then //None of the color was found, so exit
Exit;

SplitTPAExWrap(TPA, 34, 34, ATPA); //Split our colors into 34x34 boxes
SortATPAFromMidPoint(ATPA, Point(MSCX,MSCY)); //Sort these TPAs starting from the center of the screen

for i:=0 to High(ATPA) do //For each and every TPA do...
begin
mPnt := MiddleTPA(ATPA[i]); //Get the middle of the current TPA
MMouse(mPnt.X, mPnt.Y, 7, 7); //Move the mouse to the middle of that TPA, with a 7 X/Y randomness
if WaitUpTextMulti(['NPC UpTextA','NPC UpTextB','NPC UpTextC'], 300) then //If the UpText is what we want then...
begin
if WaitOptionMulti(['Right-click option A','Right-click option B'], 300) then //If we chose the correct option then...
begin
Result := True; //The function was a success, result = true
Exit; //Exit the function so we don't continue to search for the NPC
end;
end;
end;
end;

This is made with SRL-OSR in mind, not the unofficial P07 include. Like always I recommend you use the official SRL-OSR include.


Thank you! :)

rsbots2013

2013-05-13 00:00:18

Thank you all for the help! :)

Flight

2013-05-13 00:29:30

From: rsbots2013
Thank you all for the help! :)


Ops lol I forgot to add the part of the mouse actually right-clicking. Add "ClickMouse2(mouse_right);" directly below these two lines:

if WaitUpTextMulti(['NPC UpTextA','NPC UpTextB','NPC UpTextC'], 300) then //If the UpText is what we want then...
begin

Silly mistake. :S

rsbots2013

2013-05-13 01:43:34

nevermind I just read post