Sir R. M8gic1an
2010-09-06 05:27:29
The bug is what the thread tittle says.
The mainloop & high level procs need more logic
~RM
The mainloop & high level procs need more logic
~RM
2010-09-06 05:27:29
2010-09-06 11:13:23
2010-09-06 14:21:40
2010-09-07 03:11:34
2010-09-07 14:40:35
From: Sir R. Magician
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
2010-09-07 19:18:27
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);
2010-09-07 21:21:04
if (InvCount > Length(MSI_FindAllToolSlots)) then
goto Bank;
That way if there's more items than just the tools, it will bank. :)
2010-09-08 00:34:00
From: Coh3n
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. :)
if (InvCount > Length(MSI_FindAllToolSlots)) then
goto Bank;
2010-09-08 14:27:41
2010-09-08 14:30:00
From: Zyt3x
I honestly hate labels… I just use a repeat…until(True) loop, and use Break; or Continue;
2010-09-08 17:59:54
2010-09-09 01:09:38
From: Sir R. Magician
if not InvFull then walk … no?
e: well if we consider runecrafting, we'd be walking with a full inv..
~RM
if (MSI_Locations[MSI_Players[CurrentPlayer].Location].AtBank) then
Deposit
else
AutoObjects();