Bug - Fixed Bang potions in mood get confused when ascending

Veracity

Developer
Staff member
Ooh. I sort of like this:

> use pot of blessing
Using 1 swirly potion of blessing...
You acquire an effect: Izchak's Blessing (10)
Finished using 1 swirly potion of blessing.

> use pot of det

You have not yet identified the potion of detection

> use vial of slimeform

You have not yet identified the vial of slime: slimeform
With that, currently, using unidentified potions/slimes is not an error; it does not turn the sidepane red. That does have the effect that once I fix mood triggers to not fully resolve into items, it won't abort your mood, but it means that it also won't stop scripts who attempt to use unidentified things, either. Should it? If so, I'll have to put extra code in to "mood execute"...
 

xKiv

Active member
Here's the plan:

- When you select "Object Detection", for example, the default action is "use 1 potion of detection". Therefore, we want to keep that in the mood file.

Huh .. a stupid thought occurs ... why does it HAVE to be "use 1 potion of detection" instead of "up object detection", again?
 

Veracity

Developer
Staff member
Because you can say "use 5 potion of detection" and the "up" command does not take a count, does it?
 

Ensiferum

Member
This NPE (present in 15718 too) seems related to the changes discussed here.

Code:
Unexpected error, debug log printed.
class java.lang.NullPointerException: null
java.lang.NullPointerException
	at net.sourceforge.kolmafia.maximizer.Maximizer.maximize(Maximizer.java:921)
	at net.sourceforge.kolmafia.swingui.MaximizerFrame.maximize(MaximizerFrame.java:198)
	at net.sourceforge.kolmafia.swingui.MaximizerFrame$MaximizerPanel.actionConfirmed(MaximizerFrame.java:247)
	at net.sourceforge.kolmafia.swingui.panel.GenericPanel$ConfirmedListener.execute(GenericPanel.java:627)
	at net.sourceforge.kolmafia.swingui.listener.ThreadedListener.run(ThreadedListener.java:239)
	at net.sourceforge.kolmafia.RequestThread$SequencedRunnable.run(RequestThread.java:418)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Happens with every Maximizer use that checks those potions, it seems.
 

Theraze

Active member
If there's any way it can not post this to the gCLI, that would be nice:
> maximize 0 beeosity, 4 item, 3 meat, 2 mainstat, .05 familiar weight, spell damage, .1 initiative,

Maximizing...
16 combinations checked, best score 919.00
You have not yet identified the potion of mental acuity
You have not yet identified the potion of detection
You have not yet identified the vial of slime: eyesight
You have not yet identified the vial of slime: brains
You have not yet identified the vial of slime: sagacious
You have not yet identified the vial of slime: mentalism
You have not yet identified the vial of slime: intensity
I don't care that I haven't identified the vials. I just want to maximize for my normal stuff.
 

Darzil

Developer
I think the normal way to do that with Maximizer seems to be to set a boost with text "identify and use X", cmd "", and only show it if you're asking to see all effects (though you could do it if you have some ! potions or some slime potions respectively), rather than writing to CLi.

I'll look at that sometime if Veracity doesn't.
 

Veracity

Developer
Staff member
Does this happen because the maximizer is doing a speculative "use" or something?
I assume so, since it isn't actually using the potion.
The command should presumably not print that if it is a "check only" command.

I do like the "identify and use" thing, but that is beyond my maximizer-fu, so I will leave that to you. :)
 

Veracity

Developer
Staff member
Revision 15724 will not display those informative messages in "sim" mode - which is what the maximizer uses.
 

Theraze

Active member
Thanks! When BCA runs maximizations between quests, the gCLI gets rather chatty without adding an extra 7 lines in every time. :)
 
[...]
Command: ashq use(1, to_item("potion of blessing"))
[...]
I've been using this workaround. But now Mafia returns
[¶-1] has no matches.
... even after the potion has been identified (I can successfully use it from the CLI with "use potion of blessing").

I guess this is related to one of the recent changes to how items are handled behind the scenes. What's the preferred way to do this now?
 

Veracity

Developer
Staff member
You have no reason to use that workaround any more; you should be able to simply say "use 1 potion of blessing" in your mood.

The question of how ASH should deal with bang potion aliases is interesting, though. I experimented with putting bang potion resolution in to DataTypes.parseItemValue, which takes a string and converts it into an "item" object. This has the following effects:

to_item( "potion of blessing" ) -> $item[ milky potion ] or $item[ none ], as appropriate
$item[ potion of blessing ] -> $item[ milky potion] or $item[ none ], as appropriate.

I think the first one is OK; it translates at run time, so if you run your script and then identify it and run your script again, you'll get whatever the current translation is.

I think the second one is not OK. That is a compile-time translation which does not change when conditions change.

Now, you can always do cli_execute( "use 1 potion of blessing" ), but it would be nice to be able to use(1, to_item( "potion of blessing" ) ), so I think the first needs to work.

I'd be OK if $item[ potion of blessing ] generated a compile error.

What do ASH coders think?
 

Veracity

Developer
Staff member
Yeah. I talked myself into that. Revision 15738 does this:

to_item( "potion of blessing" ) will return the current item, or $item[none] if not identified yet.
$item[potion of blessing] generates a compile error.

So, your workaround will work again, even though it is not actually "working around" anything any more; it's just doing something in an unnecessarily complex way.
 
Ah, cool. I wasn't aware that the underlying problem had actually been fixed. I'll un-complicate it tomorrow and give it a shot. Thanks!
 
So my current mood says:
Trigger on: When an effect is lost
Check for: Object Detection
Command: use 1 potion of detection
---
When I run low on Object Detection, use 1 potion of detection​

But it doesn't actually work. Running adventures with this mood just silently skips over that mood line, without using the potion.

Trying manually, I get this:
> count potion of detection
smoky potion of detection (51)

> mood execute
potion of detection is unusable.
Mood swing complete.
 

Veracity

Developer
Staff member
I did all the heavy lifting to make this work:

> use 1 potion of detection

Using 1 smoky potion of detection...
You acquire an effect: Object Detection (10)
Finished using 1 smoky potion of detection.
and to make sure that when you put that in your mood that it would not immediately turn it into the current item name, but I ran out of steam before actually testing it in a mood.

Thanks for testing. I'll get to it soonish. :)
 
Top