Setting kolmafia variables via script?

Hey guys!

Ok, I've been scripting almost ever night. It's kind of like a drug.. always thinking of a better way to do things *grin*

But I am stuck, sorta, and so I'm back here :p

One of my subroutines farms the Barrel full of Barrels for level 2 drinks.

My next subroutine (I have the DB cocktail crafting skills permed) will go through and see if I can create level 3 drinks based on which mixers I have, and which level 2 drinks I have. (the idea being, if I have components to create a level 3 drink on hand which is helpful to my mainstat, do so. If not, save the components for a more salubrious ascension.)

My problem is, I normally have the preferences for "buy from the mall" and "buy from NPC" set to off. So it will only try to create drinks with on-hand components. Sometimes I turn these options on, so I can see what I can create even with buying materials.

What I want, is a line to put into the script that will force these options to be off at the start of every script run. I *never* want the program to decide to buy components for drinks. I only want it to upgrade drinks it can, for free.

(If this doesn't work, I guess i'll just closet all my money at the end of every run, and just let it try to buy things with $0, but in case it's possible, I thought i'd ask.)

Thanks!
Richo
 

heeheehee

Developer
Staff member
These are the two functions you'll probably want to use:
string get_property( string )
void set_property( string, string )

See the wiki for usage.
 

StDoodle

Minion
Also; and this is what I do in one of my scripts, except the other way 'round (it turns on mall-buying during execution); it doesn't hurt to save the old settings, then set them to what you want during the script, and then when done set them back to their saved settings. For example, for the preference "autoSatisfyWithMall" :
Code:
string oldMall = get_property("autoSatisfyWithMall");
set_property("autoSatisfyWithMall" , "false");
// do stuff
set_property("autoSatisfyWithMall" , oldMall);
 
Top