Results 1 to 9 of 9

Thread: How to tell if player is smelting?

  1. #1
    Join Date
    Jun 2014
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default How to tell if player is smelting?

    Hi guys,

    Right now for my cannonball smelting script, I am using Reflect.Inv.WaitChange to see if the player is currently smelting cannonballs as it checks to see if the inventory has changed in the past interval. Problem with that is that smelting cannonballs takes a while per smelt, so I have to use like 14-16 seconds as my range for that function, which makes the script really inefficient as it can lead to up to a 16 second wait after the player is done smelting for the script to realize that its time to bank. My question is: is there another function that can be used to check if the player is currently in the process of smelting?

  2. #2
    Join Date
    Nov 2011
    Location
    Norway
    Posts
    203
    Mentioned
    4 Post(s)
    Quoted
    100 Post(s)

    Default

    After a quick look in the reflection include (Includes\reflection\lib\core\renderable -> LocPlayer), maybe this is what you are looking for:

    function TReflectLocalPlayer.IsAnimating: Boolean;
    begin
    Result := Self.GetAnimation > -1;
    end;

  3. #3
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    You could also check if the 28th inventory slot is empty, as when you smith a set of 4 cannonballs, the steel bar is used which leaves you with a finished inventory of 1 mould and however many cannonballs.

  4. #4
    Join Date
    Jun 2014
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Chris! View Post
    You could also check if the 28th inventory slot is empty, as when you smith a set of 4 cannonballs, the steel bar is used which leaves you with a finished inventory of 1 mould and however many cannonballs.
    The problem with that though is that if the smelting gets interrupted for whatever reason, then the script would think that the player is still smelting as the 28th inventory slot would still have a Steel bar.

  5. #5
    Join Date
    Feb 2015
    Posts
    422
    Mentioned
    41 Post(s)
    Quoted
    226 Post(s)

    Default

    Quote Originally Posted by Spoola View Post
    Hi guys,

    Right now for my cannonball smelting script, I am using Reflect.Inv.WaitChange to see if the player is currently smelting cannonballs as it checks to see if the inventory has changed in the past interval. Problem with that is that smelting cannonballs takes a while per smelt, so I have to use like 14-16 seconds as my range for that function, which makes the script really inefficient as it can lead to up to a 16 second wait after the player is done smelting for the script to realize that its time to bank. My question is: is there another function that can be used to check if the player is currently in the process of smelting?
    Idk much about OSR but maybe you could add an integer variable and do something like

    Simba Code:
    for i := 1 to 28 do
      if {a line that checks if there is an item in slot i} then
        if Reflect.Inv.WaitChange(randomRange(14000,16000)) then
          wait(50)   //or antiban or anything you want it to do
        else
          break;  // breaks out of the loop if no change is detected

    The above code will loop through all the inventory slots and only wait for a change if an item has been detected in that slot, and will stop after item 28, so it wont wait extra. That is how I would do it in RS3 if there wasn't a progress screen. However this might not work for the first slot, because there isn't technically a change in the count, with the first slot because it is being replaced by cannon balls.

  6. #6
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Make a DTM of that bar you're smelting. If the DTM ceases to exist in the last slot, you've smelted all your bars.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  7. #7
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    you could count items in inventory, wait 4.5 seconds (cannonbals take 4 secs) and if count1 = count2 then your stuck. You'll ussually get stuck because of lvl up.

    This is what i used in my cannonbals script for aerolib... its messy and has lots of stuff it doesent need, but i didnt put much effort into it, check if you get any ideas from it. This one checks for steel every 1.5 secs, so when you've done the full inventory it'll finish.

    Simba Code:
    function waitBalls: boolean;
    var
      tries, x, y: integer;
      TPA: TPointArray;
      T: Timer;
    begin

      T.start;

      repeat
      inc(tries);
      antiban(1200);
      if not isLoggedIn() then
        exit;
      if not findDTMs(Steel_DTM, TPA, 548, 204, 734, 465) then
        break;
      wait(randomrange(1000, 1500));
      if random(20) = 1 then
        report;
      if random (10) = 1 then
        writeln('Waiting to finish smelting');
      if findDTM(level_DTM, x, y, 6, 347, 513, 476) then
      begin
        writeln('We leveled up');
        exit(false);
      end;
      until false or tries >= 300;

      if tries >= 300 then
        writeln('Exit Script, something is wrong.');

      if tries < 300 then
        result:= true;

      if result = true then
        TripReady := false;

      if random (15) = 1 then
        wait(randomrange(20000, 60000));

      writeln('function waitBalls := ' + tostr(result));

    end;
    Formerly known as Undorak7

  8. #8
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    Quote Originally Posted by Spoola View Post
    The problem with that though is that if the smelting gets interrupted for whatever reason, then the script would think that the player is still smelting as the 28th inventory slot would still have a Steel bar.
    Then you would combine this method with another, such as an animation function (back when I used to code I utilised PixelShift).

  9. #9
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Whats with all this checking for the last slot stuff just check to see if the inventory contains any steel bars or not

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
  •