Results 1 to 10 of 10

Thread: Help with my eating procedure :)

  1. #1
    Join Date
    Mar 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with my eating procedure :)

    Ok so Im making a eating procedure for my goblin killing script and I cant get it to eat and im not sure waht exactly Im doing wrong...


    Simba Code:
    Procedure EatTuna;
    Var
     TunaDTM:Integer;
     I, x, y:Integer;
    Begin;
      TunaDTM:= DTMFromString('m6wAAAHic42ZgYHBiYmAwBWJrIHYGYi8gDgBiXyD2gYo5ArElED8Hqn8DxB+B+AMQvwDiZ0D8AIhvIdFPgDjSz4ehNi8HyGIiAhMPGEnASAAAOVwPSA==');
      GameTab(tab_Inv);
      FindDTM(TunaDTM, x, y, MIX1, MIY1, MIX2, MIY2);
        if FindDTM(TunaDTM, x, y, MIX1, MIY1, MIX2, MIY2) Then
          Mouse(x ,y, 5, 5, true);
          Wait(100);
          WriteLn('Eatin Tuna');
    End;


    ty all for the help in advanced :P

  2. #2
    Join Date
    Nov 2011
    Location
    MA
    Posts
    545
    Mentioned
    3 Post(s)
    Quoted
    10 Post(s)

    Default

    try something like this first to test your DTM
    Simba Code:
    var NumbTuna : Integer;

    begin
      NumbTuna := CountItems('dtm', tunaDTM, []);
      WriteLn(NumbTuna);
    end;
    edit: also, change

    Quote Originally Posted by jkrules22 View Post

    Simba Code:
    Mouse(x ,y, 5, 5, true);
    to
    Simba Code:
    Mouse(x, y, 5, 5, mouse_left);

    Final edit: You should also use WaitFindDTM instead and delete the first FindDTM. Only use the if ... then one
    Last edited by tehq; 03-31-2012 at 01:06 AM.

  3. #3
    Join Date
    Mar 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok so I tried that and Im asuming since it said:
    0
    Successfully executed.
    The following DTMs were not freed: [2]

    That my dtm is wrong?
    And Im not sure what to do with the DTMs were not freed

  4. #4
    Join Date
    Nov 2011
    Location
    MA
    Posts
    545
    Mentioned
    3 Post(s)
    Quoted
    10 Post(s)

    Default

    Just add
    Simba Code:
    FreeDTM(TunaDTM);
    right before the end; to free the DTM

    Try making a new DTM of the tuna and keep using the piece of code i posted until it returns a number.

  5. #5
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    u dont really need dtm, first: tell it when to eat with hppercent in ur main loop. and try a procedure like this

    Simba Code:
    procedure eat;
    var
    i:integer ;
    begin
      repeat
      for i := 5 to 9 do   // slots in inv it will look for (make it 1 to 28 for full inv)
        begin
          InvMouse(I, 3);
          if IsUpText('una') then  //with this, u dont need dtm
          begin
            ClickMouse2(True);
            Wait(RandomRange(500, 1000));
        end;
       end;
        until (HPPercent > 95);    //will repeat the process until hp % is above 95%

    and in ur main loop, to tell ur script when to eat, do something like this:

    Simba Code:
    if (hppercent < 50) then  //this means if hp % is below 50% then begin eat procedure
          begin
          eat;
          end;

    hope this helped u =)

  6. #6
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by jkrules22 View Post
    Ok so I tried that and Im asuming since it said:
    0
    Successfully executed.
    The following DTMs were not freed: [2]

    That my dtm is wrong?
    And Im not sure what to do with the DTMs were not freed
    This means you need to remake your DTM since it isn't finding it..

  7. #7
    Join Date
    Mar 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok I may sound like a noob but... Ive re-did my DTM like 3 or 4 times now and its still not finding my dtm..Any suggestions? and I know this is getting a little ahead of myself since Im having trouble with my dtm but I also wanted to make it so when i do have a working dtm and it cant finds it, it makes it go though my banking procedure.




    Edit: I didnt see ogustuce's post, Ill try doing that then get back to ya.


    Edit again: Yay Tyvm that worked!
    Now is there a way to make it if theres no tuna in inv. it will run my bank procedure?



    Btw my new procedure looks like this:

    Simba Code:
    Procedure EatTuna;
    Var
      I:Integer;
    Begin
      GameTab(tab_Inv);
      Repeat
      for I := 1 to 26 do
        Begin
          InvMouse(I, 3);
          if IsUpText('Tuna') then
          Begin
            ClickMouse2(True);
            Wait(RandomRange(1500, 2000));
        End;
       End;
        until (HPPercent > 90);
     End;



    My new problem is that it eats like my whole inv..Im not sure what i have wrong in there but i do have it at until (HPPercent > 90), also Can someone explain how I would make it check for food and if no food it starts my banking procedure?
    Last edited by jkrules22; 03-31-2012 at 04:24 AM.

  8. #8
    Join Date
    Nov 2011
    Location
    MA
    Posts
    545
    Mentioned
    3 Post(s)
    Quoted
    10 Post(s)

    Default

    I will edit this post later on how to fix it when im on my computer.

    E: Smidqe beat me to it
    Last edited by tehq; 04-01-2012 at 08:48 PM.

  9. #9
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    299
    Mentioned
    8 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by jkrules22 View Post
    Simba Code:
    Procedure EatTuna;
    Var
      I:Integer;
    Begin
      GameTab(tab_Inv);
      Repeat
      for I := 1 to 26 do
        Begin
          InvMouse(I, 3);
          if IsUpText('Tuna') then
          Begin
            ClickMouse2(True);
            Wait(RandomRange(1500, 2000));
        End;
       End;
        until (HPPercent > 90);
     End;



    My new problem is that it eats like my whole inv..Im not sure what i have wrong in there but i do have it at until (HPPercent > 90)
    Repeat..until loop is unnecessary in that procedure so you can remove that, what I suggest is that you break out of from for to do loop if the HPPercent is over 90 like this:
    Simba Code:
    Procedure EatTuna;
    Var
      I:Integer;
    Begin
      GameTab(tab_Inv);
      for I := 1 to 26 do
      Begin
        if (HPPercent > 90) then    
          break;
        InvMouse(I, 3);
        if IsUpText('Tuna') then
        Begin
          ClickMouse2(True);
          Wait(RandomRange(1500, 2000));
        End;
      End;
    End;
    What it does it first checks the HPPercent and if it's lower than 90 percent then it'll click the tuna, if percentage is > 90 then it'll break from the loop.
    Rusting away

  10. #10
    Join Date
    Mar 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks

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
  •