Results 1 to 8 of 8

Thread: Dependence day not detected on IRL date 0704

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

    Default Dependence day not detected on IRL date 0704

    Holidays can occur either due to IRL holidays or due to kol internal calendar.
    holiday() function does not detect dependence day when IRL date ends in 0704 aka 4th of july

    I can try to make a script recognize it via checking the date with today_to_string().substring(4, 8) == "0704"
    but even if I do it will not let me do holiday specific actions because mafia does not recognize it as today's holiday.
    For example, I can't buy green rocket because it can only be bought on dependence day, and as far as mafia is concerned today is not dependence day, so trying to buy it fails
    ttpack = a collection of scripts by taltamir

  2. #2

    Default

    I've got 'usable quantity of green rocket is limited to 0 by a wizard'. The relay browser let me use one manually, though.

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

    Default

    Revision 20233

  4. #4
    Senior Member
    Join Date
    Apr 2019
    Posts
    205

    Default

    little note: the CLI command " holiday Dependence Day " didn't seem to do anything/the ash function " holiday() " was still returning an empty string. Am I understanding how this command works wrong, or what?

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

    Default

    Clearly.

    Looking at the code, it doesn't actually change an internal "holiday" object. Probably because we don't actually store such a thing anywhere; everywhere we want to know the holiday, we call HolidayDatabase.getHoliday(), which recalculates it based on KoL + Real World Dates.

    Here is what the command calls:

    Code:
    	public static final void setHoliday( final String holiday )
    	{
    		KoLCharacter.isFullnessIncreased = holiday.contains( "Feast of Boris" ) || holiday.contains( "Drunksgiving" );
    		KoLCharacter.holidayManaCostReduction = holiday.contains( "Festival of Jarlsberg" ) ? 3 : 0;
    		KoLmafia.statDay = HolidayDatabase.currentStatDay();
    	}
    Which looks pretty useless, to me.

    Maybe the command used to do something useful.

  6. #6
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,730

    Default

    https://wiki.kolmafia.us/index.php?title=Holiday and https://wiki.kolmafia.us/index.php?title=CLI_Reference

    If run on July 4 I would expect it to return a non-empty string in the event that the wiki is up to date.

    I did notice that RuntimeLibrary defines a holiday command which does just that. But KoLmafiCLI defines a command "holiday" which is actually SetHolidayCommand noted above. If I am following this, it means that the ash command holiday() returns a string indicating which holiday, if appropriate, but the cli command just sets some character data.

    SetHolidayCommand().register( "holiday" ); traces back to hola in 2009.whereas the ash command seems o be veracity in 2015.

    At the very least the wiki is wrong. I'm guessing the cli holiday is meant to take a parameter and override some character values and is intended for the case where a holiday happens but mafia's prediction was wrong.

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

    Default

    Revision 20233
    Originally Posted by Veracity View Post
    thank you for the fix
    ttpack = a collection of scripts by taltamir

  8. #8
    Junior Member benrayburn's Avatar
    Join Date
    Jul 2020
    Location
    Seattle
    Posts
    1

    Default

    Thanks for the fix as well!
    They call me the Korean gamble!

Posting Permissions

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