Status Page for Squiffy

How would I make a stats page that looks something like

Personal Stats 
Experience: 0 Health: 100

Ship Stats 
Shield: 0 
Weapon: 0 
Speed: 1 

Shield Type: the hull, nothing else 
Weapon Type: none 
Special Power: none 
Cargo: none

except as a new page? I want my story to have links at the beginning of every passage that I can click to print out this stats "passage" below my current story, just like a passage.

I've tried making a stats passage, but it doesn't work if I move on to a next section, so I have to copy past it for every single section. Is there a way to make a passage global? I don't want to make "Stats" a section, because then all the other links I can click on in the current passage will disappear.


DISCLAIMER: I'm not sure it works the same in Squiffy, but this is how I do it in Quest.

  1. Create a 'STATS' page with all your text and variable outputs. Add a link to the 'back' page.
  2. Create the page called 'back'. Make it a non-visible page that runs just one script. In Quest, it's the 'Move Player' script and I set it to 'expression' rather than to 'page'. The expression lets me move the player object to an attribute called 'player.page'. Here's the (Quest) code:
<object name="back">
      <inherit name="script" />
      <script type="script">
        MovePlayer (player.page)
      </script>
    </object>
  1. In any page that you want to link to the 'STATS' page, you add the appropriate link and also add a script that stets the attribute 'player.page' to the current page name. This stores the current player location. Here's the (Quest) code:
  <script type="script">
        player.page = player.parent
      </script>

The reason you need the 'player.page' attribute is because the 'player.parent' attribute is hard coded (you cannot edit it) and it updates every time the 'player' object is moved to a new page. The 'player.page' attribute stores the 'player.parent' data so that you can reference it when you go to the 'STATS' page. This way, you can have a "back" link on your stats page that brings the player back to the previous page. Just remember to set the attribute on every page that you want the player to link from. In Quest, I just paste the script, so it's easy.


K.V.

Do you want to open a separate window, then modify the text in that window whenever you please? (The window will not stay on top of the main browser window.)

@title New Game

Start writing! You can delete all of this text, or play around with it if you're new to Squiffy.

Each choice is represented by a [[new section]]. You can create links to new sections by surrounding them in double square brackets.

[[new section]]:
    var win = window.open("", "STATS", "height=400,width=400");
    win.document.write("HELLO");
    squiffy.win = win;

In addition to sections, Squiffy has the concept of passages. These are sections of text that don't advance the story. Passage links use single square brackets. For example, you can click this [passage link], and this [other passage link], but the story won't advance until you click this [[section link]].

[passage link]:
    squiffy.win.document.write("<br/>HELLO AGAIN");

This is the text for the first passage link.

(The newly created window has been updated, but it will not stay on top.)

[other passage link]:

This is the text for the second passage link.

[[section link]]:

When a new section appears, any unclicked passage links from the previous section are disabled.

Or do you want to create a new tab in the browser, then modify the text however you please?

@title New Game

Start writing! You can delete all of this text, or play around with it if you're new to Squiffy.

Each choice is represented by a [[new section]]. You can create links to new sections by surrounding them in double square brackets.

[[new section]]:
    var win = window.open("", "STATS");
    win.document.write("HELLO");
    squiffy.win = win;

In addition to sections, Squiffy has the concept of passages. These are sections of text that don't advance the story. Passage links use single square brackets. For example, you can click this [passage link], and this [other passage link], but the story won't advance until you click this [[section link]].

[passage link]:
    squiffy.win.document.write("<br/>HELLO AGAIN");

This is the text for the first passage link.

(The newly created tab has been updated!  Click on it to see the changes!)

[other passage link]:

This is the text for the second passage link.

[[section link]]:

When a new section appears, any unclicked passage links from the previous section are disabled.

Or are you wanting a popup element on the same page? (This is doable, too.)


[[room1]]:
You're in a room. Go to [[room2]].


[[room2]]:
Here's Room 2. Back to [[room1]]. No, foward to [[room3]].


[[room3]]:
Go to [[room1]]


[[Personal Stats ]]:
Personal Stats
Experience: 0 Health: 100

Ship Stats
Shield: 0
Weapon: 0
Speed: 1

Shield Type: the hull, nothing else
Weapon Type: none
Special Power: none
Cargo: none

[[]]:
setTimeout(function(){squiffy.ui.write(squiffy.story.sections['Personal Stats '].text)},100);


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

Support

Forums