holatuwol begins scripting

Status
Not open for further replies.

vorpallemur

New member
[quote author=holatuwol link=topic=752.msg3624#msg3624 date=1170886907]


Scripts that attempt to avoid "waste".




Odd, I thought the only flag on the 31337 scroll was level (ie: you have to be level 9). You mean you have to actually bridge the chasm?

[/quote]

Yes, otherwise it tells you "You have no idea what this thing does", or something like that. Same with the 64735 scroll.
 
[quote author=vorpallemur link=topic=752.msg3700#msg3700 date=1171344830]
Yes, otherwise it tells you "You have no idea what this thing does", or something like that. Same with the 64735 scroll.
[/quote]

I was waiting till I could verify this before replying (I'm hardcore oxy at the moment). I was thinking that the minimum requirement was to have gotten the abridged dictionary drop. The purpose for going ahead and bridging the chasm is so that I could get a definite true for whether or not it is possible to use one to prevent an infinite loop of trying to use them while not getting the trinkets.
 

holatuwol

Developer
[quote author=efilnikufecin link=topic=752.msg3621#msg3621 date=1170879526]
OK Maybe convert this to a bug report? I see what the name of the function implies, but what I am actually getting is only the comings and goings of the clan, and nothing about the stash activity. See the attached files.
[/quote]

This is now fixed.
 

Metraxis

Member
OK. Here's another one for you,the Assault on Spookyaven :)

Scenario: Begin with a Library Key (therefore pool cue, therefore manor floor 1 unlocked) in inventory. You have 2 goals, though which comes first will have to depend on the roll of the dice. If the Rise of Spookyraven hits first, you want to lower the stairs and hit the Bathroom for a towel. If the Fall of Spookyraven hits first, you want to head over to the conservatory and grab the Gallery key. In either case, then go back and do the other, hopefully while ignoring the book you've looked in already.
 

holatuwol

Developer
I have never, ever gone after the towel except on my level 30 trophy runs. o_0 But, sure, why not?
 

Attachments

  • spookyraven.ash
    2 KB · Views: 117

Metraxis

Member
The towel is worth selling in ye olde mall most times, and serves as a convenient stand-in for more complex Floor 2 goals. My particular difficulty was in differentiating between the effects of Rise and Fall, as neither affects inventory.
 

holatuwol

Developer
The second floor of Spookyraven is particularly weird because of the ballroom unlock mechanism, but that sounds complicated and hence wouldn't have counted for this thread.

Since we're already talking about Spookyraven, though, I've implemented something for v10.7 to handle the ballroom unlock -- when that finally gets released, just add a ballroom key to your conditions and KoLmafia will automatically toggle the choice adventures to unlock it.
 

Metraxis

Member
Here's one I'd been handling with a cli script, but changes made a few weeks ago potentially break my solution, though I didn't realize it until said breakage bit me today. I'm curious to see if your revamped solution differs from mine.

Scenario: You are Level 11, Hardcore, and have at least 20,000 Meat on hand.

Objective: Reliably obtain a dead mimic.
 

holatuwol

Developer
I don't think it's been possible to script the Oracle since the addition of choice adventures to low level areas.

Edit: Well, okay, maybe that's wrong.  You could theoretically just use a plus sign repeatedly after every choice adventure.

Edit 2: Okay, I've gone ahead and made the oracle an auto-stop situation. For what it's worth, I don't plan on giving players the ability to customize auto-stops, since even though ascension itself is pretty scriptable, I think giving you the ability to automate fresh content really defeats the point of letting players script things.
 

Metraxis

Member
Fantastic. Your first edit covered my solution (wait for choice, use plus sign, peek at questlog to see if it worked), but the autostop will help.
 

holatuwol

Developer
Ooh, right, you also wanted to see what it looked like.  Here you go. :)
 

Attachments

  • findzapper.ash
    2 KB · Views: 75

Metraxis

Member
If there is an executive decision not to make this possible, fine, but here's one that's given me trouble since I abandoned my teetotaling ways.

Scenario: Level 4+, Advanced Cocktailcrafting.

Objective: Get the four bottles of booze from the second metarow of the Barrel Full of Barrels.
 

holatuwol

Developer
This script introduces the "extract_items" method that's been around since probably KoLmafia 8.x, but isn't used much by anyone because almost no script needs to handle items directly. Other than that detail (which anyone could write their own parser for, since you're only looking for exactly one item drop), I think it's fairly straightforward.
 

Attachments

  • barrels.ash
    2.9 KB · Views: 105
I wanted to say thank you very much for ASH. It's pretty awesome. I'm still smarting from the effects of rev 3883 but I've filed the appropriate bugs in the tracker about it. :)

Here's what I've been working on. I'm going to present it as pure concept for now, so you can take it as a challenge if you would like to try your hand at it.

Concept: The ultimate fight consult script.
Summary: Upon entering combat, the script considers all possible courses of action and picks the optimum one. ;D
Details: The goal is to win the battle with minimal resource loss. Since it's a fight consult script, it has to play the cards as they are dealt and can't change the player's equipment or cast buffs. It should take into account all available skills, active effects, and equipment bonuses. For example, a monster might be killed by a chain of Entangling Noodles, Stream of Sauce, Stream of Sauce (9MP) or just one Lunging Thrust-Smack (8MP). The LTS may be more efficient normally. But if you're operating under Dreams and Lights, the calculation changes ... it's now 3MP vs 5MP, and the spells become the most efficient way to kill the monster.
Suggested Implementation: Don't hard-code just a few strategies. Really consider all the possible courses of action! Create functions which determine the minimum amount of damage that can be inflicted by each action. (Be pessimistic; it's better to underestimate than overestimate and lose.) You'll probably need a simulator which exercises each course of action to see (a) whether it works, and (b) what its cost is. Cost is probably best represented as meat ... every strategy can be boiled down to its total cost in HP/MP, and a HP/MP cost can be converted down to a meat cost if you know the player's access to restorers. Obviously the search space of all possible strategies is, uh, rather large. So you'll need to come up with clever ways to prune it so that the script runs in about half a second or less.
Bonus Points: If your script can steal, delevel, handle monster level variance, consider Disco Combos, and deal with Cunctatitis/fumble/block. Double bonus if it does a good job with the Bonerdagon. Triple bonus for the Naughty Sorceress. ;-)

It's ambitious, but ... it's definitely possible. I did it and I've been using it for about a week. On my 2GHz laptop it runs in much less than half a second, even with my 40+ ascension character who has a ton of skills to consider.

I'll post my script soon. I'm still tweaking it to be better at melee actions: it tends to underestimate damage too much right now. Besides, it's an interesting challenge and I'm curious to see other people's approaches to the same problem. ;D

My script doesn't do stasis yet -- I considered adding it, but with NS13 looming I figured I'd wait to see what changes are made before wasting a bunch of time. I also don't handle item use, and I tried but disabled in-combat healing. (It's rarely useful and expands the search space exponentially.) My version also decides on its course of action before combat and doesn't change strategy after that. Spells are easy to predict accurately, but melee actions still need work -- my script is too pessimistic most of the time. So my next task is that I'm going to explore dynamically adjusting the strategy based on actual damage dealt.
 

holatuwol

Developer
[quote author=Harry Crimboween link=topic=752.msg4770#msg4770 date=1181417445]
It's ambitious, but ... it's definitely possible.
[/quote]

This thread is for scripts which appear to be impossible. Or more correctly, those that appear to be possible once you understand the scripting language in spite of its limitations, but when you actually go and start coding it, you find unwieldy roadblocks which really shouldn't be there.

So, the purpose of your proposal is so that when I start coding, I think the same thing (hey, that sounds pretty easy...) but quickly run into the problem you ran into.
 
Okay. Sorry, I guess I didn't make it clear enough that there were indeed ASH difficulties that need to be worked around to create such a script. I could list the things that ASH makes difficult if you like, so that you don't have to find them the hard way.


  • [li]Monsters that scale to the player's level are not handled by ASH. (Feast of Boris, Baron von Ratsworth) The Boris monsters don't even convert to monsters because they lack an entry in monsters.txt. [/li]
    [li]Baron von Ratsworth has been shown to include the player's number of ascensions as part of his monster level. That probably could be cached by KoLmafia but isn't right now afaik. You might be able to pass it in via a property set by another script, but a standalone fight consult script can't know.[/li]
    [li]The second parameter to fight consult scripts (the encounter) is not quite specific enough. e.g. you get the value straight from the page: "knight", "ninja snowman", etc. while KoLmafia's monster data uses the more-specific "Knight (Snake)" or "Ninja Snowman (Ricebowl)". Converting "knight" to a monster doesn't work was fixed today in 3892. [/li]
    [li]A handful of monsters have incorrect elements listed in monsters.txt. I filed a bug on the grave rober, and I think I remember seeing that the zombie waltzers are also incorrect but I'm waiting til I can confirm it before filing another. This isn't so much an ASH limitation as it is a simple monsters.txt bug. It does make it hard to pick the correct strategy though.[/li]
    [li]To achieve the speed I needed, I had to cache a lot of function results (like player damage) in maps so that it only did the expensive calculation once for each set of input parameters. If ASH had the concept of a "const" attribute on functions, it could do that caching automatically. Perhaps that's asking too much. :)[/li]

In general I solved most of the monster problems by passing monsters around as strings and not monster types and having override maps to fix what KoLmafia got wrong. It also meant that I pretty much couldn't use monster_hp(), will_usually_dodge(), or any other function that required a FightRequest, since those would generally return 0 for the problem monsters listed above. So I had to use monster_base_hp(monster) and so forth.

And, uh, I suppose this might be a silly question but ... where would one post a fight consult script here, anyway? I see a Between-Battle forum, but not a Battle forum.
Oh, and one more. It turns out that player hit percentage depends partly on whether you're in the Vole sign or not. There wasn't any way to determine that ... I could test in_muscle_sign(), but couldn't get the specific zodiac.
 

Veracity

Developer
Staff member
[quote author=Harry Crimboween link=topic=752.msg4789#msg4789 date=1181522498]
A handful of monsters have incorrect elements listed in monsters.txt. I filed a bug on the grave rober, and I think I remember seeing that the zombie waltzers are also incorrect but I'm waiting til I can confirm it before filing another. This isn't so much an ASH limitation as it is a simple monsters.txt bug. It does make it hard to pick the correct strategy though.[/quote]

monsters.txt data generally comes right from Kittiwake's monster survival guide, although I don't make an effort to keep up with CHANGES there; I go there when a new monster is added but don't usually notice later edits.

I just checked and the current version of Kittiwake's guide says that the grave rober is "spooky".

Have you informed Kittiwake of your discovery that it is not?
 

holatuwol

Developer
The other requirement mentioned in the first post is that it has to sound really easy. A good rule of thumb is that it has to sound like it'd take maybe 10-15 minutes to write. Anything beyond that, and you need to recognize that I'm not particularly interested in spending my time writing a script which I won't use -- and believe me, I wouldn't use it, because I like making suboptimal decisions by hand. I find it amusing.

To answer your question about ratsworth and scaling monsters, you CAN have the combat settings that have [ratsworth] or [crimbo elf] sections which call a separate script designed to handle scaling monsters. Or, as you've probably already noticed, you can just pass strings around and check against them -- I did this once when I toyed with the idea of a script which handles the naughty sorceress, and I don't find it kludgey (your mileage may vary).

For caching results, while consult scripts look like they're designed to treat each round independently, they don't have to -- you can script a battle from beginning to end from within one consult call. I did it before when I wrote the barrels farming script Metraxis couldn't figure out, and there's nothing in KoLmafia which stops you from doing so. So, you can actually have a script which does all the expensive calculations once per battle.

To answer your question about where you should post, writings in progress is where the current battle scripts are posted, like illarion's neostasis script.
 
[quote author=Veracity link=topic=752.msg4790#msg4790 date=1181526724]
monsters.txt data generally comes right from Kittiwake's monster survival guide, although I don't make an effort to keep up with CHANGES there; I go there when a new monster is added but don't usually notice later edits.

I just checked and the current version of Kittiwake's guide says that the grave rober is "spooky".

Have you informed Kittiwake of your discovery that it is not?
[/quote]

Nope, but I'll do that.
 
Status
Not open for further replies.
Top