sewer.ash - Navigating the Sewers

Baden

Member
Hello everyone. I have written a short script that will get you through the sewers in a few turns as reasonably possible. Before anyone says it, I am aware that for most people, all this entails is using Clara's bell. However, I eventually want to write a script to automate solo Hobopolis runs as a learning exercise and this seemed like a good place to start.

The script doesn't take any arguments, so simply call it. It will use your current CCS and familiar, but you can specify your outfit as well as a few other parameters at the top of the script.

Code:
string sewersOutfit		// can be used to specify a specific outfit for adventuring in the Sewers

boolean assumeBellRung		// assumes that you have a bell charge available if Clara's bell has already been rung for the day
boolean ignoreSewerItems	// does not attempt to purchase the necessary items for the sewer item tests
boolean gnawBars		// uses 10 advs to escape when trapped in a C.H.U.M cage
boolean openGrates		// opens grates in the Sewer whenever possible
boolean rescueClannie		// interacts with the C.H.U.M cage (possibly freeing a clan member) once when possible
boolean turnValves		// turns valves in the Sewer whenever possible

This script will work for you even if you don't have Clara's bell or a hobo code binder, although it will take more adventures. Again, I am publishing this script as a learning exercise, so please leave me feedback or constructive criticism.

View attachment sewers.ash
 
Last edited:

Magus_Prime

Well-known member
I've used the earlier script several times but it, frequently, required manual intervention as the character ended up stuck in a cage.
 

Baden

Member
I've used the earlier script several times but it, frequently, required manual intervention as the character ended up stuck in a cage.

For this script, simply change the "gnawBars" variable to "true" to automatically escape when trapped.
 
Last edited:

fronobulax

Developer
Staff member
Since you are looking for feedback, you might think about property names. I've been using mafia for over a decade and every so often I choose to clean out my settings file, specifically removing settings for scripts I no longer use and confirming I still like the settings for the ones I do. I am a big fan of property names that somehow identify the script that is creating them. Using double underscores at the beginning doesn't enhance human readability. Since the single underscore is the KoLmafia standard for a preference that resets at rollover, I'd rather not see leading underscores used unless these are supposed to reset, in which case you probably don't want the user to set them. I understand wanting to include the data type in the name but unless the gCLI command "set __boolean_gnaw_bars = 999" actually generates an error, a user friendly script is still going to have to check that the value makes sense as a boolean. So the only real benefit to including the type in the name is for you, the coder and not necessarily for me the user. So I would prefer something like sewer.gnaw_bars.

Just my opinion.
 

lostcalpolydude

Developer
Staff member
Since you are looking for feedback, you might think about property names. I've been using mafia for over a decade and every so often I choose to clean out my settings file, specifically removing settings for scripts I no longer use and confirming I still like the settings for the ones I do. I am a big fan of property names that somehow identify the script that is creating them. Using double underscores at the beginning doesn't enhance human readability. Since the single underscore is the KoLmafia standard for a preference that resets at rollover, I'd rather not see leading underscores used unless these are supposed to reset, in which case you probably don't want the user to set them. I understand wanting to include the data type in the name but unless the gCLI command "set __boolean_gnaw_bars = 999" actually generates an error, a user friendly script is still going to have to check that the value makes sense as a boolean. So the only real benefit to including the type in the name is for you, the coder and not necessarily for me the user. So I would prefer something like sewer.gnaw_bars.

Just my opinion.

That feedback doesn't quite apply, since the script doesn't use KoLmafia settings at all. Baden should have actually said to edit that value at the top of the script, in the post above yours.

It's an interesting variable name, but the user doesn't have to care about it so it doesn't really matter.
 

fronobulax

Developer
Staff member
That feedback doesn't quite apply, since the script doesn't use KoLmafia settings at all. Baden should have actually said to edit that value at the top of the script, in the post above yours.

It's an interesting variable name, but the user doesn't have to care about it so it doesn't really matter.

For this script, simply set __boolean_gnaw_bars = true to automatically escape when trapped.

I assumed it was using KoL properties since that is what set does in the gCLI, right? I also saw set_ and get_ property in the script although on closer inspection the uses seem to be for pre-existing properties.

So maybe I should replace my comments about naming with the general suggestion that having the user edit the script to set something is not the best way to do things, especially in a SVN environment where editing the scripts copy instead of the local SVN runs the risk of losing the user edits.
 

Baden

Member
Lostcalpolydude is correct; the script does not use mafia properties but rather values that the user can change at the top of the script. I chose this method over mafia properties as I didn't want to spam the user with a bunch of properties, although I can definitely see the benefits. As for the naming convention, I agree that the names are rather unnecessarily complex. I originally chose the convention that I did because I saw it in another script a while back and I'm not sure why I thought that it was a good idea at the time.
 

fronobulax

Developer
Staff member
Just wanted to say thanks for the script! There was definitely a few sewers.ash scripts floating around - this was the only one functioning and easy to configure.
 
Top