Feature - Implemented If clicking refresh in Fernswarthy's Basement, set that to your next adventure

Fluxxdog

Active member
The next location feature recently added is great. One thing I noticed, however, was if you click on mafia's refresh button, mafia still think you're in your last location. It would make sense to set it to the basement if, you know, you're in the basement ^^ This can be important since refreshing fires aAS's.
 

Veracity

Developer
Staff member
I have absolutely no idea what you are reporting.

- I went to Fernswarthy's Basement in the Relay Browser.
- I fought the monster

- After running the turn, KoLmafia ran my afterAdventureScript
- Both lastAdventure and nextAdventure are set to "Fernswarthy's Basement"
- The Adventure Selector in the GUI is set to Fernswarthy's Basement.

- I clicked the refresh button on the green sidepane in the GUI. It called api.php
- Unsurprisingly (since that does not run an adventure), it did not run my afterAdventureScript.
- Unsurprisingly (since it was not about to adventure), it did not run my betweenBattleScript, either.
- Both lastAdventure and nextAdventure are still set to Fernswarthy's Basement
- The Adventure Selector in the GUI is still set to Fernswarthy's Basement

- I clicked the refresh link in the charpane in the Relay Browser. in the GUI. It called charpane.php
- Unsurprisingly (since that does not run an adventure), it did not run my afterAdventureScript
- Unsurprisingly (since it was not about to adventure), it did not run my betweenBattleScript, either.
- Both lastAdventure and nextAdventure are still set to Fernswarthy's Basement
- The Adventure Selector in the GUI is still set to Fernswarthy's Basement

Can you give a precise step by step description of what you are doing, what you are seeing, and what you think is wrong? I honestly have no idea what you are reporting.
 

Veracity

Developer
Staff member
OK, I found the "refresh" button you were referring to. It is the stationary button at the top of the center frame, not one of the other "refresh" buttons that I had tried. I clicked on that and it submitted a call to basement.php. that did, in fact, run the after adventure and before adventure scripts, as well as doing recovery. It also set nextAdventure to Fernswarthy's Basement. The only thing it did NOT do was to set the adventuring location in the GUI to Fernswarthy's Basement.

Which is to say, your betweenBattleScript would have had Fernswarthy's basement in nextAdventure, just as you expected.

But, I suppose updating the GUI location is a good idea. Try revision 13382.
 

Fluxxdog

Active member
Found the hangup. An aAS would use lastAdventure to fire properly (you wanna clean up where you've been, not where you're going). Since clicking the refresh button (and I apologize for not doing a better bug report to say which one) fires the bBS and aAS in that order, the aAS would appropriately use lastAdventure, and since there's no update since I hadn't actually adventured in the Basement yet, my aAS processed on another location instead of the basement.

This leaves my considering several things:
1) Change my aAS so if the base is the next location, handle it like it was the last location
2) Have mafia update lastLocation if the refresh button is clicked

1 is definitely the easiest option, but it feels like a workaround. Is it the intent of the aAS to fire after clicking that refresh since there was no actual adventure?
 

Veracity

Developer
Staff member
I guess the issue is "why is basement.php (the URL submitted when you click refresh) considered to be an 'adventure'?". That URL will show you what is on the current basement level, but it is "basement.php?action=XXX" which actually runs an adventure: starts a fight or takes a stat reward.

It is fine that "basement.php" will set nextAdventure, but it seems that the betweenBattleScript should be run before you do "basement.php?action=X" - and the afterAdventureScript should be run after you execute such a URL.

I'll look into having it behave that way.
 

Veracity

Developer
Staff member
OK, it was already coded to not run before adventure scripts for raw "basement.php" - but the conditional was backwards. Who knew?

Revision 13386, which also makes it not run after adventure scripts for raw "basement.php".
 
Top