Results 1 to 14 of 14

Thread: How to script a safespot?

  1. #1
    Join Date
    Apr 2008
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default How to script a safespot?

    Well, I'm trying to modify a script, so it remains at the same spot, and if it accidently moves, it should move back to that spot, how would one go about coding that?

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Well, first and foremost you'll want to make a function that can identify the spot, and whether you are in it / close to it. That can usually be done with a DTM, and you can then define whether you are in the safespot by distance to the main point.

    After that, you'll want to make another procedure that moves you to the safespot if you aren't in it.

    Then you'll want to call these functions in your fighting loop, such as
    if not InSafeSpot then Relocate;
    if HP_Percent < 100 then if not InSafeSpot then Relocate

    that should be about enough

    -RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  3. #3
    Join Date
    Apr 2008
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Sir R. M8gic1an View Post
    Well, first and foremost you'll want to make a function that can identify the spot, and whether you are in it / close to it. That can usually be done with a DTM, and you can then define whether you are in the safespot by distance to the main point.

    After that, you'll want to make another procedure that moves you to the safespot if you aren't in it.

    Then you'll want to call these functions in your fighting loop, such as
    if not InSafeSpot then Relocate;
    if HP_Percent < 100 then if not InSafeSpot then Relocate

    that should be about enough

    -RM
    It's the "identify the spot" part that confuses me. Since all the different squares in the area are basically the same. :O

    But thanks alot for your help!

  4. #4
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    post a pic

    -RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  5. #5
    Join Date
    Apr 2008
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Sir R. M8gic1an View Post
    post a pic

    -RM
    Give me a few minutes, then I'll update this post with a picture of the location. It's the ogre cage by the way, if you you happen to be familiar with that.

  6. #6
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Can you show us picture if minimap and identify the safespot?
    Basically you should make a ddtm (read tutorial about them) with thr main point being the safespot. Would be a bit hard, but fun, to make it. If the spot is literally one tile it's kind of hard to click exactly specifically one tile but still possible.

    As for knowing when to recalibrate (when to walk to it) I'd assume you don't get hit at it, so I would have a check for HP bar above your head, if it's there you're not in spot and need to click the ddtm.

  7. #7
    Join Date
    Apr 2008
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    Can you show us picture if minimap and identify the safespot?
    Basically you should make a ddtm (read tutorial about them) with thr main point being the safespot. Would be a bit hard, but fun, to make it. If the spot is literally one tile it's kind of hard to click exactly specifically one tile but still possible.

    As for knowing when to recalibrate (when to walk to it) I'd assume you don't get hit at it, so I would have a check for HP bar above your head, if it's there you're not in spot and need to click the ddtm.
    Well, the thing is, when you leave the safespot, you don't get hit, it's not a real "safespot" but, you can't attack the Ogres unless you're within a certain range, and your character tend to run around and bug out, getting stuck, if you just leave it.

  8. #8
    Join Date
    Jul 2008
    Posts
    136
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i used a dtm and used rotated dtm to walk to safe spot

  9. #9
    Join Date
    Apr 2008
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default



    The white outline is the places he should aim to be in.

    And the blue on the minimap is the place he sometimes ends. It has nothing to do with the script walking off or anything. But sometimes when he attack one of the ogres, and it's blocked or something, he will run to the back of the cage.

  10. #10
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Oh I see. Hmm maybe solve that when searching for ogres fund the closest one to players first that way they are always in range.

    As for detecting when to move back, move up to the bad spot on purpose and see if anything in the minimap exists only when you're up there. Then script can sear for it, if found, move down.
    Or other way around look for something on minimap when you're in proper spot and not visible when you move up. Then search for lack of it, and move down if not found.

  11. #11
    Join Date
    Apr 2008
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    Oh I see. Hmm maybe solve that when searching for ogres fund the closest one to players first that way they are always in range.

    As for detecting when to move back, move up to the bad spot on purpose and see if anything in the minimap exists only when you're up there. Then script can sear for it, if found, move down.
    Or other way around look for something on minimap when you're in proper spot and not visible when you move up. Then search for lack of it, and move down if not found.
    Well, when he's behind the ogres, he can see another building on his minimap, that could be the trigger for "being stuck"

    And getting to the right spot could be clicking between the 2 white lines on minimap (The part where you enter, it looks unique on the minpmap) Then he'd be somewhat In position I guess..

  12. #12
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Since the other 2 mod+ guys posting here didn't catch it I'll go ahead and move you thread to the correct section. For future reference please post for help in the Scripting help section.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  13. #13
    Join Date
    Apr 2008
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    Since the other 2 mod+ guys posting here didn't catch it I'll go ahead and move you thread to the correct section. For future reference please post for help in the Scripting help section.
    Thanks for that! My bad!

  14. #14
    Join Date
    Feb 2006
    Location
    Canada
    Posts
    2,254
    Mentioned
    21 Post(s)
    Quoted
    238 Post(s)

    Default

    http://villavu.com/forum/showthread.php?t=68112
    this is exactly what you need to solve your problem.
    You kinda have to figure it out as you go, there isn't a tutorial for it yet. this is the code I use when creating an objectDTM:
    Simba Code:
    program objectdtmer;
    {$DEFINE SMART}
    {$DEFINE PAINT}
    {$i srl/srl.scar}
    {$i SRL\SRL\MISC\Paintsmart.scar}
    {$i ObjectDTM\ObjDTMInclude.simba}

    procedure DeclarePlayers;
    begin
      HowManyPlayers:= 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name      := 'asdf';
      Players[0].Pass      := 'asdf';
      Players[0].Nick      := 'asdf';
      Players[0].Pin       := '';
      Players[0].Active    := true;
    end;

    procedure paintupobjects;   //paints on smart objects on minimap
    begin
    ObjectDebug(1);
    end;

    begin
      smart_server := 1;
      smart_members := false;
      smart_signed := true;
      smart_superDetail := false;
      clearDebug();
      setupSRL();
      DeclarePlayers;
      if not LoggedIn then LogInPlayer;
      wait(1000);
      ObjDTM_Setup;
      MakeCompass('n');
      paintupobjects;
      wait(1000);
      GenerateObjDTM([MM_TREE, MM_TREE, MM_TREE], 630, 121, True, True);


    end.

    Also if you use his Lumbridge walker file, along with reading his very accurate and helpful documentation within the include itself, you should be able to figure it out.

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
  •