Totally not what I meant their bobzilla. How often do you send reports? How do you calculate all the number your sending? All you need to do is make a function such as what I'm about to show you.
This function handled all my Progress and XP across my whole script. Here's the Function.
Function HandleProgress(const What :String; const Amount :Integer): Boolean; begin case What of 'unf': begin IncEx(Players[CurrentPlayer].Integers[SRL_UNF], Amount); IncEx(Stats_CustomVars[SRL_UNF], Amount); end; 'pot': begin IncEx(Players[CurrentPlayer].Integers[SRL_POT], Amount); IncEx(Stats_CustomVars[SRL_POT], Amount); Players[CurrentPlayer].Extendeds[SRL_XP] := (Players[CurrentPlayer].Extendeds[SRL_XP] + (Second[Players[CurrentPlayer].Integers[SRL_SEC]].XP * Amount)); IncEx(Stats_CustomVars[SRL_XP], Round(Second[Players[CurrentPlayer].Integers[SRL_SEC]].XP * Amount)); end; 'herb': Begin IncEx(Players[CurrentPlayer].Integers[SRL_Cleaned], Amount); IncEx(Stats_CustomVars[SRL_cleaned], Amount); Players[CurrentPlayer].Extendeds[SRL_XP] := (Players[CurrentPlayer].Extendeds[SRL_XP] + (Amount * Herb[Players[CurrentPlayer].Integers[SRL_Herb]].XP)); IncEx(Stats_CustomVars[SRL_XP], Round(Amount * Herb[Players[CurrentPlayer].Integers[SRL_Herb]].XP)) end; end; result := true; end;
Here's How I used it:
{******************************************************************************* function Clean() : boolean; By: Brak Description: Checks and cleans herbs if needed. returns true if clean. *******************************************************************************} function Clean() : Boolean; var CC : TIntegerArray; C, I, D :integer; begin Debug('Starting to Clean'); result := False; C := (GetTimeRunning + 30000); while GetTimeRunning < C do begin Players[CurrentPlayer].Status := 'Cleaning Herbs'; if Players[CurrentPlayer].Integers[SRL_MAK] = 0 then begin case Random(10) of 0 : CC := [1,2,3,4,8,7,6,5,9,10,11,12,16,15,14,13,17,18,19,20,24,23,22,21,25,26,27,28]; 1 : CC := [1,5,9,13,17,21,25,26,22,18,14,10,6,2,3,7,11,15,19,23,27,28,24,20,16,12,8,4]; 2 : CC := [1,2,3,4,8,12,16,20,24,28,27,26,25,21,17,13,9,5,6,7,11,15,19,23,22,18,14,10]; 3 : CC := [1,2,6,5,9,10,14,13,17,18,22,21,25,26,27,28,24,23,19,20,16,15,11,12,8,7,3,4]; 4 : CC := [1,5,9,13,17,21,25,26,22,18,14,10,6,2,3,4,8,7,11,12,16,15,19,20,24,23,27,28]; 5 : CC := [1,2,6,5,9,10,14,13,17,18,22,21,25,26,27,28,24,20,16,12,8,4,3,7,11,15,19,23]; 6 : CC := [1,5,9,13,17,21,25,26,27,23,22,18,19,15,14,10,11,7,6,2,3,4,8,12,16,20,24,28]; 7 : CC := [1,2,3,4,8,12,16,20,24,28,27,26,25,21,22,23,19,18,17,13,14,15,11,10,9,5,6,7]; 8 : CC := [1,2,3,7,6,5,9,10,11,15,14,13,17,18,19,23,22,21,25,26,27,28,24,20,16,12,8,4]; 9 : CC := [1,2,3,4,8,7,6,5,9,10,11,12,16,20,24,28,27,26,25,21,17,13,14,15,19,23,22,18]; 10 : CC := [1,5,9,13,17,21,25,26,27,28,24,20,19,23,22,18,14,15,16,12,8,4,3,2,6,10,11,7]; end; end else begin case Random(24) of 0..2 : CC := [1, 2, 3, 4, 8, 12, 11, 10, 14, 13, 9, 5, 6, 7]; 3..5 : CC := [1, 2, 6, 5, 9, 13, 14, 10, 11, 12, 8, 7, 3, 4]; 6..8 : CC := [1, 2, 6, 7, 3, 4, 8, 12, 11, 10, 14, 13, 9, 5]; 9..11 : CC := [1, 2, 6, 5, 9, 13, 14, 10, 11, 12, 8, 4, 3, 7]; 12..14 : CC := [1, 2, 3, 4, 8, 12, 11, 7, 6, 5, 9, 13, 14, 10]; 15..17 : CC := [1, 5, 9, 13, 14, 10, 11, 12, 8, 4, 3, 7, 6, 2]; 18..20 : CC := [1, 5, 9, 13, 14, 10, 6, 2, 3, 7, 11, 12, 8, 4]; 21..23 : CC := [1, 5, 9, 13, 14, 10, 6, 2, 3, 4, 8, 7, 11, 12]; end; end; InvMouse(1,3); Wait(RandomRange(700,1000)); if WaitUpTextMulti(['Clea', 'lean', 'lea', 'ean'],500) and IsClean(1) then begin result := True; Debug('using Clean Herbs'); exit; end else begin Debug('Cleaning Herbs.'); for I := 0 to High(CC) do begin InvMouse(CC[I],1); wait(200 + Random(200)); HandleLvl; end; CCI := CC[High(CC)]; while not(IsUpTextMultiCustom(['Clean', 'lean'])) do begin wait(RandomRange(200, 300)); Inc(D); if D = 20 then begin result := false; NextPlayer(false); exit; end; end; Debug('Finished Cleaning Herbs'); Players[CurrentPlayer].Integers[SRL_STS] := 1; [B]result := HandleProgress('herb', 14);[/B] exit; end; end; end;
Note: This is old code as I'm not on my home computer and haven't commited to the SVN. But it's very easy to update it.
From here all you have to do is use the information in your progress report and hit the stats_commit. If you wanted to make stats commit every 10 minute instead. Just make a global Integer to used as a Time keeper. Make a function using Timing Procs to check the time and send with reset of the timer afterwards. then just put it into your primary loop.
If you need more explainations/Demonstrations I'll be Off in a few hours and can get on MSN/IRC to assist you.
~BraK
E: Crap code didn't transfer clean. Your gonna have you wait a little bit or decifer it. You can also find the same code in my Herblore script in the members section. You'll have to visit the SVN.