SmartStasis -- a complex script for a simple CCS

Bale

Minion
The problem here is that modifying "adj" also modifies "temp", so instead of restoring "adj" to its original values, it keep the modified ones.

Wait, what? How is temp modified by adj? Does setting one record equal to another actually copy a pointer to that record?
 

slyz

Developer
I mean that defining temp like this:
PHP:
advevent temp = adj;
entails that when adj's field are modified, so are temp's, since both point to the same fields.

It's easy to test, but I guess the simplest way to explain it would be to link to the thread bordemstirs started today: help with copying mutable objects.

EDIT: Err yes, what you said is what I meant ^^
 

Cheese Loaf

New member
Apologies if this has been addressed before, or if it's a BatBrain issue. Have done some searches but haven't come up with an answer yet.

Main issue- I'm using SS mainly for flyering. Don't have a Stasis familiar equipped- typically a sandworm or hound. And yet for the past few ascensions, I've noted that SS still wants to use the facsimile dictionary. For no apparent reason. This leads to me getting beaten up, as per example 2 below.

There's no reason for it to be trying to stasis, is there? Why not just go straight from flyers to wave of sauce when fighting stab bats?

Example:
[513] Hidden City (Square 2)
Encounter: pygmy assault squad
Round 0: uncle leroy wins initiative!
> You have the latest pluralMonsters.txt. Will not check again today.
> You have the latest batfactors.txt. Will not check again today.
> Checking for updates (running SmartStasis ver. 3.3)...
> You have a current version of SmartStasis.
> You have the latest use_for_items.txt. Will not check again today.
Round 1: uncle leroy executes a macro!
Round 1: uncle leroy uses the rock band flyers!
You gain 10 Mana Points
You lose 56 hit points
Round 2: uncle leroy executes a macro!
Round 2: uncle leroy uses the facsimile dictionary!
You gain 14 Mana Points
You lose 46 hit points
Round 3: uncle leroy executes a macro!
Round 3: uncle leroy uses the facsimile dictionary!
You gain 10 Mana Points
You lose 22 hit points
Round 4: uncle leroy casts WAVE OF SAUCE!
You gain 18 hit points
You gain 4 Mana Points
Round 5: uncle leroy wins the fight!
You gain 166 Meat
You acquire an item: pygmy pygment
You acquire an item: bottle of alcohol
You acquire an item: jungle drum
You gain 17 Fortitude
You gain 40 Mysteriousness
You gain 12 Sarcasm

Example 2:

[549] Palindome
Encounter: Flock of Stab-bats
Round 0: uncle leroy loses initiative!
You lose 45 hit points
Round 1: uncle leroy executes a macro!
Round 1: uncle leroy uses the rock band flyers!
You gain 14 Mana Points
You lose 56 hit points
Round 2: uncle leroy executes a macro!
Round 2: uncle leroy uses the facsimile dictionary!
You gain 11 Mana Points
Round 3: uncle leroy executes a macro!
Round 3: uncle leroy uses the facsimile dictionary!
You gain 15 Mana Points
You lose 47 hit points

Here's my CCS:
[ default ]
consult smartstasis.ash
skill wave of sauce
skill saucegeyser
 
I'm having trouble in the Barrr.

My ccs looks like this:
[ barrr ]
try to steal an item
consult smartstasis.ash

I have the most recent versions of batbrain and smartstasis.
This is the result:
Round 0: man mobile wins initiative!
Round 1: man mobile tries to steal an item!
Round 2: man mobile executes a macro!
Pirate insults known: 3 (1.79%)
Round 2: man mobile uses the The Big Book of Pirate Insults!
You acquire an effect: Embarrassed (duration: 1 Adventure)
Round 3: man mobile executes a macro!
Round 3: man mobile uses the The Big Book of Pirate Insults!
KoLmafia thinks it is round 4 but KoL thinks it is round 3
You're on your own, partner.
Click here to continue in the relay browser.
 

