Library: Adding a journal

The Pixie
A library for ading a journal to the game. The player can type "journal" to read the content, or "note" to add a new entry. The writer can use the AddToJournal function to add comments too.

Demo with walk-through included. Comments invited.
A very simple module that lets the writer easily put a journal into the game.
To use:

1. Create at item to be used as a journal as normal
2. In the start script on the game item, set up the journal
a. Call the SetJournalObject with the item you created in
step 1 as the parameter (as an object)
b. Optionally, call the SetJournalFont to define how the
journal text will be displayed. There are three parameters.
SetJournalFont(font name as string, font size as integer, colour as string)
3. Anywhere in you game where you want an event noted (if the player
is carrying her journal), invoke the AddToJournal command, with
the string to be added as a parameter.

Feel free to modify this code as you wish.


ETA (Aug/2013): Here is an updated version for Quest 5.4, with the bug command included (thanks for the earlier update Sora):


One issue to be aware of is that Quest will only allow one web font. If you have your game text in a fancy web font, the journal font will have to be the same font or a font already installed on the player's computer. This page may be useful in that regard:
http://www.ampsoft.net/webdesign-l/WindowsMacFonts.html

Pertex
Cool. Thanks for it. Now there are some libraries in this forum, so we should find a good place to save them or they will be lost in the deep of this forum.

The Pixie
Once you have a journal set up, you can add this command to your game, removing it just prior to release:
  <command name="bug">
<pattern>bug</pattern>
<script>
msg (Template("WriteInJournal"))
s = GetInput()
UserAddToJournal ("BUG:" + s)
msg (s)
</script>
</command>

Anyone bete-testing your game can type "bug" at the command line, and then type a comment into the journal (with "BUG" prepended). Your tester can then copy-and-paste the entire game session, and sent it too you. You then search through for "bug" and you can see his comment, and exactly what he was doing to provoke it.

What you could also do, if you are familiar with libraries, is create a specific debugging library, with various cheat commands (say to teleport you quickly to a certain place), plus the above command. When it comes to shipping your game, swap the debugging library for an empty one with the same name (and then run your walk through to check nothing was broken).

CarlinBrock
I'm a beginner to writing code, and I just have one question: How can I create a verb (other than the "note" command) for the journal that will allow the player to add an entry? I know which function to add, but the parameters kill me. :cry:

Pertex
why do you want to add a verb? A verb is used with an object (e.g "note mouse") so what should this verb write into the journal?

CarlinBrock
I figured it out. And yeah, I'm not sure what to use where yet. Thanks for responding, though!

Dmcg12
I recently upgraded to Quest 5.4 in an attempt to get to use some of the new features, but i noticed that since i've upgraded, i am now unable to use the Journal library http://quest5.net/wiki/Journal_Library

I get the message "Error running script: Error evaluating expression 'GetInput()': The 'GetInput' function is not supported for games written for Quest 5.4 or later. Use the 'get input' script command instead" , any suggestions? I know what the error message is saying but have no idea on how to fix it myself :(

Cheers!

Sora574
It's a very easy fix. Quest 5.4 got rid of GetInput() so you can just use get input { } and call back the result, likewise with the show menu { }...
So basically, just replace this (in the 'note' command)
msg (Template("WriteInJournal"))
s = GetInput()
UserAddToJournal (s)
msg (s)

With this
msg (Template("WriteInJournal"))
get input {
s = result
UserAddToJournal (s)
msg (s)
}


Or, if you're lazy, just download the revised library below.

Dmcg12
That worked a treat, thanks a bunch for the help. :D

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums