The bug is what the thread tittle says.
The mainloop & high level procs need more logic
~RM
The bug is what the thread tittle says.
The mainloop & high level procs need more logic
~RM
What...? Are you talking about right when the script is started? That's the only time I can think of this happening..
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
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.
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
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.
I don't particularly like labels, but that looks like it should work. I think this would work better:
That way if there's more items than just the tools, it will bank.Simba Code:if (InvCount > Length(MSI_FindAllToolSlots)) then
goto Bank;![]()
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
I honestly hate labels... I just use a repeat...until(True) loop, and use Break; or Continue;
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.
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
There are currently 1 users browsing this thread. (0 members and 1 guests)