Results 1 to 6 of 6

Thread: [#46 / #527] WaitInvCount

  1. #1
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default [#46 / #527] WaitInvCount

    PHP Code:
    {*******************************************************************************
    function 
    WaitInvCount(CountMaxTimeIntegerCountType: (MaxCTMinCTExactCT)): boolean;
    ByRasta Magician
    Description
    Waits for a maximum inv countReturns true if InvCount <= Count
    *******************************************************************************}
    function 
    WaitInvCount(CountMaxTimeIntegerCountType: (MaxCTMinCTExactCT)): boolean;
    var
      
    Tinteger;
    begin
      
    if not GameTab(tab_Invthen exit;

      
    Result := false;
      
    := GetSystemTime MaxTime;

      while 
    GetSystemTime do
      
    begin
        wait
    (10);
        case 
    CountType of
          MaxCT   
    : if InvCount <= Count then  Result := true;
          
    MinCT   : if InvCount >=  Count then  Result := true;
          
    ExactCT : if InvCount =  Count then  Result := true;
        
    end;

        if 
    Result then break;

      
    end;
    end;

    {*******************************************************************************
    function 
    WaitInvMaxCount(CountMaxTimeinteger): boolean;
    ByRasta Magician
    Description
    Waits for a maximum inv countReturns true if InvCount <= Count
    *******************************************************************************}
    function 
    WaitInvMaxCount(CountMaxTimeinteger): boolean;
    begin
      Result 
    := WaitInvCount(CountMaxTimeMaxCT);
    end;

    {*******************************************************************************
    function 
    WaitInvMinCount(CountMaxTimeinteger): boolean;
    ByRasta Magician
    Description
    Waits for a minimum inv countReturns true if InvCount >= Count
    *******************************************************************************}
    function 
    WaitInvMinCount(CountMaxTimeinteger): boolean;
    begin
      Result 
    := WaitInvCount(CountMaxTimeMinCT);
    end
    WaitInvMinCount & WaitInvMaxCount will be gone in SRL 5.
    If you wish to make the transition smoother, switch to WaitInvCount now


    eg
    WaitInvCount(InvCount + 1, 10000, ExactCT)

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  2. #2
    Join Date
    Feb 2009
    Location
    AZ, USA
    Posts
    460
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Looks cool, but why do we even need WaitInvMaxCount? or even a MaxCount option in WaitInvCount? I don't think you would need to wait for that, it will just be true or false?
    Is your account in an old-school random? Help SRL-OSR solve randoms!

  3. #3
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    I use it in many of my WaitWhileDoingX functions.

    PHP Code:
    Procedure Mine;
    var
      
    ICinteger;
    begin
      IC 
    := InvCount;
      if 
    ClickRock then
        WaitInvCount
    (IC 110000MinCT);

      if 
    GotGem then
      begin
        IC 
    := InvCount;
        
    WaitInvCount(IC 110000ExactCT)
      
    end;  
    end
    MinCount is extremely useful while fishing. I check when was the last time I got a fish, and if it was too long ago then I assume it is not fishing. ExactCount might not work, because you might have caught two fishes since you last checked.

    ~RM
    Last edited by Sir R. M8gic1an; 06-08-2010 at 06:21 PM.

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  4. #4
    Join Date
    Feb 2009
    Location
    AZ, USA
    Posts
    460
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Umm, you're not using MaxCT
    Is your account in an old-school random? Help SRL-OSR solve randoms!

  5. #5
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Ogre View Post
    Umm, you're not using MaxCT
    Doesn't hurt to have it.

    InvMaxCount Scenario:

    Your smelting steel bars. You took out 10 iron and 18 coal

    WaitInvCount(10, 20000, MaxCT);

    This will work whether you have 10 or 9 iron.

    MinCount wouldn't work
    ExactCount might fail.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  6. #6
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now that school and my exams are almost over I have started to think about scripting again. And ^ this is what I use in my smelter(not with this cool new functions ofc). I may rewrite it(smelter) in MSI standards as I want to do something with MSI too. I wanted always, but sadly I don't got that time thing that Hermione got. And future life > fun..., erm what? I mean ..., you know.

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
  •