Results 1 to 7 of 7

Thread: Writing to file?

  1. #1

    Default Writing to file?

    I'd like to create my own mini logfile, a quick one line summary of the entire session results, say.

    Is there any way in ASH to write to/append to an arbitrary file?

  2. #2
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,568

    Default

    Well, let's see what ASH knows about...

    Code:
    > ashref file
    
    boolean file_to_map( string, aggregate )
    boolean file_to_map( string, aggregate, boolean )
    boolean map_to_file( aggregate, string )
    boolean map_to_file( aggregate, string, boolean )
    Code:
    > ashref log
    
    void logprint( string )
    int [int] reverse_numberology( )
    int [int] reverse_numberology( int, int )
    string [int] session_logs( int )
    string [int] session_logs( string, int )
    Looks like your only real "save to an arbitrary file" option is basically map_to_file, but you can define the map record however you like... for example, anchoring with my_daycount and then including whatever session summary brings you joy.

  3. #3

    Default

    Hehe, those two ashrefs were the first thing I tried I was vaguely aware of map_to_file back when I actually knew what I was doing with ASH, but I don't remember the first thing about it - and it didn't occur to me for this task. I remember Veracity wrote a tutorial on maps somewhere in the official documentation, guess that's the first thing I should read up

    Thanks for the pointers!

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

    Default

    Hehe, those two ashrefs were the first thing I tried I was vaguely aware of map_to_file back when I actually knew what I was doing with ASH, but I don't remember the first thing about it - and it didn't occur to me for this task. I remember Veracity wrote a tutorial on maps somewhere in the official documentation, guess that's the first thing I should read up

    Thanks for the pointers!
    Originally Posted by illarion View Post
    http://kolmafia.sourceforge.net/advanced.html#maps

    and/or

    http://wiki.kolmafia.us/index.php?title=Data_Structures
    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

    ...and I have it doing exactly what I want with map_to_file (Which is great, incidentally - somehow it's easier to write a record to file in ASH than in just about any "real" language I've used. Veracity* is awesome ).

    Thanks again for the pointers folks!

    (*I think I'm right in remembering it was Veracity who did the work on maps? Apologies if I'm miscrediting there).

  6. #6
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    10,521

    Default

    Yes, I invented ASH maps (and records and arrays). Glad you like them!
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  7. #7

    Default

    Yes, I invented ASH maps (and records and arrays). Glad you like them!
    Originally Posted by Veracity View Post
    I do indeed, especially in combination. (And Mafia and ASH remain one of the very best things about KoL!)

    Good to see you again Veracity, very glad to see you're still around.

    As ever, thanks for everything you've done for us!

Posting Permissions

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