[Tutor] my text adventure

Kent Johnson kent37 at tds.net
Thu Dec 8 13:51:13 CET 2005


david wrote:
> thanks. i had actually coded this almost exactly the same. i'll try
> to make my questions more specific. i am able to pickle and restore
> world. which is a dictionary of coordinates : room objects. when i
> look at the savefile that pickle generates i can see all my
> descriptions and exits. however when i reload my world gets back all 
> the rooms that were created with dig. but the rooms don't have their 
> exits or descriptions. is pickle the right tool for this? can i
> pickle.dump more than one thing to the same savefile?

Yes, as long as you pickle and unpickle in the same order you can do this.

> or how could i
> go about creating a structure that holds room, coords, descriptions 
> and exits? 

You could put everything you want to pickle into a list or dictionary 
and pickle that, then extract them out again when you unpickle.

Kent



More information about the Tutor mailing list