Results 1 to 9 of 9

Thread: Able to detect a Hp change?

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

    Default Able to detect a Hp change?

    I'm currently developing an agility script and I'm looking for a way to check if Hp has dropped (i.e. an obstacle has been failed) from a point prior to attempting the obstacle to after the attempt.

    I've been using a set up using HPPercent such that checks the hp at the start of the procedure and sets that as a variable, then attempts the obstacle and then checks for changes in Hp to indicate if the obstacle has been failed. I'm not sure what I'm doing wrong but it just doesn't seem to work and I keep getting compiling errors.

    my unfinished (read: without standards) code so far:



    Code:
    procedure Swing;
    var
    SwingColor: integer;
    z: integer; //<----------Theoretically, what Hp is before an obstacle
    
    begin
      if FindObjTPA(x, y, SwingColor, 5, 2, 1, 20, 10, ['wing']) then
        begin
           HPPercent := z;
           writeln('Yay we found it');
           MMouse(x, y, 1, 2);
           Mouse(x, y, 0, 0, True);
           Wait(4000+random(800));
         if HPPercent < z then //<------------------if Hp drops then eat food
            begin
                Heal;
            end;
       end;
    end;
    What would be a better, more efficient, and actually workable way to do this?

  2. #2
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simba Code:
    HPPercent := z;
    are you trying to do
    Simba Code:
    z:= HPPercent;
    instead?

    E: Btw which course are you working on?
    Current activity: Recovering from vacation
    - Nulla pars vitae vacare officio potest -
    SRL membership? Can I buy that?
    Scripts - AGS - SWF - WAR - EMS - W100S-EM
    If you need scripting help, you can pm me. Remember, if you need help you have to ask for it properly though

  3. #3
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    Quote Originally Posted by nosaj.421 View Post
    Simba Code:
    HPPercent := z;

    are you trying to do Simba Code:
    z:= HPPercent;

    instead?

    E: Btw which course are you working on?
    No.

    z: integer; //<----------Theoretically, what Hp is before an obstacle

    Looks good to me.

    You'll want to do a GetMousePos(x, y) after the MMouse or it was for nothing btw.

    And a huge static wait isn't the best either but you start somewhere.
    I'm back

  4. #4
    Join Date
    Jan 2012
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah. That should do it. Always simple mistakes haha. Thank you for your help

    I'm currently working/attempting at creating a wilderness agility course script, but it will definitely take a good while to make haha. We'll see how it goes! I thought it would be a good starting script and give me some good practice in areas where colors often aren't the best. Why do you ask?

    Edit: Ya, I'm looking to add anti-ban to the static waits, for now I'm just trying to get the guts working though!

  5. #5
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I am interested in agility scripts too. For the record, I wanted to work on barb basic, but my only p2p main is tied to training thieving, hence it's on hold for a while.

    For a wildy course you might need to decide what you're gonna do about pkers. It'll be interesting for you I suppose.

    @smurg, yes and no. He also missed the x, y integer declares.
    Last edited by Er1k; 02-19-2012 at 05:46 AM.
    Current activity: Recovering from vacation
    - Nulla pars vitae vacare officio potest -
    SRL membership? Can I buy that?
    Scripts - AGS - SWF - WAR - EMS - W100S-EM
    If you need scripting help, you can pm me. Remember, if you need help you have to ask for it properly though

  6. #6
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Why HP percent? Just do

    Something:= GetMMLevels('HP');
    FindObstacle and work it..
    NewHP:= GetMMLevels('HP');

    if ((NewHP = Something) or FindBlackChatMessage('we failed or whatever')) then
    re-try obstacle because we failed..
    I am Ggzz..
    Hackintosher

  7. #7
    Join Date
    Jan 2012
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That's awesome! There definitely seems to be a lack of solid agility scripts. I think I have a method of dealing with them, though it may be slightly defeatist haha. But we'll see. Thank you for your help--could I possibly contact you if I have any minor problems (like this) seeing as you're interest in agility scripts as well?

  8. #8
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    Oh nevermind, sorry, it was late at night.

    You don't need z, because you can always just find your current hp.

    Take out "HPPercent := z" and change the HP check to:

    if HPPercent < PercentHealthToEat Then ....
    I'm back

  9. #9
    Join Date
    Feb 2012
    Posts
    386
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by smurg View Post
    Oh nevermind, sorry, it was late at night.

    You don't need z, because you can always just find your current hp.

    Take out "HPPercent := z" and change the HP check to:

    if HPPercent < PercentHealthToEat Then ....
    Hehe Thanks, You didn't just Help one Person, Now I am able to make My script Eat when it needs to :-)

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
  •