Results 1 to 9 of 9

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

  1. #1
    Join Date
    Mar 2013
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

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

    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?

  2. #2
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Something like this
    Simba Code:
    return P07_ChooseOptionMulti(["blah", "option", "what"]);

    Forum account issues? Please send me a PM

  3. #3
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

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

    Simba Code:
    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.
    Last edited by Flight; 05-13-2013 at 03:33 AM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  4. #4
    Join Date
    Mar 2013
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    Quote Originally Posted by Justin View Post
    Something like this
    Simba Code:
    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.

    Simba Code:
    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;

  5. #5
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,164
    Mentioned
    26 Post(s)
    Quoted
    433 Post(s)

    Default

    Quote Originally Posted by rsbots2013 View Post
    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.

    Simba Code:
    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

  6. #6
    Join Date
    Mar 2013
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Give me a second and I'll make an example function for you. I will edit this post.

    Simba Code:
    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!

  7. #7
    Join Date
    Mar 2013
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    Thank you all for the help!

  8. #8
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by rsbots2013 View Post
    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:
    Simba Code:
    if WaitUpTextMulti(['NPC UpTextA','NPC UpTextB','NPC UpTextC'], 300) then  //If the UpText is what we want then...
        begin

    Silly mistake. :S

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  9. #9
    Join Date
    Mar 2013
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    nevermind I just read post

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •