Results 1 to 3 of 3

Thread: items as strings

  1. #1
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,695

    Default items as strings

    I want to print an item with the number and the name, i.e. [31]seal-toothed rock and not just seal-toothed rock.

    I'm willing to do the conversion to string outside of the print statement.

    I know when I write a string[item] to a file as a map, I the "expanded" name but I'd prefer not to do that.

    Is there something there already or do I consider adding the function?

    Thanks.
    Well, thank you.
    Originally Posted by Veracity View Post

  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,300

    Default

    Code:
    string pit( item it )
    {
        return "[" + it.to_int() + "]" + it.name;
    }
    
    for i from 1 to 201 by 20 {
        print( pit( to_item( i ) ) );
    }
    yields

    Code:
    > pit.ash
    
    [1]seal-clubbing club
    [21]sweet ninja sword
    [41]ice-cold Sir Schlitz
    [61]fortune cookie
    [81]ice-cold Willer
    [101]meat golem
    [121]sprocket assembly
    [141]dingy dinghy
    [161]ghuol egg
    [181]baseball
    [201]bat wing kabob

  3. #3
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,695

    Default

    Thank you.

Posting Permissions

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