Results 1 to 9 of 9

Thread: How to Detect Player's Location

  1. #1
    Join Date
    Jan 2010
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How to Detect Player's Location

    I am working on my first script that will be buying and banking kebabs from Karim in Al-Kharid. I have my script "laid out" right here(like a blueprint):
    Code:
    begin
      SetupSRL;
      repeat
        if not(invFull)then
          if not(isAtKarim)then
            WalkToKarim;
          else
            BuyKebabs;
        else
          if not(isAtBank)then
            WalkToBank;
          else
            BankKebabs;
      until(false);
    end.
    My problem is that, how would I get the Simba to detect whether the character is at the bank or not? I'm sure I could use a FindColorTolerance color detection, but I don't think it's an effective way to detect a character's location. Umm, like how would isAtBank look like in an actual working script.

  2. #2
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    You could use colour, and determine how far your character is away from the bank symbol on the minimap. You could perhaps search for a unique colour if there is one. However, what I'd recommend is to use Reflection by comparing tiles.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  3. #3
    Join Date
    Sep 2007
    Location
    British Columbia, Canada
    Posts
    4,047
    Mentioned
    1 Post(s)
    Quoted
    2 Post(s)

    Default

    Am sure you can check for ground color with tpa. But for kebab, if you can just find the seller then its all good cause there is no door Or color around your character on the minimap..
    Oh Hai Dar

  4. #4
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Check the distance between a symbol and the character on the minimap. Something like:
    Simba Code:
    procedure DetermineLocation;
    var
      CX, CY, Dist : Integer;
    begin
      if FindSymbolIn(CX, CY, 'symbol', MMX1, MMY1, MMX2, MMY2) then
      begin
        Dist := Distance(CX, CY, MMCX, MMCY);
      end;
    end;

    You would of course check for the distance amount, with something like: "if Dist > 10 then" and then you would continue on as you wish.
    PS: Distance is by pixels, if I remember it correctly. So keep that in mind.

  5. #5
    Join Date
    Jan 2010
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by RISK View Post
    Check the distance between a symbol and the character on the minimap. Something like:
    Simba Code:
    procedure DetermineLocation;
    var
      CX, CY, Dist : Integer;
    begin
      if FindSymbolIn(CX, CY, 'symbol', MMX1, MMY1, MMX2, MMY2) then
      begin
        Dist := Distance(CX, CY, MMCX, MMCY);
      end;
    end;

    You would of course check for the distance amount, with something like: "if Dist > 10 then" and then you would continue on as you wish.
    PS: Distance is by pixels, if I remember it correctly. So keep that in mind.
    So what do I replace 'symbol', MMX1, MMY1, MMX2, MMY2, MMCX, and MMCY with?

  6. #6
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Change 'symbol' to 'bank' (there's a list of different symbol strings in symbol.scar), and leave the MM co-ords.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  7. #7
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    You don't replace the coordinates with anything. They are good as they are.
    You replace 'symbol' with something from the symbol file. Here is the valid symbols:
    Simba Code:
    {*******************************************************************************
    Valid Arguments are:
      - agility                  - furnace                    - rare trees, tree
      - altar                    - gem stall                  - rest, resting spot
      - anvil                    - guide                      - sandpit
      - apothecary               - hair dresser               - saw mill
      - archery shop             - herbalist                  - scimitar shop
      - arrow                    - house                      - shield
      - axe shop                 - hunter store               - shop, store
      - bar                      - hunter training            - short cut
      - bank                     - jewelery                   - silk stall
      - candle shop              - kebab shop                 - silver stall
      - churn                    - mace shop                  - slayer master
      - clothes shop             - magic shop                 - spice stall
      - cookery shop             - makeover mage              - spinning wheel, spin
      - cookery, cook            - mill                       - staff shop
      - crafing shop             - minigame                   - summoning store
      - dungeon                  - mining shop                - sword shop
      - farming shop             - pet shop                   - tanner
      - farming spot             - platebody shop             - training dummy
      - fishing shop, fish store - plateskirt shop            - underground
      - fishing spot, fish       - portal (to player owned houses) - water source, water
      - food shop                - pottery, pot               - weave
      - fur trader               - quest                      - windmill

    *******************************************************************************}


    { var SymbolAccuracy: Extended;
      Description: How accurate it must be, in %, to find symbols or icons on the minimap. }

    PS: To use SymbolAccuracy, you must use it like this:
    "SymbolAccuracy := 0.5;" -- When you are done using it, revert it back to "0.7". It is in %. 0.5 = 50% out of 100%. It will help find the symbol if people or another symbol is on it. It is very useful. I suggest you use it before the FindSymbol in the procedure I gave you.
    Last edited by RISK; 02-03-2011 at 08:17 PM.

  8. #8
    Join Date
    Jan 2010
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, I got now. Thank you.

  9. #9
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    DTM of banker dots worked great bank in the day.

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
  •