Results 1 to 11 of 11

Thread: What is wrong with this HpCheck Function?

  1. #1
    Join Date
    Oct 2011
    Location
    Australia, Vic
    Posts
    1,517
    Mentioned
    2 Post(s)
    Quoted
    120 Post(s)

    Default What is wrong with this HpCheck Function?

    i am trying to determine if i need to eat or not, but i keep getting
    Simba Code:
    [Error] (317:28): Variable Expected at line 316
    Compiling failed.

    Line 316 is
    Simba Code:
    if not (getMMLevels('hp','orange') > 1)) then




    Simba Code:
    Function HPchecker: Boolean;
    var
      color:String;
    Begin
      result:=true;
      if not (getMMLevels('hp','orange') > 1)) then
      Begin
        Result := False
        WriteLn('We Are Healthy');
      end;
         if (getMMLevels('hp','Orange') > 1)) then
      Begin
        result:=True;
        WriteLn('We Need To Eat');
        Eat;
      end;

  2. #2
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Simba Code:
    Function HPchecker: Boolean;
    var
      color:String;
    Begin
      result:=true;
      if not (getMMLevels('hp','orange') > 1)) then
      Begin
        Result := False
        WriteLn('We Are Healthy');
      end;
         if (getMMLevels('hp','[B]Orange[/B]') > 1)) then
      Begin
        result:=True;
        WriteLn('We Need To Eat');
        Eat;
      end;

    When creating the HP you shouldn't use this 'Orange' bit, unless your referencing to a colour like in ACA

    so in var

    var
    Colour:=String
    Orange:=111111
    Red:=222222

    something like that, those numbers aren't right

  3. #3
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Simba Code:
    function CurrentHP: integer;
    var
      s: string;
    begin
      Result := GetMMLevels('health', s);
    end;
    Simba Code:
    procedure Eat;
    var
      Lobster, X, Y: integer;
    begin

      Lobster := DTMFromString('mlwAAAHicY2dgYBBmhGBJIJYAYj4gZoeyM4HyVUBcBMQ5QFwKxIVAXAbECwLEgSQTVszPgBsw4sFQAAAAAATZ');

      if CurrentHP < EatAt then
      begin
        FindDTM(Lobster, X, Y, MSX1, MSY1, MSX2, MSY2);
        Mouse(X, Y, 7, 7, false);
        WaitOption('10', 1500);
        Wait(1000 + random(200));
        repeat
          FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2);
          Mouse(X, Y, 7, 7, false);
          WaitOption('at', 1500);
          Wait(1000 + random(200));
        until CurrentHP = TotalHP

        if FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2)then
        begin
          Mouse(X, Y, 7, 7, false);
          WaitOption('ll', 1500);
          Wait(500 + random(200));
        end;
      end;
      FreeDTM(Lobster);
    end;
    CurrentHP made by RyGuy, Eat made by me

  4. #4
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Sirenia View Post
    Simba Code:
    function CurrentHP: integer;
    var
      s: string;
    begin
      Result := GetMMLevels('health', s);
    end;
    Simba Code:
    procedure Eat;
    var
      Lobster, X, Y: integer;
    begin

      Lobster := DTMFromString('mlwAAAHicY2dgYBBmhGBJIJYAYj4gZoeyM4HyVUBcBMQ5QFwKxIVAXAbECwLEgSQTVszPgBsw4sFQAAAAAATZ');

      if CurrentHP < EatAt then
      begin
        FindDTM(Lobster, X, Y, MSX1, MSY1, MSX2, MSY2);
        Mouse(X, Y, 7, 7, false);
        WaitOption('10', 1500);
        Wait(1000 + random(200));
        repeat
          FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2);
          Mouse(X, Y, 7, 7, false);
          WaitOption('at', 1500);
          Wait(1000 + random(200));
        until CurrentHP = TotalHP

        if FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2)then
        begin
          Mouse(X, Y, 7, 7, false);
          WaitOption('ll', 1500);
          Wait(500 + random(200));
        end;
      end;
      FreeDTM(Lobster);
    end;
    CurrentHP made by RyGuy, Eat made by me
    You got a nice infinite loop right there if you got no lobster in your inventory.

    Also, before doing anything, you should make sure that the FindDTM function actualy found something.

  5. #5
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    notice it says IF at the start... so IF it finds lobsters in bank then i WILL get lobsters in my inv... Ive been using this method for my modified astral crafter by ryguy for over a week now and it havent fucked me once
    EDIT: ur maybe alittle right and this would maybe do better?
    Simba Code:
    [SIMBA]procedure Eat;
    var
      Lobster, X, Y: integer;
    begin

      Lobster := DTMFromString('mlwAAAHicY2dgYBBmhGBJIJYAYj4gZoeyM4HyVUBcBMQ5QFwKxIVAXAbECwLEgSQTVszPgBsw4sFQAAAAAATZ');

      if CurrentHP < EatAt then
      begin
        if FindDTM(Lobster, X, Y, MSX1, MSY1, MSX2, MSY2)then
        begin
          Mouse(X, Y, 7, 7, false);
          WaitOption('10', 1500);
          Wait(1000 + random(200));
          repeat
            FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2);
            Mouse(X, Y, 7, 7, false);
            WaitOption('at', 1500);
            Wait(1000 + random(200));
          until CurrentHP = TotalHP
        end;

        if FindDTM(Lobster, X, Y, MIX1, MIY1, MIX2, MIY2)then
        begin
          Mouse(X, Y, 7, 7, false);
          WaitOption('ll', 1500);
          Wait(500 + random(200));
        end;
      end;
      FreeDTM(Lobster);
    end;
    [/SIMBA]
    Last edited by Sirenia; 03-13-2012 at 09:40 AM.

  6. #6
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Nope, watch it again.

    You enter the first if if you are low hp, then you search for lobster and you dont check if you really found any.
    Then you enter the loop, which can only be exited if you heal up. But what if you got no lobster in your inventory? Or what if your DTM is broken? You are stuck there.

  7. #7
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Now I think it will check for them in the bank and then enter the loop, correct me if im wrong :P

  8. #8
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Yep thats better, but you could still get caught in an infinite loop.

    Say you got 1 lobster in your bank, the script tries to withdraw 10, it then enter the loop and eat one. But you arent full HP with a single lobster. So you are still stuck.

    The best thing to do would be to add a timeout variable to your loop.

    Say, you try the loop 10 times, then if you are still low hp, you exit the loop and do something, like maybe logout or send a message to the user.

  9. #9
    Join Date
    Oct 2011
    Location
    Australia, Vic
    Posts
    1,517
    Mentioned
    2 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by Sirenia View Post
    Now I think it will check for them in the bank and then enter the loop, correct me if im wrong :P
    What is Eat at on the line that says is hp less than?

  10. #10
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Evlin View Post
    What is Eat at on the line that says is hp less than?
    Since its not declared localy it must be a global constant. (Yeah that makes more sense than a variable)

    EatAt is most likely an integer that store at which HP you should start to eat. Say... 597 life points.
    Last edited by eska; 03-13-2012 at 09:56 AM.

  11. #11
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    EatAt and TotalHP is constants,

    Simba Code:
    Const

      EatAt = 400;
      TotalHP = 910;

    For exmaple

    I got resting too, this one is from Flight so I think it should be good

    Simba Code:
    procedure Rest;
    begin
      if (GetMMLevels('run',S) <= RestAt) then
      RestUntil(RandomRange(90, 100));
    end;

    With
    Const
    RestAt = 60;
    Last edited by Sirenia; 03-13-2012 at 09:54 AM.

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
  •