stannius' semi-automatic spaaace script

stannius

Member
stannius_spaaace 1.2
stannius' semi-automatic spaaace script 1.2

A script to complete the "Repair_the_Elves'_Shield_Generator" quest for "Slyz's KoLMafia Scripting contest".

Prerequisite: zlib.

Please report bugs here so I can fix them, thus making the world a better place. CLI output would be helpful. I am also open to feedback.

What it Does:
* Completes the Repair the Elves' Shield Generator Quest
* Burns adventures.
* Changes your equiment and effects.
* Uses items (see SETTINGS). Buys transponders (if needed, and mall is accessible and allowed by mafia settings) and cheap wind-up clocks.
* Changes familiars (unless the zlib var is_100_run is set)

What it Does Not/What you Should Do:
* See USER SETTINGS below
* It is up to you to create a custom combat script that will handle scaling monsters, preferably without taking damage. Might I suggest entangling noodles + an auto-hit skill (spell, shieldbutt, etc). Also, olfact "survivor" if you have olfaction.
* Leave an AT song slot free. (And keep in mind that the script changes equipment, so don't count on having four songs)
* Have in inventory: transponders, deodorant/pine needles, yellow candy hearts, and cheap wind-up clocks.

USER SETTINGS

spaaace_useitems (defaults to true) Use some items giving helpful effects (see "Have in inventory:" above).
spaaace_escortmanually (defaults to false) Set to true if you want to handle the "Escort Axel Otto around the moons" part of the quest yourself. It is the trickiest part.


Changelog (more detail given in individual version++ posts)
0.1 Initial version
0.2 Fix problems with the hamburglaris/porko code (I didn't get to test it the first time through.)
0.3 Fix off-by one error in Porko playing code. Add automatic version checking.
0.4 Fix abort when escorting Axel Otto. Attempt to deliberately shrug the buffs cast by the script (so as to not randomly shrug user's buffs.)
0.5 Allow restart after loss of spooky little girl. Abort Porko if the probability isn't 1.0, just in case.
0.6 Get the right porko probs by hitting choice.php an extra time. Keep track of Axel's courage level and warn user if it goes down too fast.
0.7 Add familiar switching. Add user preferences. Abort if Beaten Up.
0.8 Transpondentify when using maps from inventory.
1.0 Rename script to "spaaace.ash". Remove On the Trail when switching zones. Support farming of distention/dog hair pills.
1.1 Incorporate some code from slyz to make shieldbutt-substitution method more robust.
1.2 Used sk1ll instead of skill, which is now a reserved keyword.
 

Attachments

  • spaaace.ash
    38.6 KB · Views: 475
Last edited:

Theraze

Active member
Two suggestions. One, don't put attachments inline, it makes it harder to evaluate, especially if you keep different versions. Second, once there's a new version, changelogs are awesome. :)
 

stannius

Member
Two suggestions. One, don't put attachments inline, it makes it harder to evaluate, especially if you keep different versions. Second, once there's a new version, changelogs are awesome. :)

My existing version is obviously perfect and shall never change. However, on the off chance that it does, I have changed the attachment method, and I will be sure to include a changelog for 0.2 :)
 

Theraze

Active member
Standard note regarding Spooky Little Girl and 2 handed weapons... To be more specific, if your best weapon for "DA, DR, -moxie, +equip spooky little girl" involves 2 hands, your maximize/equip will fail, and the rest of the script will fail to continue running properly...

Your script will keep trying to run forever if you run out of adventures on certain steps, since your main loop is just while (true) and not all adventure/visit_urls involve another check to validate you have enough/any adventures. It's possible that the abort at the end of the PerformStep will avoid this though.
 
Last edited:

stannius

Member
Standard note regarding Spooky Little Girl and 2 handed weapons... To be more specific, if your best weapon for "DA, DR, -moxie, +equip spooky little girl" involves 2 hands, your maximize/equip will fail, and the rest of the script will fail to continue running properly...

Is there a way to force 1-handed weapons? This seems arguably a mafia bug... I remember a discussion about it somewhere, but I looked in the "Bug Reports" forum and didn't see anything...

I have ascended so I can't re-test too thoroughly, but
Code:
maximize +shield -melee
seems to work without error.

I'll add a "1 hand, " in there. Also I noticed that muscle classes will try to equip a shield in the same equipment slot, which probably won't work too well.
 
Last edited:

Theraze

Active member
Yes... I'd have pointed out the specifics, but that's part of the fun of doing it yourself. :D Seems you did find it though, so that should help avoid problems. And yes, maybe avoid trying to set both a shield and offhand. That should help decrease frustration.

Specifically, the "1 hand" means only 1 handed weapons... you can force it to moxie weapons instead if you prefer, but what exactly it equips depends completely on what equipment is available to you and what you've prioritized and requested. If you don't have handed-ness explicitly stated, that's your fault, not mafia's. :)
 

