Results 1 to 7 of 7

Thread: Changes: Monitor property changes.

  1. #1

    Default Changes: Monitor property changes.

    Since I just found out Veracity added a bunch of interesting property functions, I whipped up a script to track property changes. This is probably mostly useful to script authors who like to see exactly what properties get changed and when so they know how to react to them.

    Suggested use is to call "Changes.ash update" in your afterAdventureScript, or "Changes_Since(true);".

    ASH Usage:
    Checkpoint( [string name] ):
    Save all properties to a Checkpoint. If "name" is unspecified, uses the checkpoint "last".
    Property values are stored in "Changes_<Character_Name>_<last>.txt".
    Changes_Since( [string name], [boolean update] ):
    Prints out all changes since checkpoint <name>, optionally updating that checkpoint (default true).
    IgnoreProperty( string prop ):
    Adds/Removes a given property to a list of properties to ignore (Changes_ignores.txt).
    Will verify the property exists first, correcting case if necessary.

    CLI Usage:
    Changes (set|update|since|ignore) [name]:
    If "name" is unspecified, uses the checkpoint "last".
    Changes set [name]: Creates a checkpoint, same as ash Checkpoint().
    Changes update [name]: Lists all changes, and updates the checkpoint. Same as ash Changes_Since( [name], true ).
    Changes since [name]: Lists all changes, does not update. Same as ash Changes_Since( [name], false ).
    Changes ignore <name>: Ignores the specified property, or stops ignoring it. Corrects improper casing.

    Code:
    svn checkout https://svn.code.sf.net/p/kolm-changes/svn/

  2. #2
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    746

    Default

    This sounds interesting. One useful option might be to timestamp the checkpoint instead of using "last". You can do this easily with now_to_string()

  3. #3

    Default

    Timestamping the checkpoint is a good idea, but the default identifier is going to be a constant value because the main idea was to use it to track changes turn-by-turn, constantly comparing and updating. You can create more permanent checkpoints by just calling "Checkpoint( now_to_string() )". I'd be careful if you do this regularly or in a script, though, because you'll end up with a large mess of individual property files pretty quick, and you'd need to specify the whole previous now_to_string() value in a "changes since <x>" if you wanted to compare it.

    FYI, the messages it prints out are logged to the session log, so you can go back and see (roughly) when individual properties changed over the course of a run by putting it in your afterAdventureScript.

  4. #4
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    D.C. suburbs of Virginia, USA
    Posts
    3,818

    Default

    Timestamping the checkpoint is a good idea, but the default identifier is going to be a constant value because the main idea was to use it to track changes turn-by-turn, constantly comparing and updating. You can create more permanent checkpoints by just calling "Checkpoint( now_to_string() )". I'd be careful if you do this regularly or in a script, though, because you'll end up with a large mess of individual property files pretty quick, and you'd need to specify the whole previous now_to_string() value in a "changes since <x>" if you wanted to compare it.

    FYI, the messages it prints out are logged to the session log, so you can go back and see (roughly) when individual properties changed over the course of a run by putting it in your afterAdventureScript.
    Originally Posted by Smelltastic View Post
    What's the use case for tracking to a particular turn? If I run one turn and then look at changes, what do I do with the information? How do I use it to plan my next turn? Or is the turn level of accounting just OCD?

    I'm asking because my OCD has me exploring some kind of code level logging within KoLmafia that reports the what and when for preference reads and writes and the answer might encourage me to explore more or just give up. :-)
    You just vehemently agreed with me
    Originally Posted by Veracity View Post
    I agree with frono.
    Originally Posted by Veracity View Post
    There are 69 players more powerful than you.
    Originally Posted by Statistics Leaderboards

  5. #5

    Default

    What's the use case for tracking to a particular turn? If I run one turn and then look at changes, what do I do with the information? How do I use it to plan my next turn? Or is the turn level of accounting just OCD?
    Originally Posted by fronobulax View Post
    The use case is in script authorship where you need to know when a particular property changes so you can react to it in your own script. Like if you're building an ascension script and need to know exactly when the questL07Cyrptic changes and what causes it and - oh look, cyrptAlcoveEvilness just went up by 1 after that adventure, I didn't realize that was there and maybe that's what I should be looking at! - etc. It adds transparency in how Mafia updates its properties to your session log so you can more easily make good use of them.

    I can't think of how it'd be useful outside of script authoring. I certainly don't see how it would help you plan your next turn. If Mafia already has a way to, or could be updated to, write property changes into the session log as they happen, this would be pretty much entirely deprecated in my view.
    Last edited by Smelltastic; 03-21-2017 at 11:35 PM.

  6. #6
    Senior Member
    Join Date
    Oct 2014
    Posts
    132

    Default

    I'm asking because my OCD has me exploring some kind of code level logging within KoLmafia that reports the what and when for preference reads and writes and the answer might encourage me to explore more or just give up. :-)
    Originally Posted by fronobulax View Post
    I modified my local copy of mafia to report on all writes (not reads) because this information is very useful for scripting.

  7. #7
    Senior Member VladYvhuce's Avatar
    Join Date
    Feb 2016
    Location
    Kansas
    Posts
    215

    Default

    This seems like a nifty addition. Especially since I'm still in the "trying to learn coding" phase. With a tool like this, I might not come off sounding like such a dolt...

Posting Permissions

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