ID:176756
 
Is ther away i could make a journal system like in Morrowind, for the people who havent played i want a jornal system so that when certain things happen you write it in your journal on the first blank page in any order and you can view it by pages
Koolguy900095 wrote:
Is ther away i could make a journal system like in Morrowind, for the people who havent played i want a jornal system so that when certain things happen you write it in your journal on the first blank page in any order and you can view it by pages

If you mean for things to be written automatically, I suppose you'd have to set up a proc to do that. For manual writing, basically I think some kind of Ensya-style HTML interface would do the trick.

Basically what you have to do is look up info on browse() and client/Topic(). One of the Dream Tutor columns at BYONDscape (subscription content) is a good place to start here.

Once you have that down, here's what you'll need:
  • A proc to display the contents of a journal page via browse(), with buttons for going to the next page, previous page, first, and last. An edit button couldn't hurt either.
  • A proc for displaying an HTML page (via browse()) where you can edit the contents of a journal entry, or write a new entry.
  • A special client/Topic() proc that will respond to all of the buttons you defined, plus accept edits of pages.
  • A savefile-based journal. This should probably be done with a custom datum (/journal) with a list of pages, each of which contains text, and the journal can be saved along with your character.

    To get you started, here's a rough idea of what that datum would look like and how it would save with your character:
journal
var/mob/owner
var/list/pages
var/maxsize=0 // no maximum

New(mob/M)
if(M) // M will be null if you load from a file
owner=M
pages=new

// if null or 0 is returned, adding a page failed
proc/AddPage(entry) // entry is a text string
if(maxsize>0 && pages.len>=maxsize) return
pages+=entry
Save()
.=pages.len // success

// if null or 0 is returned, editing/adding a page failed
proc/EditPage(entry,pagenumber)
if(pagenumber>pages.len)
return AddPage(entry)
if(pagenumber<1) return
pages[pagenumber]=entry
Save()
return pagenumber // success

proc/GetPage(pagenumber)
if(pagenumber<1 || pagenumber>pages.len)
return null
return pages[pagenumber]

proc/Save()
var/savefile/F = new("[ckey(owner.key)].sav")
F.cd = ckey(owner.name) // switch to character directory
F["journal"] << src

proc/Load()
var/savefile/F = new("[ckey(owner.key)].sav")
F.cd = ckey(owner.name) // switch to character directory
F["journal"] >> src
In theory all this should work fine. The load/save routines assume each character is saved as ckey.sav (like lummoxjr.sav) and the characters belonging to each player's key are divided into directories like "/bobthewizard" and "/nina" and such.

Lummox JR
In response to Lummox JR
Dont forget about my Demo that I made :)
In response to Green Lime
green lime why dont ur petting zoo demo work when i dl it nothing is in the folder
In response to Koolguy900095
I dont know hmmm O.o