Feature - Implemented semirareLocation doesn't clear on ascension

zarqon

Well-known member
The semirareLocation preference should be cleared on ascension, since you can get consecutive semirares from the same location if you ascend in between.

Perhaps the setting was intended to merely record your last location, in which case it's working as intended, but I suspect the reason for recording the location is to avoid consecutive visits that squander a semirare opportunity. I know that's the only reason I've seen that property being checked. Clearing it on ascension would help it serve that purpose better.
 
The semirare suggestion thing in the character pane seems to appropriately understand when you haven't had a semirare yet in the ascension; is it using some other variable?
 

Veracity

Developer
Staff member
Code:
	public static final String lastSemirareMessage()
	{
		KoLCharacter.ensureUpdatedAscensionCounters();

		int turns = Preferences.getInteger( "semirareCounter" );
		if ( turns == 0 )
		{
			return "No semirare found yet this run.";
		}

		int current = KoLCharacter.getCurrentRun();
		String location = Preferences.getString( "semirareLocation" );
		String loc = location.equals( "" ) ? "" : ( " in " + location );
		return "Last semirare found " + ( current - turns ) + " turns ago (on turn " + turns + ")" + loc;
	}
and

Code:
	public static final void ensureUpdatedAscensionCounters()
	{
		int lastAscension = Preferences.getInteger( "lastSemirareReset" );
		if ( lastAscension < KoLCharacter.getAscensions() )
		{
			Preferences.setInteger( "lastSemirareReset", KoLCharacter.getAscensions() );
			Preferences.setInteger( "semirareCounter", 0 );
			Preferences.setInteger( "beeCounter", 0 );
		}
	}
semirareCounter tells you the turn this run when you last got a semiRare. If you ascend, it is set to 0, which says that you have not seen one this run yet.

lastSemirareReset is the ascension count when we last set that.

As you can see, KoLmafia itself does not look at semirareLocation unless you have actually seen a semirare this run.

And as you also can see, scripts can do the same thing by only looking at semirareLocation is semirareCounter > 0.

As you point out, scripts can obviate that check were KoLmafia to simply set semirareLocation to "" upon ascension.
 

Bale

Minion
I find it hard to endorse when semirareCounter is so easy to check.

The most I can say about this feature is that it would keep scripters from getting confused about how semirareLocation works. That does have value.
 
Would it be as simple as adding a line to that second bit of code Veracity posted, setting semirareLocation to null or similar, or am I underestimating what goes into that variable?
 

zarqon

Well-known member
Thanks Veracity for your as-always clear response. So the property is working as intended. Changing the property as suggested, however, would have multiple positive results and no negatives. I find it hard to see how it would be hard to endorse.

That said, as there is a workaround which I, a novice scripter new to mafia scripting, was not aware of, this feature request is a fairly trivial improvement.

* Note: above sarcasm was not directed at anyone, but was rather playfully pointing out that the change could also remove confusion for other scripters at least as inexperienced as myself.
 
Top