Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Two passage layout?

I'd like to have two passages displayed side by side, one for the player's inventory and one for the game itself. I tried looking at xax's awesome looking multi-pane system in the workshop forum, but it's over my head and I'm not sure if it's too complex for what I'm trying to do. Can anyone baby step me through this? Thanks for reading.

Comments

  • For quick and easy, did you try my Dumb Terminal stylesheet?
  • I don't think you actually want a second passage, you just want a place where you can display text outside of the main passage area. I'm not sure how easy it would be to do what you're asking in other headers, but it's quite easy in SugarCube. (In fact, the hardest part will probably be coming up with the CSS for a nice layout.) Here's a quick implementation that takes advantage of a line of jQuery (SugarCube supports jQuery) and the SugarCube replace macro, which lets you target any element on your page.
    :: StoryInit
    /% Special code that triggers at startup %/
    <<set $inventory to ["hat", "cane"]>>
    <<script>>
    $(body).before("<div id='inventory'></div>");
    <</script>>


    :: Start
    The sun shines on a comfy-looking park bench. No one is in sight.

    [[Stretch out on bench|Sleep]]

    :: Sleep
    You stretch out on the bench and take a well-deserved nap. You awake to find that some ruffian has swiped your cane!<<set $inventory[1] to "no cane">>


    :: PassageDone
    /% Special passage that triggers after every passage has rendered %/
    <<inventory>>


    :: Inventory display [widget]
    <<widget "inventory">>
    <<replace "#inventory">>\
    <<print "You are carrying: " + $inventory.toString()>>
    <</replace>>
    <</widget>>

    :: Styles [stylesheet]
    #inventory {
    position:fixed;
    background-color:#dddddd;
    color:#000000;
    bottom:0;
    left:0;
    margin:20px;
    padding: 20px;
    }
  • @Sharpe, thanks, I'll take a look shortly. I assumed this would be a little out of my depth due to the text input function, but hopefully I'll be able to pull out the bits I need.

    @Erik, I haven't looked at Sugarcube yet, but I will. I think I am looking for another passage, though, because I want the player to be able to click links next to each inventory item. Would that be possible with your solution?
  • Yes, you could have clickable links. The text is being "wikified" (i.e. rendered) in most ways as if it were a passage, but it isn't one. The main reason that I think you might want to have multiple passages running in tandem is if you wanted clicking on a link in the inventory to lead to following a different line of passages in the inventory area from that in the main area. That's probably not what you want...?
  • mostly wrote:

    @Sharpe, thanks, I'll take a look shortly. I assumed this would be a little out of my depth due to the text input function, but hopefully I'll be able to pull out the bits I need.


    That textinput macro is (was) an additional macro that had nothing to do with the second story region. Now, in games built with Twine 1.4+, that text input macro won't even function as there is a default version that overrides it.

    If you want to try it out but have problems, just let me know in my stylesheet thread.
Sign In or Register to comment.