User talk:Ilde/MajorTimer

From Discworld MUD Wiki
Jump to: navigation, search


Quitting, then closing MUSHclient

If you have a shield up, and you quit, wait, and then close MUSHclient, it will count the time between quitting and closing the client. For example, if you wait four minutes between quitting and closing the client, when you log back onto that character the shield's timer will be four minutes shorter than it should be.

  • This doesn't happen if you quit, don't close MUSHclient, and just reconnect and log back in later.
  • This doesn't happen if you su between characters.
  • It doesn't seem to matter whether you pick "yes" or "no" when it asks you if you want to save.

If you either close MUSHclient immediately after quitting, or don't close it at all, it seems to be fine.

I'm not sure what's causing this or how to fix it. --Ilde 21:50, 28 April 2013 (UTC)

Sounds like there's a trigger when you close MUSHclient that recalculates before saving.
I'd say in Save_Saveable_Variables () called by either OnPluginSaveState () or OnWorldSave () but I'm not sure.
Maybe try removing the line "previous_time_left = finish_time - os.time ()".
--Frazyl 07:46, 29 April 2013 (UTC)
It seems like anything I do along those lines just introduces a new, worse bug, where it makes it so that it somehow gets confused about what the current character is: if I put up a shield, su to a different character, and put up a shield again, it adds the new shield to the other character's timer.  :/ That kind of thing. Although it does seem to solve the "timer keeps running out until I actually close MUSHclient" issue. Let's see, I tried:
  • Removing "previous_time_left = finish_time - os.time ()" from Save_Saveable_Variables () (and adding it to Switch_User () ),
  • Just removing the "Save_Saveable_Variables ()" from both OnPluginSaveState () and OnWorldSave (), and
  • The current iteration: creating a log_off_time variable that's set to os.time during Switch_User () and Pause_Timer (), and using that in Save_Saveable_Variables () instead of os.time. See here; diff here.
(I didn't think to save the first two tries, but they all seem to have the same problem.)
This baffles me.
--Ilde 23:31, 29 April 2013 (UTC)
Should probably remove from function Pause_Timer the following code, because it's done better in function Save_Saveable_Variables. Or possibly worst. Anyway it's done twice.
 if active == "yes" then
   previous_time_left = finish_time - os.time ()
   Note ("Paused major timer.")
 end -- if
Also, since active="yes" is still there after you logout, I'm guessing function show_time might continue and muck up stuff by changing finish_time... not sure how though.
So you could try changing function Pause_Timer to look like so:
function Pause_Timer (name, line, wildcards)
  Save_Saveable_Variables ()
  active = ""
  finish_time = ""
end -- pause_timer
That way, it will save active="yes" if it is so before, but will do less stuff until it loads it again.
I don't use MUSHclient so can't really try stuff. Hope this helps a bit.
--Frazyl 09:00, 20 May 2013 (UTC)
Just leaving a note that I'll try this when I get the time/motivation to do it and test it properly, getting a little ridiculous to leave this tab open for weeks without doing anything about it. --Ilde 16:56, 6 June 2013 (UTC)
Bleh. Alright, when I tried all that, it switched to just zeroing the timer completely after I quit MUSHclient. I.e. I would have time left on the timer, quit, close MUSH, and then when I logged back in the timer would be gone (regardless of whether I said "yes" or "no" when it said it wanted to save). On the other hand, if I just take out the extra stuff in Pause_Timer (actually, since that meant there was nothing in it but calling Save_Saveable_Variables, I just told the one thing that calls Pause_Timer to call Save_Saveable_Variables instead) there's no change (it runs down the timer between quitting the MUD and exiting the client, but does at least bring the timer back upon logging back in). --Ilde 19:32, 9 June 2013 (UTC)


  • It now recognizes "You are really protected by" as text that starts your major.
  • It will now notice the "Your divine protection is weakening" message, and accordingly set the time left to 20 seconds.
  • Added Mx to the titles it recognizes in the output of whoami. Also Lord, Lady, Dr, Doctor, Professor, and various new-since-the-last-update achievement titles.
  • You can now use mtmove, mtposx, and mtposy to move the window around. These are explained in the helpfile ("help majortimer" or, for those three specifically, "mtmove" with no arguments).
  • You can now put the window in brief mode with "mtwintext brief" (and back to verbose with "mtwintext verbose"). This just takes out the "Major shield expires in: " text and changes "Shield due to drop!" to "Expiring!"

--Ilde (talk) 21:59, 10 June 2019 (EDT)