Results 1 to 7 of 7

Thread: EatFood(What: String; TheHp: Integer): Boolean;

  1. #1
    Join Date
    Feb 2007
    Location
    @ SRL
    Posts
    402
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    EatFood(What: String; TheHp: Integer): Boolean;

    Hey guys,

    I made this food eating function that will check your Inventory for food and eat it if your HP level is equal to or below "TheHp: Integer;".
    It will also not check for food if there is no food left.


    It currently searches for and eats:

    • Trout
    • Salmon
    • Tuna
    • Lobster
    • Bass
    • Swordfish
    • Monkfish
    • Shark


    They are the most common food, so thats why I only did them..
    So here it is.. PLEASE TEST IT AT LEAST ONCE FOR ME PLEASE


    SCAR Code:
    {*******************************************************************************
    function EatFood(What: String; TheHp: Integer);
    By: TurboBk
    Description: Finds the food 'What' in your Inv and eats it.
                 Will not eat if your HP level is not <= TheHp.
                 Will not eat if theres no food left.
    *******************************************************************************}


    Function EatFood(What: String; TheHp: Integer): Boolean;
    Var
      ColorSign, TheText: String;
      NoFood: Boolean;
      CTab, DTM, fx, fy: Integer;

    Begin
      If Not LoggedIn Then Exit;
      If Not (GetMMLevels('hitpoints', ColorSign) <= TheHp) Then Exit;
      If NoFood Then Exit;
      Case What Of
        'Trout': Begin
                   DTM := DTMFromString('78DA633CC2C4C050C5C8800C5A723319FE036' +
                        '990E87F2060BC0054938BAA06220B238134C89C02026A7663DA85' +
                        'A1663B504D0B11763511507309A8A618BF1A005C010F29');
                   TheText := 'rout';
                 End;
        'Salmon': Begin
                    DTM := DTMFromString('78DA63CC61626078CE8002EEF9C932FC07D28' +
                         'C40FC1F0818CB816A6E30A0014624124883CCB943404D3C50CD07' +
                         '026A72816ADE12500372CF3DFC6A00633C0E4A');
                    TheText := 'almon';
                  End;
        'Tuna': Begin
                  DTM := DTMFromString('78DA639CC6C4C0F0820105D467A531FC07D28' +
                       'C40FC1F0818E700D53C6040038C4824909E0854F390809A4EA09A' +
                       '0F04D4CC00AA794F40CD02A09A27F8D50000E64E0F58');
                  TheText := 'una';
                End;
        'Lobster': Begin
                     DTM := DTMFromString('78DA63FCC8C4C050C1C8800C0E664832FC07D' +
                          '220D1FF40C0F81DA8260B550D44164602E9F740352504D43C02AA' +
                          '2927A0E613504D1B01355F816ACAF0AB0100A8790ECA');
                     TheText := 'obste';
                   End;
        'Bass': Begin
                  DTM := DTMFromString('78DA63DCCFC4C0F0820105ACCE4F62F80FA41' +
                       '981F83F10301E03AA79C08006189148207D00A8E63601359B816A' +
                       '3E105073900835A7806A9EE0570300828E107F');
                  TheText := 'ass';
                End;
        'Swordfish': Begin
                       DTM := DTMFromString('78DA637462626060616440060B8A5730FC07D' +
                            '220D1FF40C0680F54F38F010D30229140DA12A8868311BF1A5BA0' +
                            '1A6E026A7C806A5809A8F104AAF98FDF3D008D860A7D');
                       TheText := 'ordfi';
                     End;
        'Monkfish': Begin
                      DTM := DTMFromString('78DA63CC616260E0626440060A0A2C0CFF813' +
                           '448F43F1030D600D5FC6740038C4824904E07AA6166C4AF2611A8' +
                           '8693809A64A01A21026A6A816AF8F0AB0100DC900927');
                      TheText := 'onkfi';
                    End;
        'Shark': Begin
                   DTM := DTMFromString('78DA633CC4C4C050C6C8800C7243ED19FE036' +
                        '990E87F2060DC0354938DAA06220B2381F40E4C73B0AA6927A0E6' +
                        '02504D15013567816AF2F1AB0100E9180D72');
                   TheText := 'hark';
                 End;
        Else Begin
               WriteLn(What + ' is not a valid option.');
               NoFood := True;
               Exit;
             End;
      End;
      CTab := GetCurrentTab;
      GameTab(4);
      Wait(200 + Random(200));
      If FindDTM(DTM, fx, fy, MIX1, MIY1, MIX2, MIY2) Then
      Begin
        MMouse(fx, fy, 4, 4);
        Wait(200 + Random(100));
        If IsUpText(TheText) Then
        Begin
          GetMousePos(fx, fy);
          Mouse(fx, fy, 0, 0, True);
          Result := True;
          NoFood := False;
          FreeDTM(DTM);
          Wait(500 + Random(500));
          GameTab(CTab);
          Exit;
        End;
      End Else
      Begin
        Result := False;
        NoFood := True;
        FreeDTM(DTM);
        GameTab(CTab);
        Exit;
      End;
    End;


    This could be used in a script like..
    EXAMPLE
    SCAR Code:
    Const
      HpMax = 99; // Your HP Level.
    SCAR Code:
    Procedure EatIfNeeded;
    Var
      ColorSign: String;
      a, b, c: Integer;
    Begin
      b := 0;
      c := (HpMax - Random(10));
      Repeat
        EatFood('Lobster', 80);
        Wait(500 + Random(500));
        a := GetMMLevels('hitpoints', ColorSign);
        b := b + 1;
      Until(a >= c) Or (b > 2);
    End;


    Thanks,
    TurboBk.
    The game has an unexplainable attraction that convinces the player they are having fun, despite the fact that all they are doing is performing repetitive tasks to increase their statistics. "The game is actually a graphical nightmare and its gameplay is simple at best. Yet something, perhaps by subliminal means, forces the player - against his will - to play the game, and to believe that they are having fun".

  2. #2
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    looks nice, be good it it was 10- 15 lines tho try anew way to find the food so its much shorter now that would be l33t.

  3. #3
    Join Date
    Feb 2007
    Location
    @ SRL
    Posts
    402
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NiCbaZ View Post
    looks nice, be good it it was 10- 15 lines tho try anew way to find the food so its much shorter now that would be l33t.
    I could use simple colors and UpText but then it wouldn't be anywhere near as accurate as it is now.
    Also it's not that long if you think about it, and there's no lag.

    Also I don't want the Mouse hovering over any similar colors in the Inv, the DTM is the fastest most efficient way I could think of, so If there's any BETTER and more ACCURATE way to do this then please post.
    The game has an unexplainable attraction that convinces the player they are having fun, despite the fact that all they are doing is performing repetitive tasks to increase their statistics. "The game is actually a graphical nightmare and its gameplay is simple at best. Yet something, perhaps by subliminal means, forces the player - against his will - to play the game, and to believe that they are having fun".

  4. #4
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for those DTM's! I need them very bad for my and timers new project.

    I'll credit you for the DTM's, now I don't have to make them anymore lol.

  5. #5
    Join Date
    Feb 2007
    Location
    @ SRL
    Posts
    402
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by MasterKill View Post
    Thanks for those DTM's! I need them very bad for my and timers new project.

    I'll credit you for the DTM's, now I don't have to make them anymore lol.
    Haha yeah cool, no problem.
    You didn't even post anything about my EatFood function.. *crys* :'(
    The game has an unexplainable attraction that convinces the player they are having fun, despite the fact that all they are doing is performing repetitive tasks to increase their statistics. "The game is actually a graphical nightmare and its gameplay is simple at best. Yet something, perhaps by subliminal means, forces the player - against his will - to play the game, and to believe that they are having fun".

  6. #6
    Join Date
    Feb 2007
    Location
    @ SRL
    Posts
    402
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    CAN SOME PEOPLE PLEASE TEST THIS FOR ME! <3

    Just have any of the food listed above in your Inventory, crosshair over the rs client and hit run
    The game has an unexplainable attraction that convinces the player they are having fun, despite the fact that all they are doing is performing repetitive tasks to increase their statistics. "The game is actually a graphical nightmare and its gameplay is simple at best. Yet something, perhaps by subliminal means, forces the player - against his will - to play the game, and to believe that they are having fun".

  7. #7
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I just noticed something

    Change Case What Of
    To Case LowerCase(What) of

    Becuase :
    If they Type salmon etc.. it wont eat
    LowerCase fixes that

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. FindTree(TreeType : String; Tol : Integer): Boolean
    By Cazax in forum Research & Development Lounge
    Replies: 13
    Last Post: 04-07-2008, 09:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •