Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20

Thread: Mafia being left open through dayroll without clicking anything until dayroll over

  1. #1
    Senior Member
    Join Date
    Oct 2017
    Posts
    598

    Default Mafia being left open through dayroll without clicking anything until dayroll over

    I did not notice dayroll occuring while i was writing code on my script.
    30 minutes after dayroll I finished writing and ran my new script to test it.

    Running the script caused a quick login, where mafia skips doing any of the login stuff:
    * dayroll resetting _ settings
    * checking SVN
    * breakfast

    Then I noticed it was past dayroll I restarted mafia, at which point it reset all the _ settings and did the other things above.
    but my state became incorrect due to changes that occurred after dayroll but that mafia attributed to happening yesterday.

    Also, when trying to quite mafia (manually or automatically) it should not run the on exit script if you left mafia open through dayroll
    Last edited by taltamir; 06-02-2020 at 06:50 PM.
    ttpack = a collection of scripts by taltamir

  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,311

    Default

    Timing-in is intentionally intended to be leaner than logging in or doing a full session refresh.
    I agree that daily settings need to be reset.
    I disagree that breakfast or svn should be run.

    By "on exit", I assume you mean "On Logout"? Why in the world would you have a script that is intended to run every time you logout (potentially many times a day) that you don't want to run when you log out in this circumstance? How is this situation different than you logging in the for the first time in a new day and then immediately logging out without doing anything?

    I have a patch which will reset settings if we detect rollover has happened, in the same way that logging in detects that.
    I will test it at rollover tonight.

  3. #3
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,311

    Default

    Huh. That didn't work.

    Code:
    Updating inventory...
    Installing default certificate validation...
    Sending login request...
    *** slot acc1: KoL has (none) but KoLmafia has Draftsman's driving gloves
    Synchronizing moon data...
    Requests complete.
    
    > prefref _drip
    
    Name               Value   Default  Scope
    _drippyCaviarUsed  false   false    user
    _drippyNuggetUsed  true    false    user
    _drippyPlumUsed    false   false    user
    _drippyWineUsed    true    false    user
    
    > get lastCounterDay
    
    1591241397
    
    > get lastGlobalCounterDay
    
    1591241402
    
    > ash rollover()
    
    Returned: 1591327803
    
    > ash ( rollover() - get_property( "lastCounterDay" ).to_int() )
    
    Returned: 86406
    I'll have to think about this some more.

    And I also think that if we have a new day, we have to reset the Cafe specials and maybe other things.

  4. #4
    Senior Member
    Join Date
    Oct 2017
    Posts
    598

    Default

    By "on exit", I assume you mean "On Logout"? Why in the world would you have a script that is intended to run every time you logout (potentially many times a day) that you don't want to run when you log out in this circumstance? How is this situation different than you logging in the for the first time in a new day and then immediately logging out without doing anything?
    Originally Posted by Veracity View Post
    At the moment if you are doing stuff until dayroll hits, mafia detects dayroll is ongoing and will kick you back to login screen, but when doing so it will try to run your logout script which itself throws errors about currently being during dayroll.

    I was assuming that this would be resolved by automatically kicking you back out to the login window if dayroll already passed you so that you can log back in formally and it can do all the needed dayroll things.
    but in that case when it runs the logout script it will actually successfully run instead of erroring that we are during dayroll.
    But be successfully run with yesterdays tracker and cause tracking errors
    Last edited by taltamir; 06-04-2020 at 11:30 PM.
    ttpack = a collection of scripts by taltamir

  5. #5
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,798

    Default

    I'd be happy with mafia performing no actions and simply kicking us back to the login window if it detected that rollover had passed. Would save me the trouble of closing the window and then restarting (which I do presently rather than simply "exit"ing, due to not wanting my logout script to run and inevitably have errors, as taltamir mentioned).
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Woss | Om****est (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  6. #6
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,311

    Default

    At the moment if you are doing stuff until dayroll hits, mafia detects dayroll is ongoing and will kick you back to login screen, but when doing so it will try to run your logout script which itself throws errors about currently being during dayroll.
    Originally Posted by taltamir View Post
    So, if you are doing stuff and rollover hits, when you issue a request, KoL redirects to maint.php. That is the definition of what describe as "being during dayroll". (A word I had never heard, before you used it in this thread.)
    .
    You say that KoLmafia then runs the logout script? That is a KoLmafia bug; if KoLmafia detects that rollover is in progress, it should give you the login window and not run the logout script.

    Which has literally nothing to do with the issue you initially reported, where you said that 30 minutes after rollover, you tried to issue a request and KoLmafia timed you in, as it does any time a request redirects to login.php - not maint.php. Therefore, you are not "during dayroll". You are "after dayroll". And the ONLY way we can distinguish that case, as opposed to any other timein, is to log you in, call api.php, and notice that the next rollover time is a day later than it was last time we looked it it.

    I was assuming that this would be resolved by automatically kicking you back out to the login window if "dayroll already passed" you so that you can log back in formally and it can do all the needed "dayroll" things.
    Which is to say, you are assuming that KoLmafia will log you in and detect it is the next day (i.e. "dayroll has already passed") and then, somehow, log you out and send you to the login window, so that you can then log in again.

    I think that if a request redirects to maint.php, we should send you to the login window without running the logout script.
    I think that if a request redirects you to login.php, we should time you in, and if we detect that "dayroll has passed", reset all the counters and such as if you had logged in to a new day, and then let you carry on from there.

    I'd be happy with mafia performing no actions and simply kicking us back to the login window if it detected that rollover had passed. Would save me the trouble of closing the window and then restarting (which I do presently rather than simply "exit"ing, due to not wanting my logout script to run and inevitably have errors, as taltamir mentioned).
    Originally Posted by zarqon View Post
    In other words, you want it to time you in and then immediately log you out (sans logout script) and kick you back to the login window if it detects a new day has passed.

    I still have not heard about exactly what errors you get in a logout script which are not due to the properties not resetting correctly. If I time you in and reset properties for a new day - if you are on a new day - what is your logout script expecting that would make that work differently than logging you in via the login window (rather than timein) ad resetting properties?

    Is the issue, literally, only that the logout script depends on the current values of properties being correct - rather than yesterday's values? Which is, specifically, the issue that my approach is attempting to solve with a single login, rather than forcing a login/logout/login, which both of you seem to want?
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  7. #7
    Senior Member
    Join Date
    Oct 2017
    Posts
    598

    Default

    Which has literally nothing to do with the issue you initially reported
    Originally Posted by Veracity View Post
    Yes, it is a separate issue entirely.

    I only brought it that separate issue because it is potentially become relevant if the first issue is fixed a certain specific way.
    Which happened to be the way I initially assumed it would get fixed
    Which is to say, you are assuming that KoLmafia will log you in and detect it is the next day (i.e. "dayroll has already passed") and then, somehow, log you out and send you to the login window, so that you can then log in again.
    Originally Posted by Veracity View Post
    Does it actually need to login to detect a day passed? couldn't you do
    Code:
    boolean timing_in()
    {
    if(dayroll_passed())
      quit_to_login_window();
    else
      current_timing_in_code();
    }
    replacing the current timing_in() function that performs that quick login with the above one?
    Last edited by taltamir; 06-05-2020 at 03:46 AM.
    ttpack = a collection of scripts by taltamir

  8. #8
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,311

    Default

    Does it actually need to login to detect a day passed?
    Originally Posted by taltamir View Post
    Yes.

    Whenever we call api.php?which=status, it tells us what time rollover is. We save that in what rollover() returns. If that has changed by at least an hour since the last time we saved it, a day has passed.

    You have to be logged in to do api.php?what=status.

    couldn't it check to see if a day passed without logging in, and if it has then switch to the login window?
    I know of no way to do that.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  9. #9
    Senior Member
    Join Date
    Oct 2017
    Posts
    598

    Default

    Yes.

    Whenever we call api.php?which=status, it tells us what time rollover is. We save that in what rollover() returns. If that has changed by at least an hour since the last time we saved it, a day has passed.

    You have to be logged in to do api.php?what=status.


    I know of no way to do that.
    Originally Posted by Veracity View Post
    Thank you for explaining. I assumed it was being done via a date and time check (adjusted to your timezone).

    As for what my logout script does.
    it uses up my remaining fortune teller asks, puts my pvp stealable expensive items in my closet, and runs breakfast. Which does a bunch of daily actions which could be a problem if you just broke prism to liberate the king (thus making a bunch of iotms with daily limits that were unavailable become available).

    I honestly thought I had more things there but in retrospect I put most of them in my login script.
    I am going to add taking and then abandoning a platinum guzzlr delivery if in run into the logout script though. rather than the login one.
    ttpack = a collection of scripts by taltamir

  10. #10
    Senior Member
    Join Date
    Oct 2017
    Posts
    598

    Default

    That all being said.

    Why would it be so bad to have timein login, detect missed a rollover, then immediately halt all scripts and logout without doing anything else?

    It still sounds like the best way to handle this.
    so when you do log in again manually it will do the full shebang of resetting _ valueus. updating svns, doing breakfast, and running your login script.

    Also an idea i had... could a threaded timer be set when you first login that is equal to the remaining time until dayroll and counts down towards dayroll? even if you are timed out the timer will continue counting down, and when it reaches zero it sends back to mafia's main window to shut down? that way the entire possibility of timing in after dayroll could be made impossible.
    ttpack = a collection of scripts by taltamir

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •