Guide

matt.chugg

Moderator
Another possible idea:

When indicating the best step would be to olfact a monster in that area, put the word olfact in red if the player is already on the trail, I seem to keep forgetting to remove "on the trail" before adventuring in the next location
 
Speaking of olfacting suggestions. For the Bridge part of the Baron's quest, Guide suggest olfaction +items. But I can't figure who I should be olfacting. Afaict, each mob there drops up to 3 planks and 3 fasteners, with the exception of the dude that drops the keepsake box, and you can't olfact him.

I really like this script a lot.
 

Fluxxdog

Active member
Suggests faxes and fancy dogs, but those aren't available during Bad Moon. (Guess what I'm running ^^) A simple change would be changing line 19702 to this:
Code:
	if ($item[Clan VIP Lounge key].available_amount() > 0 && !in_bad_moon())
 

Ezandora

Member
Think I fixed most of the bugs listed in the thread. Let me know if I missed any.

Thinking about this, perhaps some of these could just be an extension of the "Gain xxxx stats" section, along with suggestions to use orange snowcones, whatever color candy heart does that if you have them.
Perhaps there's no harm in a little duplication? In the "gain xxxx stats" box, perhaps add leaflet quest, orange snow cones, bonerdagon chest, mainstat clover adventures (if clovers), ML skills,
Hmm... I think for stuff like ML, the idea is you ask Modifier Maximizer for "exp", and it suggests stuff. It feels as though it will be much more helpful to you - there are a lot of ML sources. Though, "use orange snowcones" should be an in-run reminder, added.

I've found myself wishing for some of the same things. It might not be for everyone but would some way to configure where and how things appear in the Guide panel be something that interests you? I'm thinking of something along the lines of how Bale and CKB have structured CHIT.

The big customization I want to do is Florist Friar plants, but writing an interface for it sounds tricky.

I think it might be a good idea to split the Resources section up, though... maybe make an Item section. There's so many things there now.

Actually I have the first two drops, and enough skeleton keys that I don't have to care about getting the lockpicks. Perhaps it's worth only putting that warning before the first two cubeling drops drop ?
Ya, that's why it's an optional task. It's been asked for before, but I am risk-averse; if you use your own skeleton keys for the daily dungeon, you risk breaking them all before the tower. It feels as though this is an easy mistake to make if you're not paying attention?

And maybe a manageable list of items you can auto sell to get meat, I tend to keep my quest reqards (no tradeable) but auto sell nearly everything else I don't need to maintain meat during runs
I have no idea which of those are good either. It would be unfortunate to suggest autoselling something and then it turns out it saves 0.2 turns on Way of the Sneaky Bugbear path on a Tuesday.

Speaking of olfacting suggestions. For the Bridge part of the Baron's quest, Guide suggest olfaction +items. But I can't figure who I should be olfacting.
Ah, I don't remember. Maybe if you have the loadstone, you should olfact the wood monsters. But that's unclear and complicated... removed the suggestion for now.

When I run Guide, I get the error:
I think it'll be fixed if you upgrade to KoLmafia 16.3 or better? The script is designed to run on the latest point release.
 

Darzil