slyz

Developer
See the fix posted here, you can modify your version of BatBrain until Zarqon fixes it.

shademaster00: SmartStasis doesn't finish fights, you should add something in your CCS after the "consult smartstasis.ash" line.
 

Gdunge

Member
SmartStasis is no longer Olfacting Knott Yetis for some reason.

My ftf_olfact:

zlib ftf_olfact = blooper, dairy goat, shaky clown, some zombie waltzers, goth giant, knott yeti, violent fungus, spectral jellyfish, gnarly gnome, gnasty gnome, fruit golem, quantum mechanic, C. H. U. M., rotund duck, pufferfish, wealthy pirate, skeletal sommelier, endless conference call
zlib ftf_yellow = Killer Clownfish, The Black Knight

A verbosity 8 log:

Code:
> adv last

You don't have any spooky putty monsters.

Visit to McLarge: Icy Peak in progress...

[12649] Icy Peak
Encounter: Knott Yeti
Strategy: /Users/dougw/Library/Application Support/KoLmafia/ccs/default.ccs [default]
Round 0: gdunge wins initiative!
1 MP costs 8.0 μ.
1 HP costs 1.8285714 μ.
yeti fur (30.0 @ +0.0): 92μ * 30.0% = 27.6
yeti fur (30.0 @ +0.0): 92μ * 30.0% = 27.6
Monster value: 526.1
Profit per round: ActionProfitDamageOtherbase; Underworld Bonsai (0μ)94.39μ0 (5.94) Actual: 11.88 (0 MPD)MP: 11.88
Round 1: gdunge executes a macro!
Round 1: gdunge uses the fat stacks of cash!
Round 2: gdunge uses the fat stacks of cash!
Round 3: gdunge uses the fat stacks of cash!
Round 4: gdunge uses the fat stacks of cash!
Round 5: gdunge uses the fat stacks of cash!
Round 6: gdunge uses the fat stacks of cash!
You gain 32 Muscularity Points
Round 7: gdunge executes a macro!
Round 7: gdunge uses the fat stacks of cash!
Round 8: gdunge uses the fat stacks of cash!
Round 9: gdunge uses the fat stacks of cash!
Round 10: gdunge uses the fat stacks of cash!
Round 11: gdunge uses the fat stacks of cash!
Round 12: gdunge uses the fat stacks of cash!
Round 13: gdunge uses the fat stacks of cash!
Round 14: gdunge uses the fat stacks of cash!
You gain 40 Muscularity Points
You lose 6 hit points
Round 15: gdunge executes a macro!
Round 15: gdunge uses the fat stacks of cash!
Round 16: gdunge uses the fat stacks of cash!
Round 17: gdunge uses the fat stacks of cash!
Round 18: gdunge uses the fat stacks of cash!
Round 19: gdunge uses the fat stacks of cash!
Round 20: gdunge uses the fat stacks of cash!
You gain 30 Muscularity Points
Round 21: gdunge wins the fight!
You gain 202 Meat
You gain 13 Fortitude
You gain 9 Mysteriousness
You gain 8 Roguishness

Requests complete.

I tried a verbosity 9 log, but it kills KoLmafia's interface (!!!). Details here.
 

zarqon

Well-known member
@Gdunge: somehow your ftf_olfact is not getting normalized. Are you using the current SS and ZLib?

@Bale: you can add the skill to batfactors for immediate implementation. I'll add the bit to BatBrain's skill-building where it removes the skill if you won't make good use of it.

Looks like it'll be Thursday before I can release the updates that will deal with the issues mentioned thus far.
 

zarqon

Well-known member
What happens if you type this in the CLI with a verbosity of at least 4:

Code:
ashq import <zlib.ash> setvar("ftf_olfact","goth giant","list of monster");

Don't worry, this won't overwrite your setting, I just put a monster in there as a placeholder.
 