Veracity

Developer
Staff member
This seems arguably a mafia bug.
I love it when people say that, since, when you look at the particular "bug" closely, it is almost always a user misunderstanding, not a "mafia bug". Not always, certainly, but way more often than not.
 

stannius

Member
I love it when people say that, since, when you look at the particular "bug" closely, it is almost always a user misunderstanding, not a "mafia bug". Not always, certainly, but way more often than not.

Well, I did say "arguably." Though I'm not interested in being on the opposite side of an argument from you. :)

I would edit the word "bug" out of my post, if it weren't for the fact that doing so would make it look like you quoted something I didn't say...
 
Last edited:

stannius

Member
I have uploaded version 0.2. This version is more likely to work correctly. Especially given that v0.1 has a 100% chance of not working correctly - it had an infinite loop in it, in a part of the script I wasn't able to test the first time through. (once-an-ascension scripts can be a little tricky...)

The new version includes the no-shield-collision and 1-hand equipment maximization as discussed above.
 

stannius

Member
Someone ran my script! Awesome!

(Unfortunately they ran v0.1, which doesn't work... how do I add automatic version checking?)
 
So, I knew that the version checking stuff was part of zlib, and I knew that Bale's newLife.ash script used it. So I copied the line from Bale's script...
Code:
check_version("newLife", "Bale_newLife", "1.72", 2769);
Ok, four parameters... so in zlib i found the check_version() function and see
Code:
string check_version(string soft, string prop, string thisver, int thread)
Now I know what those parameters are. btw, your thread number for this thread is 6969.
Now, I'm not sure what the difference between soft and prop are. Looking more into the zlib function, it looks like the current version is saved in a property named "_version_"+prop.
Also, I know it's scraping something from the forum thread's main post.. so I found the matcher
Code:
matcher find_ver = create_matcher("<b>"+soft+" (.+?)</b>",page);
And snap, that's what it's looking for in the forums... so I pop over to the newLife thread and I see right at the top newLife 1.73 (which means mine need updating ;) ) So that's where you update the version in the first post every time you post a revision.

So, in your first post add a line
Code:
[PLAIN][b]spaaace 0.2[/b][/PLAIN]
. Then in your script, after importing zlib, add
Code:
check_version("spaaace","spaaace","0.2",6969);

Should work!
 
Last edited by a moderator:

Bale

Minion
I presumptuously edited Weatherboy's post to remove a rather subtle error. In case anyone had already read that post, you'll see that now he suggests that the first post should contain [b]spaaace 0.2[/b].

Weatherboy was almost right, but confused about the difference between bbcode and html. Since html does not work in a forum post, using it will not produce the result he expected.
 
Last edited:

stannius

Member
Thanks guys!

The good news is, while adding this to my script, I noticed this
Code:
script "stannius_spaaace_0.1.ash";
... so it seems that my (now 2!) customers were probably running the latest version after all.

My ultimate goal is to be the go-to spaaace script. How long do I have to wait before I incorporate the good ideas from others' scripts?
 

Winterbay

Active member
In this case you should probably wait to post a version incorporating work from others until after the competition has been settled...
 

Winterbay

Active member
Ran v0.2 (started just before you uploaded version 0.3) and it went fine and it said it was finding the generator to activate it with the EMU unit when I had to go on vacation for a few days so had to abort. When I got back the quest log said that I needed to find the generator and fix it while my inventory only had two parts of the EMU unit and no unit. This understandably made the script confused and it aborted.
Having done the parts to get the last two parts, the spooky girl and the escort mission manually the script finished off just fine.

No idea what happened to let the quest log move forward faster than the quest though...
 

stannius

Member
Ran v0.2 (started just before you uploaded version 0.3) and it went fine and it said it was finding the generator to activate it with the EMU unit when I had to go on vacation for a few days so had to abort. When I got back the quest log said that I needed to find the generator and fix it while my inventory only had two parts of the EMU unit and no unit. This understandably made the script confused and it aborted.
Having done the parts to get the last two parts, the spooky girl and the escort mission manually the script finished off just fine.

No idea what happened to let the quest log move forward faster than the quest though...

Hmm, interesting. When I finish my current run I'll remove the loop and check the quest log between each step. Thanks for the feedback!
 

Winterbay

Active member
Apparently when you lose the game of Porko to activate the shield you lose yoru Unit and regain two of its parts. I'm going to guess that this was what happened. A a recent bug report states that if you do this mafia doesn't recognise that you lost it and the scritp will thus keep on running with no possibility of redemption, checking the quest log in this case will be moot since that will be on the latest stage due to you having reached that point at least once.
It might thus be a better idea to check for the parts of the unit (and the unit) rather than relying on the quest log.
 
Top