Results 1 to 8 of 8

Thread: help with with safespot

  1. #1
    Join Date
    Jul 2007
    Posts
    238
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default help with with safespot

    i want to make a range script with reflection
    but now im stuck and got a headache

    i know how to make scripts but im no master/good scripter so dont laugh (A) ?
    this is what i have but i gues it s***s

    SCAR Code:
    function GetSafeSpot:boolean;
    var
      safespot : TPoint;
    begin
      GetMyPos;
      result:= safespot;
    end;

    SCAR Code:
    if not safespot then
     walktotile(safespot, 3, 0);
    ....

  2. #2
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    function GetSafeSpot:boolean;
    var
      SafeSpot : TPoint;
    begin
      SafeSpot := GetMyPos;
      result:= ((SafeSpot.X or SafeSpot.y) <> 0);
    end;

    Like that?
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  3. #3
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Where's your safespot?
    [/OffTopic]

  4. #4
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Trying to make it so if it goes out of area (safe spot) it walks back to center of it?
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  5. #5
    Join Date
    Jul 2007
    Posts
    238
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    it should be something like this...
    the script start..(you should stand on a safe spot like the one at lesser demon on karamja or something)

    use getmypos to set the safespot


    SCAR Code:
    function GetSafeSpot:TPoint;
    var
    me: Integer;
    begin
      me := SmartGetFieldObject(0,MyPlayer);
      Result.x := SmartGetFieldInt(0,BaseX) + SmartGetFieldInt(me, CurrentX) shr 7;
      Result.y := SmartGetFieldInt(0,BaseY) + SmartGetFieldInt(me, CurrentY) shr 7;
      SmartFreeObject(me);
    end;

    procedure CheckSafeSpot;//should check and walk to safespot if moved from it
    var
     safespot: tpoint;
    begin
     safespot := GetSafeSpot;
     walktotile(safespot, 0, 0);
    end;

    begin
      SmartSetup('world10', True, True, False);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      ActivateClient;
      getsafespot; // sets the safe spot
    repeat
    checksafespot;
     // the rest of the script

    until false;
    end.
    ....

  6. #6
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by dushii View Post
    it should be something like this...
    the script start..(you should stand on a safe spot like the one at lesser demon on karamja or something)

    use getmypos to set the safespot


    SCAR Code:
    function GetSafeSpot:TPoint;
    var
    me: Integer;
    begin
      me := SmartGetFieldObject(0,MyPlayer);
      Result.x := SmartGetFieldInt(0,BaseX) + SmartGetFieldInt(me, CurrentX) shr 7;
      Result.y := SmartGetFieldInt(0,BaseY) + SmartGetFieldInt(me, CurrentY) shr 7;
      SmartFreeObject(me);
    end;

    procedure CheckSafeSpot;//should check and walk to safespot if moved from it
    var
     safespot: tpoint;
    begin
     safespot := GetSafeSpot;
     walktotile(safespot, 0, 0);
    end;

    begin
      SmartSetup('world10', True, True, False);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      ActivateClient;
      getsafespot; // sets the safe spot
    repeat
    checksafespot;
     // the rest of the script

    until false;
    end.
    Oh yes I do this in Echo fighter, so if you wander to far away from starting location it walks you back.

    First you need a global variable for the account.
    SCAR Code:
    var
      SafeSpot: TPoint;
     
     
    When you first start off do:

    SafeSpot := GetMyPos;

    then to check it

    if DistanceFrom(SafeSpot) > 16 then
    WalktoTile(SafeSpot, 1, 4);

    Make sure the script only calls "SafeSpot := GetMyPos;" once for each account.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  7. #7
    Join Date
    Jul 2007
    Posts
    238
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @Narcle I LOVE YOU <3
    ....

  8. #8
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    dushii what script are u making?



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
  •