ZLib -- Zarqon's useful function library

Tipmon

Member
Yep, that fixed it but I would rather not keep it on the desktop... I have windows 8 (sadly, it is a new laptop), could you tell me how to change it so I am not a limited user. That seems strange because I am pretty sure I made this account an administrator :S
 

Theraze

Active member
Windows 8 doesn't believe you. To actually make your [non-default-disabled-Administrator] account into an admin, you have to fully disable Metro using the secpol.msc Local Security editor.
To run a program in your Program Files folder as admin, you have to Right-click and Run as Administrator every time.

You can probably get away with just making the KoLmafia folder so that Everyone has Modify rights to it, rather than just Read rights.
Or you can put it onto Dropbox using those directions and since Dropbox runs from your personal profile, it should fix the permissions issues as well.
Or if you want to really confuse yourself, you can put it onto Dropbox and make a Directory Junction so that it looks like it's still in your Program Files folder, like I did. :)

But I'd suggest picking one of the first two options unless you have some command-line driven desire to see it in the familiar place. Heh.

Edit: Or if you have a pathologic hatred of Metro, I can give you step by step directions on how to fully disable it... but note that even the Microsoft Store will fail. It will still taunt you with its updates... you just won't be able to get any of them.
 
Last edited:

lostcalpolydude

Developer
Staff member
Yep, that fixed it but I would rather not keep it on the desktop... I have windows 8 (sadly, it is a new laptop), could you tell me how to change it so I am not a limited user. That seems strange because I am pretty sure I made this account an administrator :S

If you tried putting it in Program Files, that will cause issues even as an Administrator.
 

Winterbay

Active member
I think that actually any folder outside of Program FIles will work, so desktop is not needed, you cna just put it under C:/Mafia or something and it should work. At least it does on Win7...
 

fronobulax

Developer
Staff member
FWIW, I have always had a C:\KoLmafia directory on the Windows flavor de jour and had no problems running from there regardless of the account restrictions. The real problem here is that people think if it is a program then it needs to be in Program Files and that is not necessarily the right answer if you are dealing with something like KoLmafia that is cross-platform.
 

Magus_Prime

Well-known member
Under Windows 8 the easiest thing to do is probably to drag and drop your entire KoLMafia folder to your My Documents directory and run it from there.
 

Theraze

Active member
Windows 8 is different from every earlier flavour of Windows in that putting it on the root of the computer as an admin? Keeps the "you need to give me permission every time" rules. The same rules that apply to Program Files that make it fail there apply to the root.

Windows 8 is different. And stupid.

Either do what Magus_Prime suggested and put it somewhere in your profile, or put it somewhere else and keep wondering why things fail randomly. Your choice. :)
 
Hey, small request-
Can oil peak be added to the list of ML sensitive locations in auto_mcd?

Thanks! (I changed it locally, just sharing the love. Err, oil?)
 

zarqon

Well-known member
Yes.

So, r11 Update.

Other changes with this update:

First, I added the entryway item which your first telescope upgrade detects to tower_items(), despite its not technically being a tower item. Functionally, there's no reason to make a distinction between the two.

Second, there's a new function is_goal(stat), which is a version of is_goal() which accepts a stat as a parameter. Stats can be goals when a user or script sets "level X" or "X muscle" as a goal, and this function handily returns true if the specified stat ends up as a goal from these commands. BBB will be making use of this function when deciding whether to get stats from certain choiceadventures.

ETA: Documentation updated on the ASH Wiki to include these changes.
 
Last edited:

zarqon

Well-known member
It looks like be_good() is going to need something added for the new path. Will this do it?

PHP:
      case "KOLHS": if ($strings[hat, booze] contains item_type(johnny.to_item())) return false;

I just guessed on the path name.
 

Theraze

Active member
Unfortunately no... there are booze items which are allowed, but they're the special booze items (similar to Jarlsberg). As well, hats are allowed, but not at school, so it's specifically a $locations[] contain or $zone[] check or something similar. I wouldn't disallow helms by default though, since it's specific to the first 40 daily adventures.
 

zarqon

Well-known member
r12 Update

Tweaked the new function is_goal(stat) to automatically return true for your primestat if your level is < 13. This will both simplify and enhance a lot of checks in BBB. It also won't mess with Theraze's goal aliases, since has_goal() doesn't consult this function.

And now, some handy new functions for dealing with string lists!

string list_add(string list, string add [, string glue] )

string list_remove(string list, string del [, string glue] )

These functions are helpful for easily manipulating string lists such as certain ZLib settings ("ftf_olfact" comes to mind) or mafia preferences. They pretty much do what it looks like, but I've added documentation to the ZLib page on the ASH Wiki if you'd like details. There are a few special things worth mentioning here as well, though:

  • For both functions, glue is optional and defaults to ", " since comma-delimited lists are probably the most common.
  • list_add() only adds unique entries. In other words, if the list already contains add, it will return the unaltered list. Adding non-unique entries is quite simple and doesn't need a function: you can simply use listvar = (listvar == "" ? add : listvar + glue + add);
  • list_remove() removes all instances of del, not only the first one it finds. This behavior is due to the fact that the majority of string lists are not used as queues but rather as a set of unique identifiers.

Slightly more detailed information is available on the ZLib Wiki page (type "ashwiki zlib" in the CLI).
 

Fluxxdog

Active member
Wow, I had to rewrite a lot of my personal scripts because of this. I had my own list_add() quite literally ^^
I'll get over it :p
 

livercat

Member
Got this in Hobopolis (latest zlib, mafia 12476)
[2637] The Ancient Hobo Burial Ground
Encounter: Elmer Nicholson, the Eldritch Mist
Round 0: livercat wins initiative!
1 HP costs 0,091μ. ( 735, / 968 )
1 MP costs 2,464μ. ( 50, / 1206 )
WHAM: We currently think that the round number is: 0 and that the turn number is 2636.
WHAM: Checking to see if WHAM sould adjust the unknown_ml for Spooky Hobo.
WHAM: No need to do anything with Spooky Hobo.
WHAM: Setting up variables via BatBrain
Setting monster to Spooky Hobo...
Loading batfactors...
Evaluating '5.0 prismatic'...
Expression syntax errors for 'modifier_eval()':
Expected end, found prismatic (zlib.ash, line 176)
You're on your own, partner.
 

Winterbay

Active member
That appears to my untrained eye to be a batbrain bug in which the keyword "prismatic" for monster resistance is not correctly parsed to what it means.
 

bsander

Member
I have one similar but different:

Code:
[5921] Dreadsylvanian Castle
Encounter: Angelica Burnwing
Strategy: /Users/Sander/Library/Application Support/KoLmafia/ccs/WHAM.ccs [default]
Round 0: bsander wins initiative!
ATT: 701 (3% × (14.88), death in 2614)
DEF: 701 (97.73% × 2,157.77 (25) (60) (30), win in 1)
HP: 1,204, Value: 178.74 μ, RES: 0 (1) (-1) (-1)
Expression syntax errors for 'modifier_eval()':
Can't understand monsterdefense (zlib.ash, line 176)
You're on your own, partner.
Click here to continue in the relay browser.
 

zarqon

Well-known member
@livercat and bsander: Those should both be fixed with the BatBrain update of a few minutes ago. I was overhauling and made a little dirt first.
 
Top