Automatically record profitable songs

adeyke

Member
RecordSongs.ash: Automatically record profitable songs

Here's my first full script. I wasn't sure which forum it would best fit under, so if this is wrong, just move it.

After an Accordion Thief has completed the Nemesis quest, they have the opportunity to record limited-cast songs as items. The purpose of this script is to automate this process. It first changes your gear and restores MP. Then it goes to that special page and checks what songs you have available for casting. For each of these, it calculates if it's actually worthwhile to record it. If yes, it records as many as possible, leaving and returning if necessary.

Some notes:
1. You have to be an AT who finished the Nemesis quest to use the script. It determines this by checking if you have The Trickster's Trikitixa.
2. It uses the UR's _meatpermp if available but otherwise assumes you have MMJ access for purposes of the cost calculations
3. It prompts you about actually automating the process. If you say no, it'll just calculate the profitability of your available songs but won't actually record anything.
4. It tries to get both effects that reduce MP costs and those that increase max MP, strongly weighted by the MP costs. I do this with "maximize -1000 mana cost, 1 mp". I actually have no idea how the maximize command really works, so this is mostly a guess. A correction here would be most welcome.
5. It aborts if you try the automation but have no adventures left or are drunk. You can still see the summary, though.
6. It aborts if you don't have 100 MP. That's what's needed to ensure all songs are recordable.
7. If you haven't yet explored the fireplace, it'll use an adventure to get the normal adventure there. Then it'll proceed as normal.
8. It turns out I don't actually need variables for how many of the daily casts have already been used, since that information is all on the recording page. The used-up songs will be listed in the summary for non-automation, though.

Any feedback, advice, or testing is appreciated. As I said, this is my first full script, so I might be doing it all wrong.
 

Attachments

  • RecordSongs..ash
    4.2 KB · Views: 250
Last edited:

Bale

Minion
Nice! I was thinking of making a script like this. Now you've gone and done it for me! You've even gone so far as to compare the cost of MP restoration to the mall price of the song! Wonderful!
 

adeyke

Member
Nice! I was thinking of making a script like this. Now you've gone and done it for me! You've even gone so far as to compare the cost of MP restoration to the mall price of the song! Wonderful!

Thanks for the kind words.

It turns out my script had a significant bug in it. I've fixed that and reuploaded it.
 

slyz

Developer
I slightly modified it for this request. User can configure how many of each songs he wants recorded.

EDIT: This is not tested (I'm not an AT, and I'm in HC).
 

Attachments

  • RecordSongs_slyz.ash
    4.7 KB · Views: 114

badfeet

New member
Thanks a ton! I've been wanting this script for while. I just used it and ran into a couple of problems. First, it use MMJ to restore MP even though I was at max (2100+ MP). Second, after the second recording, it just got stuck in an infinite loop:

Encounter: Puttin' on the Wax
Encounter: The Island Barracks
Encounter: A Short Hallway
Encounter: Hallway Right
Encounter: Parlour
Encounter: Puttin' on the Wax
Encounter: The Island Barracks
Encounter: A Short Hallway
Encounter: Hallway Right
Encounter: Parlour
Encounter: Puttin' on the Wax
Encounter: The Island Barracks

etc.

Thanks again!
badfeet
 

slyz

Developer
If you are using my version, you need to edit it to remove the skills you don't have at the top of the script. I should have made it fool-proof I guess ^^

Try this version. Instead of deleting the lines with the skills you don't recordings of, you can just set the quantity on the right to 0 at the beginning of the script. It also won't try to record songs you don't know anymore.
 

Attachments

  • RecordSongs_slyz.ash
    4.8 KB · Views: 140
Last edited:

fxer

Member
I modified slyz script above so I could integrate this into a login/logout script for myself. I didn't want user interaction halting the script...and also it used 300 MMJs because it blindly restores your entire MP pool :/

- Added boolean option to disable user prompt for interaction
- Only restore MP necessary to record the max # of casts (from mafia proxy record) for an enabled song
- Make sure we leave the Puttin' on the Wax choice adv at the end of the script
- Move code out of main() to make importing the script easier
- Changed HMTL printing to normal mafia color printing
- Added round() to price estimation printout
 

Attachments

  • RecordSongs.ash
    5.2 KB · Views: 86

fxer

Member
Bale mentioned something about using main@ScriptName() to call main in another script, can't decide if I love it or hate it :)
 

EdFox

Member
A few changes to fix fuzzy matching warnings. Just removed some quotation marks but Mafia is now happy. No other changes have been made.
 

Attachments

  • RecordSongs.ash
    5.2 KB · Views: 53

Theraze

Active member
Why did people love to do $type["Something"] so much in the past? :( Going through some of my old non-maintained scripts and... Ugh.
 

heeheehee

Developer
Staff member
Probably to make text editors happier -- things with apostrophes otherwise just ruin syntax highlighting, if you don't bother with a custom language definition.
 

Theraze

Active member
Here in an updated copy of RecordSongs_slyz that doesn't have the various warnings anymore. One of the 13 scripts that my regexp (\$[a-z]*\[\") found as having the type quotation mark remaining. Well, 14, but Winterbay popped out his version of farm shortly after. :)

Besides "Handyman" Jay Android in BatBrain, and a line I just found commented-out in farm, there are 2 $strings[] which need their quotation marks and one case where instead of using to_item, nemesis is doing $item["+MAP+"] which I think only works because it's in a cli_execute line. :) But hey, it works. And those are the only 6 (BatBrain has 2 HJA lines) cases of $type["something"] left in my script folder. :)
 

Attachments

  • RecordSongs_slyz.ash
    4.8 KB · Views: 83

fronobulax

Developer
Staff member
Why did people love to do $type["Something"] so much in the past? :( Going through some of my old non-maintained scripts and... Ugh.

I seem to recall misunderstanding the nuances and I wrote code that acted as if $type[x] was a function that accepted a string x as input and returned a type. The fact that it often gave me the result I expected meant that I did not learn my error before it became a bad habit.
 

Winterbay

Active member
Interesting comment is that $strings["a", "b"] works but does not match a and b respectively which I discovered when I tried it :)
 
Top