PDA

View Full Version : [Resolved] Need help with progress report on 6 hour reset



Brotein
02-12-2014, 08:11 PM
Having an issue with my progress report when SMART is reloaded during 6 hour reset. My script will reset the initial xp values and the timerunning remains at 6+ hours. My current progress report looks like this...

XpCount := chatBox.getXP - StartXp;
SecondS := round((getTimeRunning/1000));
XpHour := round((3600 * XpCount) / (SecondS));

Right before the reset

[06:00:19]: -- *************Progress Report***************
[06:00:19]: -- Total Time Running: 6 Hours, 19 Seconds
[06:00:20]: -- Xp Gained: 466049
[06:00:20]: -- Xp per Hour: 77603
[06:00:20]: -- *******************************************

After reset

[06:07:51]: ---- *************Progress Report***************
[06:07:51]: ---- Total Time Running: 6 Hours, 7 Minutes and 51 Seconds
[06:07:51]: ---- Xp Gained: 1745
[06:07:51]: ---- Xp per Hour: 285
[06:07:51]: ---- *******************************************

I set my StartXp in the login loop, but I am wondering do all these variables stay intact on a reset? So I can add code to my login loop like...
if not isLoggedIn then
begin
...
StartXp := chatBox.getXP;
//Making this up, don't know if such a function exists
if simbaReset then
StoredXp := XpCount;
end;

And then add StoredXp to our XpCount in the progress report procedure...
XpCount := chatBox.getXP - StartXp + StoredXp;

I would like accurate information past 6 hours since this bot can run for many more hours than that. So is there a way to check for the 6hour reset, if so what is the function? Or is there a better way to solve this for the 6 hour mark?

The Mayor
02-12-2014, 08:16 PM
Just don't put your startXP calculation inside the main loop. When you start the script, login the player, grab start XP, and then repeat the main loop.

Brotein
02-12-2014, 08:25 PM
It's currently in my login procedure only. That's the problem though, it will reset the xp as if it were logging in the first time, but it doesn't reset the time running nor do I want it to. I just want to add the old XpCount to the new starting xp everytime it resets.

Hoodz
02-12-2014, 08:34 PM
It's currently in my login procedure only. That's the problem though, it will reset the xp as if it were logging in the first time, but it doesn't reset the time running nor do I want it to. I just want to add the old XpCount to the new starting xp everytime it resets.

Well do what the mayor said :)

Brotein
02-12-2014, 08:52 PM
So what you're saying is when sixHourFix() is called inside my main loop, it'll restart inside the main loop?

So instead of

begin
...
repeat
if not isLoggedIn then
begin
...
StartXp := chatBox.getXP;
end;
...
until(false);
end.

Something like this?

begin
...
if not isLoggedIn then
begin
...
StartXp := chatBox.getXP;
end;
repeat
if not isLoggedIn then
begin
...
end;
...
until(false);
end.

The Mayor
02-12-2014, 09:20 PM
So what you're saying is when sixHourFix() is called inside my main loop, it'll restart inside the main loop?

So instead of

begin
...
repeat
if not isLoggedIn then
begin
...
StartXp := chatBox.getXP;
end;
...
until(false);
end.

Something like this?

begin
...
if not isLoggedIn then
begin
...
StartXp := chatBox.getXP;
end;
repeat
if not isLoggedIn then
begin
...
end;
...
until(false);
end.

Yes, like that. It's much simpler that adding in new variables and calculations. Also don't indent your begins :smile:

Coh3n
02-14-2014, 03:19 AM
SixHourFix() simply restarts SMART when called, logs the player back in, and resumes with the script. So to answer your question, no, there are no variables that are reset when SixHourFix() is called (which is called by SRL and should technically be an internal function, but that's not the point).

Your problem is (like The Mayor said) that you're setting the startXP variable inside your mainloop's repeat loop, meaning it will reset every iteration of the loop. Just make sure you're only setting your startXP variable once. :)

Brotein
02-14-2014, 03:26 PM
Yup got it all sorted thanks guys!