Feature Conditions - Set/Remove

Theraze

Active member
I was staring at http://kolmafia.sourceforge.net/scripting.html today looking for importing info (and not finding, but that's another issue). In the course of looking, I saw that using CLI there's conditions add and conditions clear, but no other ways to modify the list through scripts...

What I was wondering was whether there existed currently a "conditions set" command, to allow for a combined conditions clear and conditions add. As well, whether there was a "conditions remove" or "conditions delete" or "conditions subtract" or something else to remove a condition from the list...?

Basically just wanting to be able to remove seeking one portion because it's not relevant, but the rest still is. Not sure how directly useful it is for most scripts, but I find myself tweaking my conditions list fairly often manually. If it's not included yet, I'm fine with doing the work to find where it needs to be and add it, but I'm somewhat distrustful of SourceForge documentation. :D
 

Bale

Minion
Code:
[COLOR="olive"]> help condition[/COLOR]

condition* clear | check | add condition | set condition - modify your adventuring goals.

The difference between "add" and "set" is that "condition set 1 reflection of a map" will stop if you have a map in inventory while "condition add 1 reflection of a map" will stop when you have +1 more map.
 

Theraze

Active member
Hmm... would "conditions set +1 reflection of a map" act like putting +1 reflection of a map into the goals list?

Also tied into this... so with current behaviour, "conditions add 5 red pixel potion" would be +5 red pixel potion, not 5 red pixel potion? Basically just because if it's +5, conditions check won't drop counts, but if it is, conditions check will update based on inventory... Is there any current command ability to accomplish adding items to the conditions list with taking inventory into account, but not clearing the current conditions list?
 
Last edited:

Bale

Minion
Trial and error would answer all those questions. I don't use this much, so I can't answer with much surety. I'd recommend that you just play with it and see what it does to your list of conditions. On the adventure tab you can select "conditions left" from the drop down list at the bottom to see what you've done.

Once you know all the answers as to how it works, I'd appreciate if you could post them on the wiki HERE or else just post them in this thread so someone else can update the wiki. (If that info gets onto the wiki, someone else will format it if you don't want to be pretty.) Thanks.
 
Last edited:

Theraze

Active member
I'm so barely functioning right now I'm not even awake enough to run my KoL scripts, but I did throw the help condition and a bit of explanatives into the condition wiki page. I'll try to elaborate a bit on it once I'm functioning enough to test it and explain.

So, would there be any objection to me tossing a patch together for condition remove or condition drop? Any vote towards what it should be between those (or something else, I could really care less long as I can find it documented somewhere)?
 

Bale

Minion
I think I favor "condition remove" to remove a condition from the list of conditions to stop adventuring, but I'll never use it so...
 

Theraze

Active member
Okay, I'll plan on adding in a patch for condition remove.

Here's something interesting I discovered (immediately after breaking my 100% BC run on the sorc, forgot to change my barrrnacle back to BC. :(). Apparently Condition set is exactly the same as condition add... both do +item. Do we want to leave it like this, or say that condition set should be like putting in =item instead? The issue, obviously, is that if scripts have been written expecting set to be +item, they may have issues... However, of the 124 scripts in my main script folder, the only one that uses conditions set is bounty.ash, and in that case you don't care if your bounty item is +item or =item... in fact =item may be better if it's a multi-day bounty.
 

Veracity

Developer
Staff member
Apparently Condition set is exactly the same as condition add... both do +item.
The code disagrees with you, as does trivial testing in the gCLI.

> condition clear

Conditions list cleared.

> inv disass

disassembled clover (29)

> condition set 20 disass

Condition already met: disassembled clover (20)

> condition set 30 disass

Condition set: disassembled clover (30)
disassembled clover

> condition add disass

Condition added: disassembled clover
disassembled clover (2)

> condition add 10 disass

Condition added: disassembled clover (10)
disassembled clover (12)
 

Theraze

Active member
Maybe it just hates me... when I did condition set red pixel potion repeatedly, it did +1 every time... by my expectation, condition set, if that amount already exists in the list (1 red pixel potion as a goal) should do... nothing. You're trying to get a total of 1 potion, you're just really annoyed by lag or something... and yet it adds a new one each time.

Or does that not happen when you try it? When doing condition set for an item already in the list which you do not have in inventory, does it keep the higher number (or alternatively, use the most recent) or add your request to the total?
 

Veracity

Developer
Staff member
Well I do notice an oddness:

> condition set 1 red pixel potion

Condition set: red pixel potion
red pixel potion

> condition set 1 red pixel potion

Condition already exists: red pixel potion
red pixel potion

> condition set 1 red pixel potion

Condition already exists: red pixel potion
red pixel potion

> condition set 2 red pixel potion

Condition set: red pixel potion (2)
red pixel potion (3)
 

Theraze

Active member
Ah... so updating the list presents wrong, but identical is detected. I may have gotten it to 2 before i started to do more condition set red pixel potion bits...

So, is behaviour as designed/planned that it keeps the highest number, or most recent number? Condition set 2 red pixel potion when it has 5 red pixel potion... Set to 2, or leave it as 5 because that's the highest quantity requested?
 

Bale

Minion
Reduce conditions through CLI or add_item_condition()

The problem is the bat hole. I wanted to auto-adventure there, however it occurred to me that if I ran into a screambat it would decrement my need for sonar-in-a-biscuit. So I wanted to add a line to my mood script to decrement the number of biscuits that I'd need if a screambat is encountered.

I couldn't do that.

I can not reduce the current number of an item required by using a negative quantity with the CLI command condition add or with the ASH command add_item_condition(). A negative number simply fails with each command.

As for simply using condition set to determine the number, that won't work because is_goal() won't tell me how many I currently need. That also makes decrementing hard.

Either I'm missing something or else I'd need the ability to decrement the required number of a goal.
 

jasonharper

Developer
This wouldn't be a general solution, but in this case it seems that the specific wall-breaking combat message from the screambat should automatically count as a sonar-in-a-biscuit towards your current goals. (It seems unlikely that anyone would be specifically farming a biscuit, prior to the Bat Hole being completely opened.) I'll look into this when time permits.

Ugly, temporary hack to decrement an item count in your goals, with no guarantee of future support:
fakeitem sonar-in-a-biscuit; removeitem sonar-in-a-biscuit
 

Bale

Minion
I'm getting some bizarre results with that. I have no sonar-in-a-biscuits right now...

Code:
Refreshing closet...
Updating inventory...
Requests complete.

[COLOR="#808000"]> condition add 3 sonar-in-a-biscuit[/COLOR]

Condition added: sonar-in-a-biscuit (3)
sonar-in-a-biscuit (3)

[COLOR="#808000"]> fakeitem sonar-in-a-biscuit; removeitem sonar-in-a-biscuit[/COLOR]

[COLOR="#808000"]> condition check;[/COLOR]

You need 3 more sonar-in-a-biscuit to continue.
Conditions list validated against available items.

[COLOR="#808000"]> condition check;[/COLOR]

You need 3 more sonar-in-a-biscuit to continue.
Conditions list validated against available items.

[COLOR="#808000"]> fakeitem sonar-in-a-biscuit; condition check; removeitem sonar-in-a-biscuit[/COLOR]

You need 1 more sonar-in-a-biscuit to continue.
Conditions list validated against available items.

Code:
Refreshing closet...
Updating inventory...
Requests complete.

[COLOR="#808000"]> condition add 3 sonar-in-a-biscuit[/COLOR]

Condition added: sonar-in-a-biscuit (3)
sonar-in-a-biscuit (3)

[COLOR="#808000"]> fakeitem sonar-in-a-biscuit[/COLOR]

[COLOR="#808000"]> condition check;[/COLOR]

You need 1 more sonar-in-a-biscuit to continue.
Conditions list validated against available items.

[COLOR="#808000"]> removeitem sonar-in-a-biscuit[/COLOR]

[COLOR="#808000"]> condition check;[/COLOR]

You need 2 more sonar-in-a-biscuit to continue.
Conditions list validated against available items.

So, it works if I add the fake item, then check, then remove it.

It does not work if I fail to check conditions in the middle, or if I fail to remove the fake item despite it only being a single sonar.

I don't get it.
 
Last edited:

jasonharper

Developer
Um, the guarantee of future support was so short that it was, in fact, negative in duration? Sorry, I really thought that would work.

"conditions check" appears to be fundamentally broken - it subtracts items on hand from those in your goals list, when the goals list is already supposed to be items you need beyond what you have on hand. Don't use it for anything.
 

holatuwol

Developer
well, "conditions check" was intended for CLI scripts to queue up a bunch of stuff and then run one "conditions check" to see what they had left to still retrieve. A lot less useful with the super fancy scripts you can write now, but it was useful for me at one time!
 
Top