Gdunge

Member
Thanks for the troubleshooting.

zlib verbosity = 8

> ashq import <zlib.ash> setvar("ftf_olfact","goth giant","list of monster");

...and nothing shows after I type that in and hit Return.

Was something supposed to display, or is there something I need to check?
 

slyz

Developer
If it doesn't display anything, it means that all the monster names are "normalized", ie. Mafia will understand them without any problem.

From what I tested, the only change normalize() did to Gdunge's list was some capitalization.
 

zarqon

Well-known member
The issue here is that I removed the to_lower_case() conversions in SS when checking if a monster exists in ftf_olfact, since the settings are now normalized. His setting is somehow not normalized -- which I still suspect is due to using an older version of ZLib. This means that contains_text(ftf_olfact, $monster[Capitalized Monster].to_string()) will return false.

GDunge: The normalized() function in the current ZLib includes this bit:

PHP:
   if (index_of(type,"list of ") == 0) {
       string[int] bits = split_string(mixvar,", ");
       mixvar = "";
       foreach n,bit in bits {
          if (n > 0) mixvar += ", ";
          mixvar += normalized(bit,excise(type,"list of ",""));
       }
   }

I suspect that yours might lack this. Can you verify?

(Also, make sure you only have one copy of ZLib in your entire mafia directory, including subdirectories.)
 

slyz

Developer
I think the problem is that
PHP:
( "String" == "string" )
returns true, so line 221 of zlib.ash:
PHP:
if (vars[varname] != normalized(vars[varname],type))
will make it skip the normalization part.

Why not skip that check and normalize anyway?
 

Bale

Minion
It is possible to check if the capitalization is different by using this:

PHP:
if (vars[varname].contains_text(normalized(vars[varname],type)))
 

zarqon

Well-known member
If string comparisons using == and != ignore case, then contains_text() also should, no? It would be peculiar for certain string operations to ignore case and others to be sensitive to it.

Why are they case-insensitive, by the way? I assume they were made this way for a reason I'm unaware of -- but it seems easier and more intuitive to work around case sensitivity using to_lower_case() than it does to work around case insensitivity using contains_text(a,b) && a.length() == b.length()... or *shudders* a matcher.

If these operators need to remain ignorant of case for whatever reasons (backwards compatibility among them), maybe we should request some additional case-sensitive string operators? I can do the above workaround, but it's kind of ugly-looking.

@GDunge: for a quick solution to this particular problem, resave your ftf_olfact with one monster not completely typed out, i.e. change "quantum mechanic" to "quantum mech". That will make mafia realize that the different strings are actually different, and ZLib can properly normalize your setting. And there was much rejoicing.
 

Bale

Minion
If string comparisons using == and != ignore case, then contains_text() also should, no? It would be peculiar for certain string operations to ignore case and others to be sensitive to it.

Yup. I agree that would be very peculiar. However it will work. Try it!

Code:
[COLOR="#808000"]> ash "aaa".contains_text("AAA");[/COLOR]

Returned: false

[COLOR="#808000"]> ash "AAA".contains_text("AAA");[/COLOR]

Returned: true

Personally I prefer if you simply used to_lower_case().
 

Gdunge

Member
@zarqon:

This morning, I got a warning that my Zlib was obsolete. So I upgraded to "r25".

When it next ran, it did something new. It spit out some text containing my ftf_olfact settings, and said

ZLib setting ftf_grin normalized: 'procrastination giant' => 'Procrastination Giant'

Later, i checked this thread and found a request to look for some code in Zlib. Strangely, it's there, starting at line 72. Imagine that :)

So, this should fix the problem I was having where SS was not olfacting? (I'm busy killing Corman's blasphemous skeletons so won't be able to test olfacting right now.)

BTW: there's one other copy of Zlib.ash on my filesystem, in a different user's home dir. Only one in my own home dir.

Thanks!
 
Top