ID:272206
 
How would I make like, a player journal for people to record/read things they write?
obj/book
var/text = ""
verb
read()
usr << text
write(var/t as message)
text += t
In response to Garthor
Garthor wrote:
obj/book
> var/text = ""
> verb
> read()
> usr << text
> write(var/t as message)
> text += t


Might want to store the information in a text file and pull it up when people read the journal later.
In response to Obs
How would I do that?
In response to XI-Demyx
Why would you want to do that, though?
For your knowledge, however, you can use text2file() and file2text() for that. Look them up if you're interested.
In response to Garthor
Garthor wrote:
obj/book
> var/text = ""
> verb
> read()
> usr << text
> write(var/t as message)
> text += t



isnt there somthing in the DM guide very similar to that??? jw
In response to Obs
And maybe we want to have a pen before being able to write. Maybe books should have titles, and icons. Maybe we want to create bookshelves that will populate themselves with popular books. Maybe we want to create a fancy user interface for books.

Or maybe we just want to help the person do what was asked.
In response to Garthor
Yeah, agreed. Not to mention you'd likely not even want to do what Obs said, like I said earlier (if you save stuff like that then you're probably gonna end up saving the whole /obj itself anyway).
In response to Kaioken
o.o Wow, thanks guys.
In response to Kaioken
Kaioken wrote:
Yeah, agreed. Not to mention you'd likely not even want to do what Obs said, like I said earlier (if you save stuff like that then you're probably gonna end up saving the whole /obj itself anyway).

Sure, if you do it completely wrong.
In response to Obs
Obs wrote:
Sure, if you do it completely wrong.

Or if you don't think before you post.
Since the right way to preserve this between game sessions (which is why you'd be saving in the first place) would be to save only the text into some file like you said, there wouldn't possibly be any need to have any actual relation to the obj itself or it's position or any other variables.
In response to Kaioken
Kaioken wrote:
Obs wrote:
Sure, if you do it completely wrong.

Or if you don't think before you post.
Since the right way to preserve this between game sessions (which is why you'd be saving in the first place) would be to save only the text into some file like you said, there wouldn't possibly be any need to have any actual relation to the obj itself or it's position or any other variables.

Yea, there isn't. Because a book should basically only be an entry point for reading a text file. Just make a new book and assign it a textfile in a later session.

If you really must preserve the book's vars, write them into the textfile and read them off later when constructing the book.
In response to Kaioken
The book is would just be a method of reading the text files. There's no reason to save the whole /obj.
In response to Obs
Obs wrote:
Yea, there isn't. Because a book should basically only be an entry point for reading a text file. Just make a new book and assign it a textfile in a later session.

Sure, so you're going to make every book in the game have the same text (and file)? Sounds nice, especially instead of saving it properly so every obj stays where it was and still with it's possibly unique variables, including the text.
Like I said earlier, you've got to save something to relate the text to the obj anyway, if you want to assign it to the correct book in a later session. But you'd have to manually read all your textfiles and manually re-create the objs for them and generally be very silly, and it is generally the wrong way to go about saving. You might as well save only the name variable in all of your saving systems, and to a new text file, too.

If you really must preserve the book's vars, write them into the textfile and read them off later when constructing the book.

Yep. No reason to use the built-in, more flexible, efficient and robust saving system. Just dump it in a text file yo!

This is forming into quite a silly and unnecessary argument here; I shall let the thread die now, and you ought to as well.
In response to Kaioken
No, what you do is you create a textfile for each book.


This is all stupid, it depends exactly how persistent you want to keep game sessions. If you want to save the world and then load it back and have eveything where it was exactly before, it still doesn't matter because when the book objects get saved by your regular saving system the objs will be wherever they were and would still reference what textfile they are opening up. If the books are put back somewhere when you save and exit the world, then it doesn't matter. Remake a book for each textfile you have and distribute books around the world's libraries.