+ Reply to Thread
Results 1 to 12 of 12

Thread: Going to loc with InvFull

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

    Default Going to loc with InvFull

    The bug is what the thread tittle says.

    The mainloop & high level procs need more logic

    ~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
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    I'm assuming your talking about going from the bank?

  3. #3
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    What...? Are you talking about right when the script is started? That's the only time I can think of this happening..

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

    Default

    Well.. I paused it and played around a little bit. I usually put logic in my scripts for it to always be able to detect what it should be doing, in case anything went strange, so that it never loses track of itself. Not really necessary I guess.

    e: just checked, it does happen at script start as well

    ~RM
    Last edited by Sir R. M8gic1an; 09-07-2010 at 08:16 AM.

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

  5. #5
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Sir R. Magician View Post
    Well.. I paused it and played around a little bit. I usually put logic in my scripts for it to always be able to detect what it should be doing, in case anything went strange, so that it never loses track of itself. Not really necessary I guess.

    e: just checked, it does happen at script start as well

    ~RM
    Yeah, I don't think there's a InvFull check before it goes to the location.

  6. #6
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Does anyone object to using a label? That's what I do in my personal scripts.

    if we add the Slot attribute to the TScript record as being discussed in this thread: http://villavu.com/forum/showthread.php?t=58822
    Then we could make the MainLoop go something like this:
    Simba Code:
    repeat
          MarkTime(time);

          // Walk to location if using a bankable script
          if (not (MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript]].BankType = NoBank)) then
          begin
            //Could use something like this:
            if ((Slot > 0) and (InvCount > 1)) or ((Slot = 0) and (InvCount > 0)) then
              goto Bank;
            //or something like this:
            if Length(MSI_FindItemSlots(..)) > 1 then
              goto Bank;
            if (not MSI_Walk(True)) then
            begin
              if (MSI_TimedOut) then
                Break;

              MSI_UnsetPlayer('MSI_MainLoop', 'Failed to walk to location', False);
              Break;
            end;
          end;

          // Perform the skill
          if (not MSI_AutoObjects) then
          begin
            if (MSI_TimedOut) then
              Break;

            MSI_UnsetPlayer('MSI_MainLoop', 'Failed to use script: ' + IntToStr(CurrentScript), True);
            Break;
          end;

          Bank: //Could be here to make sure we are at the bank...
          if (not (MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript]].BankType = NoBank)) then
          begin
            if (not MSI_Walk(False)) then // Walk to the bank
            begin
              if (MSI_TimedOut) then
                Break;

              MSI_UnsetPlayer('MSI_MainLoop', 'Failed to walk to bank', False);
              Break;
            end;

            //Or here to just assume we're at the bank.
            if (not MSI_BankMaterials) then // Bank the materials
            begin
              if (MSI_TimedOut) then
                Break;

              MSI_UnsetPlayer('MSI_MainLoop', 'Failed to bank materials', False);
              Break;
            end;
          end;

          // Set the progress report times
          with ProgressReportArray[CurrentPlayer] do
          begin
            IncEx(PlayerTime, TimeFromMark(time));
            IncEx(ScriptInfo[CurrentScript].Runtime, TimeFromMark(time));
          end;

          MSI_ProgressReport;
          MSI_WritePlayerINI;

          with ProgressReportArray[CurrentPlayer] do
            if (LoadsDone >= (MSI_Players[CurrentPlayer].Loads[L_TOTAL] + RandomRange(-10, 10))) then
            begin
              MSI_UnsetPlayer('MSI_MainLoop', 'Finished total loads!', True);
              Break;
            end;

          Inc(tmpLoads);
          if (tmpLoads >= (MSI_Players[CurrentPlayer].Loads[L_BREAK] + RandomRange(-2, 2))) then
          begin
            MSI_HandleBreaking;
            MSI_FindRandoms;
            Break;
          end;

        until(not MSI_Players[CurrentPlayer].Active);

    Just throwing out an idea.

  7. #7
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    I don't particularly like labels, but that looks like it should work. I think this would work better:
    Simba Code:
    if (InvCount > Length(MSI_FindAllToolSlots)) then
      goto Bank;
    That way if there's more items than just the tools, it will bank.

  8. #8
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    I don't particularly like labels, but that looks like it should work. I think this would work better:
    Simba Code:
    if (InvCount > Length(MSI_FindAllToolSlots)) then
      goto Bank;
    That way if there's more items than just the tools, it will bank.
    Tested and committed

  9. #9
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    I honestly hate labels... I just use a repeat...until(True) loop, and use Break; or Continue;

  10. #10
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    I honestly hate labels... I just use a repeat...until(True) loop, and use Break; or Continue;
    Wouldn't work as well with MSI's MainLoop though. The label keeps it nice, neat, and clean.

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

    Default

    if not InvFull then walk ... no?

    e: well if we consider runecrafting, we'd be walking with a full inv..

    ~RM

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

  12. #12
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Sir R. Magician View Post
    if not InvFull then walk ... no?

    e: well if we consider runecrafting, we'd be walking with a full inv..

    ~RM
    Could have a skill case in the mainloop so that depending on the skill, it would check for a full inventory. Fighting would be like runcrafting, you'd want a full inventory of food. I'm sure there are other examples also.

    E: Just got an idea. Why not add an AtBank attribute to TLocation, then just call something like this in the mainloop?
    Simba Code:
    if (MSI_Locations[MSI_Players[CurrentPlayer].Location].AtBank) then
      Deposit
    else
      AutoObjects();

    E: Committed.
    Last edited by Coh3n; 09-14-2010 at 02:35 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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