Well I'm making a codex in my newest game, so I decided to share how it's done. It's nothing impressive, but I figured I would post how to do it in-case someone else wants to at some point.
What is a Codex?
In my story, the codex is a page with a list of entrees of different creatures. Each creature has it's own page dedicated to it, and the page always links back to the codex. The key thing about the codex, is that it's accessed through an item and as such can be used at any time in the story.
So in abstract form, it looks like this:
Any Page <------> Codex <------> Any Creature Entry
You can't view any creature entry without first going to the codex, and you can only go back to the story through the codex.
How do you do it?
Well it wasn't too hard, all you need are two variables, and some scripts.
The two variables I used were:
ISCODEX - Used to determine if the current page is within the codex (Is either 0 or 1)
LASTPAGE - Used to determine the page you came from when you entered the codex (Is any number)
The Scripts were:
Global Page Script
What this is saying is that, so long as the current page isn't within the codex, and is not the codex page (my codex was on page 10) then LASTPAGE is equal to the current page.
Codex Page Script
Pretty straight forward. This means that from now on any link you go to is within the codex and will not be saved as %LASTPAGE.
Codex Page - Return to Story Link
This is the scripting in the link on the codex page, which will take you back to where you where in the story. The first line is setting the destination of the link to whatever the %LASTPAGE variable is, the "@P" is just syntax that the site uses for page numbers. The next line sets the ISCODEX variable back to zero, since you're leaving the Codex and going back to the story.
You can set the "Return to Story" link on the "Codex" page to anything, i just set it to link back to the Codex page. It doesn't matter what you set it to since the destination will be changed by the script.
It works with multiple chapters. I have my codex and all it's entrees in it's own seperate chapter to organize things. Since it links directly to the page number there are no issues with moving between chapters. By this I mean the Codex page can be accessed by, and move back to, pages within different chapters.
We need the additional ($PAGEID != 10) check in the global page script because when you enter the Codex page, the global script would run before the page script. This means that it's checking the Codex variable before we change it. We could make the change in the global variable, but since we only need to change it on the one page, there is no point in exceuting it on
Go make this an article and then PM me.
But in the first box, change the ! to a :
I don't know what you mean by making it an article, and the "!=" means "Not equal" while ":=" means setting the value of a variable. So changing it to that would break the script (I tested it and it doesn't even let you compile it).
Nevermind, I think I found what you meant by making it an article.
Well there is one pretty simple question you need to ask:
- Do I want the reader to be able to go to these pages at any given time in the story, without it being in the actual story?
If the answer is yes than you can use this "Codex". Truthfully calling it a codex is kind of wrong, as you can use it for other things including:
- Telling a story inside of a story (Inception.....)
- Having a game inside the story
- A Codex (obviously)
- A Journal
The only thing that has to remain true, is that you want them to be able to access the story/game/codex at any given time within the story, and then be able to jump right back into the story after they are done with it. It's a part of the story/game, without actually being IN the story/game.
As an example, think of any of Endmaster's stories (well any in the Fantasy Section). Often times you'll see links to pages that give you information on the world around you, rather than actually being part of the story. However that information page only links back and forth between one specific page in the story - meaning that if you ever wanted to re-read that page, you would need to backtrack the story to get to it.
So an alternative to that would be to put all the pages into a "Codex" or "Journal" or whatever you want to consider it. Then you would give the reader the "Codex" as an item. Then at any point in the story, they could click the "Codex" and be able to view any of these pages of information, then jump right back into the story after they're done.
You could do fancy things as well (which almost contradict what I'm saying), in that you could link to a page that is actually in the story, however when you link it through the "Codex", you would not allow them to continue the story through that page, thus creating an artificial boundary. Though I'm not sure if you understand what I mean there.
Maybe I'll just create a sample storygame using various versions of this to explain what I mean, it's easier to show it then tell it.
I'm using this script in ATC 2 for a -Smartphone- so far it works great!
Glad I could help.