Syntax of file_to_map text file

dunsel8

New member
From the wiki page on take_storage()

int [int, item] static_pulls; //Items that are always included in a pull list.
file_to_map( "static_pulls.txt" , static_pulls );

What would static_pulls.txt look like?
day (count, item)?

1 (1, itemone)
1 (1, itemtwo)
1 (5, itemthree)
1 (2, itemfour)

I'd just like to be able to run the example on that page, nothing fancy (yet).

Also, is there a command for printing a list like print_r in php?
 
Last edited:
I'll leave this experiment for the student.

Create a map of that sort and save it with map_to_file(). Then look at the result.

Of course there will not be any parenthesis. This is sometimes useful for me to do when I think about creating a mapfile of maps or sub-records.


Also, is there a command for printing a list like print_r in php?

No, but I'm pretty sure we've got a feature request for that.
 
Last edited:
Yup! map_to_file revealed the truth!

The answer is:

day item count

1 seal tooth 1
1 mad train wine 5
1 milk of magnesium 1
1 fortune cookie 15
 
For the visitor from the future note that elements are tab delimited.
1\tseal tooth\t1
1\tmad train wine\t5
1\tmilk of magnesium\t1
1\tfortune cookie\t15

where "\t" is a tab.

(White space hides so many details).
 
Back
Top