Results 1 to 3 of 3

Thread: Need help. Can't find out whats wrong.

  1. #1
    Join Date
    Jan 2012
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Exclamation Need help. Can't find out whats wrong.

    I'm attaching the attack and heal procedures of a script i'm currently working on for attacking monks for pures.

    but for some reason everythime it attacks the monk the first time it stops scripts and opens some gametab and i can't find out why. please help

    So i found out its HpPercent thats doing it. can't find a fix.


    Thanks
    MattL191
    Simba Code:
    {$i SRL\SRL.simba}
    {$i sps/sps.simba}
    {$i SRL\SRL\Misc\Debug.simba}
    {$i SRL/SRL/skill/fighting.simba}

    procedure Attack;
    var
      ax, ay: integer;

      begin
        if InFight then
      begin
        repeat
          FindNormalRandoms;
        until Not Infight
        end;
      begin
        if FindObjTPA(ax, ay, 7251654, 15, -1, 25, 25, 1, ['onk', 'Monk']) then
      begin
        if not (IsFightAt(ax, ay) and not InFight) then
          begin
          GetMousePos(ax, ay);
          ClickMouse(ax,ay, Mouse_Right);
          WaitOptionMulti(['ttack M', 'attack Monk'], 200);
          wait(500);
          end;
        while IsMoving do
          begin
            wait(350);
          end;
        end;
      end;
    end;

    Procedure CheckHphealmonk;
    var
    bx, by: Integer;
    begin
      FindObjTPA(bx, by, 7251654, 15, -1, 25, 25, 1, ['onk', 'Monk']);
      GetMousePos(bx, by);
      ClickMouse(bx, by, Mouse_Right);
      WaitOptionMulti(['alk', 'Talk'], 200);
    end;






    begin;
      SetupSRL;
      repeat
        Attack;
        if (HPPercent < (65)) then
        repeat
        CheckHphealmonk;
        until (HPPercent = (100));
      until(false)

    end.
    Last edited by MattL191; 02-10-2012 at 07:52 AM.

  2. #2
    Join Date
    Jan 2012
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Exclamation

    New question fixed the last one problem alright heres updated script well just the attack and heal part of it.

    is there a way if my character goes and attacks one of the guys in the wings of the building. to reset the characters posistion to the center of the monestary? ive got

    Simba Code:
    procedure WalkToCenter;
      var ax, ay: Integer;
    begin
      FindSymbol(ax, ay, 'water');
      Mouse(ax, ay, 5, 5, Mouse_left);

    but i can't think of a way that i can implement it so if he staying around looking for the monk but can't find it. I've tried marktime but can't work out a way that it acutally works usually just skips it.

    If anyone could give me a tip I would be very thankful

    Matt


    Rest of code for attacking/healing so far

    Simba Code:
    Program MonkKiller;
    {$DEFINE SMART}
    {$i SRL\SRL.simba}
    {$i sps/sps.simba}
    {$i SRL\SRL\Misc\Debug.simba}
    {$i SRL/SRL/skill/fighting.simba}
    Const
     SRLStats_Username = '';// Your SRL Stats Username
     SRLStats_Password = ''; // Your SRL Stats Password
     NumbOfPlayers     = 1;       //How many players are you using
     StartPlayer       = 0;       //Player to start auoting with! (0 means first char)
     BreakEvery        = 120;      //How many loads to take a break after.
     BreakFor          = 10;      //How many minutes to break for
     Version           = '2.0';    //Leave Alone
    Var
      BreakOften, BreakLength, BreakTimes, FindMonktimer: Integer;
    procedure DeclarePlayers;
      var i:integer;
    begin
      NumberOfPlayers(NumbOfPlayers);
      CurrentPlayer := StartPlayer;
      for i := 0 to NumbOfPlayers-1 do
        Players[i].BoxRewards  := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];

      with Players[0] do
      begin
        Name        := '';     //Player username.
        Pass        := '';     //Player password.
        Pin         := ''     //Pin for Bank
        Active      := True;
      end;

    end;
    Procedure Setup;
    Begin
      Smart_Server:=89;
      Smart_Members:=False;
      Smart_Signed:=True;
      Smart_SuperDetail:=False;
      SetupSRL;
      Declareplayers;
      Wait(2500)
      LogInPlayer;
      Setangle(SRL_ANGLE_HIGH);
    End;
    procedure Attack;
    var
      ax, ay, bx, by: integer;

      begin
        if InFight then
      begin
        repeat
          FindNormalRandoms;
        until Not Infight
        end;
      begin
        if FindObjTPA(ax, ay, 7251654, 15, -1, 25, 25, 1, ['onk', 'Monk']) then
      begin
        if not (IsFightAt(ax, ay) and not InFight) then
          begin
          Mouse(ax,ay, 5, 5, Mouse_Right);
          WaitOptionMulti(['ttack M', 'attack Monk'], 200);
          wait(500);
          end;
          end;
        end;
        end;
      end;


    Procedure Healmonk;
    var
    cx, cy: Integer;
    begin
      begin
        if InFight then
      begin
        repeat
          FindNormalRandoms;
        until Not Infight
      end;
      begin
        FindObjTPA(cx, cy, 7251654, 15, -1, 25, 25, 1, ['onk', 'Monk']);
        Mouse(cx, cy, 5, 5, Mouse_right);
        WaitOptionMulti(['alk', 'Talk'], 200);
        Wait(1000);
        ClickContinue(True, False);
        Wait(850);
        Case Random(5) of
            0: Mouse(399, 399, 5, 5, Mouse_Left);

            1: Mouse(156, 569, 6, 6, Mouse_Left);

            2: Mouse(149, 399, 5, 5, Mouse_Left);

            3: Mouse(372, 400, 5, 5, Mouse_Left);

            4: Mouse(283, 400, 5, 5, Mouse_Left);
        end;
        Wait(850);
        ClickContinue(True, False);
        Wait(850);
        ClickContinue(True, False);
        Wait(850);
      end;
      end;
      end;
      procedure WalkToCenter;
      var ax, ay: Integer;
    begin
      FindSymbol(ax, ay, 'water');
      Mouse(ax, ay, 5, 5, Mouse_left);
    end;
    begin;
        Setup;
      repeat
        MarkTime(FindMonktimer);
        Attack;
        if (HPPercent < 65) then
        repeat
          Healmonk;
        until (HPPercent = 100);
      until(false)
    end.
    Last edited by MattL191; 02-11-2012 at 04:44 AM.

  3. #3
    Join Date
    Dec 2011
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Use Timers.

    Simba Code:
    Var
      StartTime, ax, ay: Integer
    begin
      MarkTime(StartTime);

      FindSymbol(ax, ay, 'water');
      Mouse(ax, ay, 5, 5, Mouse_left);

      until(TimeFromMark(StartTime) > 30000);

      if (TimeFromMark(StartTime) > 30000) then
        TerminateScript;
    end;

    You can also through in a repeat.
    Simba Code:
    Var
      StartTime, ax, ay: Integer
    begin
      MarkTime(StartTime);

      repeat
      begin
        FindSymbol(ax, ay, 'water');
        Mouse(ax, ay, 5, 5, Mouse_left);
      end;
      until(TimeFromMark(StartTime) > 30000);

      if (TimeFromMark(StartTime) > 30000) then
        TerminateScript;
    end;

    edit: Just read that you've tried MarkTime unsuccessfully. If you use it correctly, it should work.

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
  •