Results 1 to 10 of 10

Thread: sewer.ash - Navigating the Sewers

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    7

    Default sewer.ash - Navigating the Sewers

    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.

    sewers.ash
    Last edited by Baden; 03-05-2018 at 03:33 PM.

  2. #2
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    366

    Default

    Not to burst your bubble, but this script has been done before... Here is the link

  3. #3
    Junior Member
    Join Date
    Feb 2018
    Posts
    7

    Default

    Not to burst your bubble, but this script has been done before... Here is the link
    Originally Posted by Pazleysox View Post
    Yeah, I saw that script when I first started. I still wanted to write my own though as a precursor to a complete hobopolis script. I was hoping the community could point out things I could change/do better.

  4. #4
    Senior Member
    Join Date
    Feb 2010
    Posts
    974

    Default

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

  5. #5
    Junior Member
    Join Date
    Feb 2018
    Posts
    7

    Default

    I've used the earlier script several times but it, frequently, required manual intervention as the character ended up stuck in a cage.
    Originally Posted by Magus_Prime View Post
    For this script, simply change the "gnawBars" variable to "true" to automatically escape when trapped.
    Last edited by Baden; 02-28-2018 at 11:50 PM.

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

    Default

    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.
    You just vehemently agreed with me
    Originally Posted by Veracity View Post
    I agree with frono.
    Originally Posted by Veracity View Post

  7. #7

    Default

    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.
    Originally Posted by fronobulax View Post
    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.

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

    Default

    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.
    Originally Posted by lostcalpolydude View Post
    For this script, simply set __boolean_gnaw_bars = true to automatically escape when trapped.
    Originally Posted by Baden View Post
    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.
    You just vehemently agreed with me
    Originally Posted by Veracity View Post
    I agree with frono.
    Originally Posted by Veracity View Post

  9. #9
    Junior Member
    Join Date
    Feb 2018
    Posts
    7

    Default

    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.

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

    Default

    I didn't want to spam the user with a bunch of properties
    Originally Posted by Baden View Post
    I'm not sure exactly what you mean, but if you are saying you don't want your properties to overwhelm a settings file, then you might consider vprops.

    https://kolmafia.us/showthread.php?21...ghlight=vprops

    It only stores properties that are different from the default and it supports different values for different characters, something just editing the script doesn't support.
    You just vehemently agreed with me
    Originally Posted by Veracity View Post
    I agree with frono.
    Originally Posted by Veracity View Post

Posting Permissions

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