items as strings

fronobulax

Developer
Staff member
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.
 

Veracity

Developer
Staff member
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:
[color=green]> pit.ash[/color]

[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
 
Top