Developer
If you fax and copy Writing Desks, it seems you can end up in a state where Guide thinks you have to adventure in the kitchen (presumably because you haven't got Billards key), even after questM20Necklace is finished. Perhaps it could also check for that? (If it matters, currently am in a softcore BIG run)
 

Bale

Minion
One thing that blows my mind about this script is the ridiculous amount of attention paid to the little things. I mean inconsequentially tiny details of purely aesthetic value.

For instance, the image next to the words "Fire yellow ray" is a recommendation for your best choice of yellow ray source. If you've got a He-Boulder, then it shows the image of that He-Boulder, but if I'm in type 69 it will choose a different image. For instance, if I have the Nanorhino AND a moxie class combat skill AND the rhino is fully charged, then it will use the Nanorhino image. If I can't use that familiar, but I do have an available pumpkin bomb, or pumpkin, then it will chose one of those for the image.

This amazes me, so I wanted to let Ezandora know that all that bonus work is appreciated.
 

Magus_Prime

Well-known member
I received the following when identifying bang potions in combat:

Code:
Unexpected error, debug log printed.
All bang potions have been identified!
Script execution aborted (java.lang.NullPointerException): (relay_Guide.ash, line 1197)

Here's the section of the code cited in the error message:

Code:
item [slot] equipped_items()
{
    item [slot] result;
    foreach s in $slots[]
    {
        item it = s.equipped_item();
        if (it == $item[none])
            continue;
        result[s] = it;
    }
    return result;
}

and here is the actual line:

Code:
        item it = s.equipped_item();


Debug log submitted.
 
Last edited:

Veracity

Developer
Staff member
This is a KoLmafia bug. It's a race condition. I'll discuss the specific issue in the bug report thread you opened.

I learned something about Guide when I was looking at Bale's choice.php/shore.shop.php relay script override issue. He runs Guide, and the debug log he submitted showed me that the browser was repeatedly asking for relay_Guide.ash. The browser - not the user. Apparently, just like chat, that frame instructs the browser to periodically submit a URL; chat polls to see if there are new messages, Guide looks at the current state of your character and decides what to recommend for you. In Bale's log, KoLmafia was in the middle of executing his choice.php override when the browser submitted a request and we went off to execute Guide, before returning to finish up the choice override script.

Very clever. I don't actually understand the mechanism, but, near as I can tell, this is the first relay script that does that. In any case, it means that periodically KoLmafia runs an ASH script asynchronously - in its own thread, in response to a browser request - while other things in the Relay Browser and/or the gCLI and/or the GUI are doing things. In this case, the bang potion identification code is updating and sorting a data structure that Guide is also examining. I'm amazed that we haven't seen other things of this ilk coming from this script before.

But, as I said, it's not a bug in Guide.
 

Crowther

Active member
While creating EasyFax I ran into some issues with KoL starting asynchronous ash threads when receiving chat messages. Nothing really surprising, but I had a hard time synchronizing things because I couldn't find the needed primitives. I can imagine some pretty crazy messes that could be made if one wasn't aware there was multi threading going on.
 

Veracity

Developer
Staff member
The first time KoLmafia executes a particular ASH script, it compiles it and loads it into an Interpreter. It save the Interpreter so that every time it wants to execute the same script again (and the file modification time indicates it has not changed), it doesn't have to compile it again; it uses the same Interpreter. We synchronize on the Interpreter object, so if you try to execute the same script more than once simultaneously, only one will run; the other invocations will block and wait for the Interpreter to become free. Thus, asynchronous ASH threads running the same scripts end up running sequentially.

What did you see? What synchronization did you need? What "needed primitives" were missing?
 

Veracity

Developer
Staff member
Actually, I take that back. We synchronize for Relay scripts, but not chat scripts.
Let me think about that.
 

Veracity

Developer
Staff member
Wow. Well, the Interpreter object is very much not thread safe. Therefore, revision 14301 synchronizes on Interpreter for chat scripts. Hopefully, that should remove any need for "synchronization primitives" for you. Let me know immediately if you run into issues.
 

Crowther

Active member
Wow. That was fast. Yes, that removes any need for primitives (mutex/semaphore). It was funny, I couldn't even build those primitives, because I couldn't get a unique ID for each thread. My solution was to drop a message in the event of an unlucky race condition and to keep that to as short a time window as possible.

Thanks. I'll try the new code when I get home, but I don't foresee any problems.
 

Veracity

Developer
Staff member
Well, there are a couple things I am thinking of.

1) The Interpreter class itself should synchronize on "this" when you try to execute in it. That's a general code cleanup which would obviate synchronizing in each individual place that invokes an Interpreter. Since the Interpreter is not thread-safe, why not move it into the object itself?
2) ChatManager is weird. Perhaps I should spawn a thread to execute a chat script, rather than just invoking it. Yes, the existing code invoked it in place - and waited for the script to move between clans, access the fax, and so on. But what happens while it is doing that? Are we servicing other chat activity, or are we just blocked? If the latter, does it matter?

The first is a no brainer. The second, not so obvious.

Tell me how the current (new) code works for you. Thanks.
 

lostcalpolydude

Developer
Staff member
fwiw, new top menu broke Guide. It opens in the main frame instead of the chatpane.

The thing that actually "broke" Guide (I don't consider that to be broken at all) is the charpane being the full browser height. There is a KoL option to change it back so that the topmenu goes to the left edge like you are used to.
 
Top