Results 1 to 5 of 5

Thread: How Do You Regions In SPS-OSR?

  1. #1
    Join Date
    May 2013
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Question How Do You Regions In SPS-OSR?

    I want to be able to create a region such as the bank or the area that i'm working in and tell the bot to do something when in that area. For example, say I want the bot bank when it is in the bank. Or I would want the bot to perform a certain procedure once entered a specific region. How would I create these regions?

  2. #2
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    You mean something like this?

    Simba Code:
    Function InsideArea(x1, y1, x2, y2: Integer): Boolean;
    var
      P: TPoint;
      Box: TBox;
    begin
      P := SPS_GetMyPos;
      Box := IntToBox(x1, y1, x2, y2);
      if PointInBox(P, Box) then
      begin
        Result := True;
      end;
    end;

  3. #3
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    There are any number of methods you could go about this. The easiest methods would be to use an SPS map and check if you're in a dedicated area of the map that you would define as the map, or an objdtm node where you can determine if you're in an area using that. However, I think the best way to be to script procedurally:

    That means you would setup your script so you would walk to the bank, and then bank when your walking procedure is done. That way you don't have to check your current location every single time you want to do something and instead just know where you are because of the previous method that ran.
    Simba Code:
    repeat
      A;
      B;
      C;
      D;
      E;
    until(not loggedIn);
    instead of what you're suggesting:
    Simba Code:
    repeat
      if(in area A)then A;
      if(in area B)then B;
      if(in area C)then C;
      if(in area D)then D;
      if(in area E)then E;
    until(not loggedIn);

  4. #4
    Join Date
    May 2013
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I tried your method Haxz and it works great! Thanks!

  5. #5
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    Quote Originally Posted by hedfun2 View Post
    I tried your method Haxz and it works great! Thanks!
    Make sure you script some failsafe because sometimes SPS returns wrong coordinates when map has too much white dots, or is returning 1-, -1. So make sure your script don't get stuck somewhere you're using the function.

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
  •