Page 2 of 5 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 43

Thread: Properties

  1. #11
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default

    Near as I can tell all of those are in defaults.txt; unlike choiceAdventureXXXX where only those that we have code to let you configure via the GUI are in defaults.txt. There are only a handful of skills that have "levels" that we keep track of, and so on.
    Originally Posted by Veracity View Post
    skillBurnXXXXX is similar to choiceAdventureXXXX since all valid value for XXXXX will affect mafia's function, in this case mana burning. Having them in defaults.txt will only change the default value.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  2. #12
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,227

    Default

    Thanks for the work and laying out a design for comments.

    I am inclined towards saying that only mafia can create Global Properties. Any property created by a user/script is a user property.

    I am inclined to require unique names for created proprieties and creation would fail if the name conflicts with a Global property. I would define uniqueness as being case insensitive. This is a philosophy issue - if I redesigned preferences I would deprecate the distinction between global and user preferences. Sometimes only having one scope is worthwhile.

    I wonder about another form of get_property. string get_property(string prop_name, string def_value) If prop_name exists then this returns the value. If it does not exist then it returns def_value (but does not implicitly create anything). This would be useful in the case where the empty string is considered a valid value of a property. This is definitely a convenience function since checking for existence before fetching the property would lead to the same result. It has potential use in a situation where null and the empty string and a non-empty string have different semantics. This case is most likely to occur when ash is manipulating data created elsewhere.
    You just vehemently agreed with me
    Originally Posted by Veracity View Post
    I agree with frono.
    Originally Posted by Veracity View Post

  3. #13
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,623

    Default

    I also don't see a need for user-created properties in the global scope.

    I'm liking where all this seems to be headed. I've had the same properties/settings files for years, and by now I'm quite certain that they contain plenty of extraneous properties, from both old mafia and old scripts. These functions will allow for extremely easy coding of settings file cleanup utilities. Yay!
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Wossna | Om*****st (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  4. #14
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    842

    Default

    I also don't see a need for user-created properties in the global scope.

    I'm liking where all this seems to be headed. I've had the same properties/settings files for years, and by now I'm quite certain that they contain plenty of extraneous properties, from both old mafia and old scripts. These functions will allow for extremely easy coding of settings file cleanup utilities. Yay!
    Originally Posted by zarqon View Post
    This. And This.
    I endorse this effort and this message.

  5. #15
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    skillBurnXXXXX is similar to choiceAdventureXXXX since all valid value for XXXXX will affect mafia's function, in this case mana burning. Having them in defaults.txt will only change the default value.
    Originally Posted by Bale View Post
    This is the first I've heard of this. I see a small list of these in defaults.txt with value -100. And I see the following comment in ManaBurnManager:

    Code:
    			int priority = Preferences.getInteger( "skillBurn" + skillId ) + 100;
    			// skillBurnXXXX values offset by 100 so that missing prefs read
    			// as 100% by default.
    			// All skills that were previously hard-coded as unextendable are
    			// now indicated by skillBurnXXXX = -100 in defaults.txt, so they
    			// can be overridden if desired.
    So, yes - this exists, but there is no GUI to manipulate them, unlike choiceAdventureXXX, where some (almost all) of the ones in defaults.txt are visible in the GUI.

    That comment seems it indicate that the default for these should be "" (which reads as "0" when interpreted as an integer), just like choiceAdventureXXXX.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  6. #16
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,746

    Default

    The GUI for that is Jason's old relay script, Pyromania, last updated by Bale in 2014 when bonus images broke the original.
    http://kolmafia.us/showthread.php?56...ng-fine-tuning

  7. #17
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default

    So, yes - this exists, but there is no GUI to manipulate them, unlike choiceAdventureXXX, where some (almost all) of the ones in defaults.txt are visible in the GUI.
    Originally Posted by Veracity View Post
    Partly true. When jasonharper made those preference so that mana burning could be user controlled, Jason also wrote a relay script to be the GUI for those preferences: Pyromania.

    Edit: Ninja'ed!
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  8. #18
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    I wonder about another form of get_property. string get_property(string prop_name, string def_value) If prop_name exists then this returns the value. If it does not exist then it returns def_value (but does not implicitly create anything). This would be useful in the case where the empty string is considered a valid value of a property. This is definitely a convenience function since checking for existence before fetching the property would lead to the same result. It has potential use in a situation where null and the empty string and a non-empty string have different semantics. This case is most likely to occur when ash is manipulating data created elsewhere.
    Originally Posted by fronobulax View Post
    Well, the little property library I am pondering has the same concept: providing a default value to custom properties which will be applied if the property does not exist. This would allow your script to define a bunch of user properties which don't have to actually exist unless you want to give them a non-default value. It wasn't intended to allow "" to have a special meaning, although that would be an effect of it.

    In ASH, it would be something like this:

    Code:
    string get_property( string prop, string default )
    {
        return property_exists( prop ) ? get_property( prop ) : default;
    }
    Which doesn't seem like it has to be built-in...
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  9. #19
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    Here's what I've implemented and am testing:

    boolean [string] get_all_properties( string filter, boolean global )

    This returns a map from (case insensitive) name to a boolean which is true if the property is supported by KoLmafia itself or false if its for/by user scripts.

    The "global" boolean argument says whether to get properties from the GLOBAL prefs file or the NAME prefs file of the current user.

    Ideally, everything in "global" prefs is "built-in", but we have pesky obsolete former global properties which either migrated to the user settings or are simply no longer used.

    boolean property_exists( string name )

    Returns true if the named property exists in either the global or user map, and false otherwise

    boolean property_exists( string name, boolean global )

    Returns true if the named property exists in the specified map, and false otherwise

    boolean property_has_default( string name )

    Returns true if the named property in has a default value from defaults.txt. Having such is the definition of whether this is a "built-in" property.

    string property_default_value( string name )

    Returns the default value (which can be "") for a built-in property, otherwise "".

    string get_property( string name )

    As before. You can ask for "System.XXXX" to get a property defined by the Java Runtime, otherwise, it will get it from the global or user map as appropriate.

    string get_property( string name, boolean global )

    This will look up the property in the specific map. It shouldn't be necessary, except for those pesky obsolete globals...

    void set_property( string name, string value )

    As before. This will invoke the CLI command "set NAME=VALUE", which will invoke any side effects of changing a property value. In fact, some of the things you can "set" with this command - like customCombatScript - aren't actually "properties". I also don't like that the "set" command logs the change to the gCLI for every property that is not a non-built-in "_" property.

    void remove_property( string name )

    If its a built-in property, resets to default.
    Otherwise, removes from the user map.

    void remove_property( string name, boolean global )

    If its a built-in property, resets to default.
    Otherwise, removes from the specified map.

    Yet again, the only reason we need this is for obsolete global properties.
    Last edited by Veracity; 03-12-2017 at 06:38 PM. Reason: Fix typos
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  10. #20
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    For get_all_properties( ..., false ) - the "user" properties - every "choiceAdventureXXXX" or "skillBurnXXXX" property is tagged as "built-in", whether or not it appears in defaults.txt.

    For property_exists( name, false) - the "user properites" - every such property is declared to exist - even if it is not in defaults.txt. If you ask for the default, you'll get "" (which to_int() makes into a 0), which is how KoLmafia itself treats such properties.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •