Howdy, Stranger!

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

How Do you get an Inventory button to show up on the side bar in SugarCube format for the Twine vers

the Twine version before the Beta that is out. Also what do you put in the JavaScript passage?

Comments

  • You do not put anything into the Story JavaScript. To add items to the story menu, you place links or link-type macros, one per line, into the StoryMenu special passage—i.e. a passage named StoryMenu.
  • I have that passage but it doesn't want to show up. I have a macro in the passages that works, but I can't see a button on the side bar of the sugar cube format
  • All special passage and tag names are case sensitive—i.e. StoryMenu is not the same as storymenu—so ensure that you're spelling it correctly.

    If you are spelling it correctly, then it has to be a problem with what you're trying to do. Please show the contents of your StoryMenu special passage.
  • How do I do that?
  • FoxFire wrote: »
    How do I do that?

    Screenshot!

    Here's one that shows how it should look.

    PYLayiE.png

    #1 - The title must be StoryMenu with no spaces, and a capital S and capital M.
    #2 - The passage must contain a tag written as StoryMenu with no spaces, a capital S, and a capital M.
    #3 - The menu options must be links or link macros, each on their own line.
    #4 - Doing #1 - #3 will cause those links to appear on the sidebar when you start the game.
  • Naweth wrote: »
    #2 - The passage must contain a tag written as StoryMenu with no spaces, a capital S, and a capital M.
    The passage tag is not needed for the StoryMenu special passage to work, it just needs the Passage Name/Title to be correctly spelt and in the correct case.

    note: None of the special passages need a passage tag to work so you should not add one.
  • edited November 2016
    Sorry to jump in on this, but once you've set this up, as in having an 'Inventory' link in the sidebar, then what? When a player clicks the Inventory link, where and how do the items they're carrying actually show up?
  • Jud_Casper wrote: »
    Sorry to jump in on this, but once you've set this up, as in having an 'Inventory' link in the sidebar, then what? When a player clicks the Inventory link, where and how do the items they're carrying actually show up?
    That's something the developer—i.e. you—has to write.
  • There's an inventory system already sorta made floating around the Forums?
  • Thanks. I think the easiest way would be to just have a series of if trues for each object and have them listed in the sidebar itself.
  • Jud_Casper wrote: »
    ... where and how do the items they're carrying actually show up?
    There is no best/correct/one way to implement an inventory system, they can go from being very basic
    <<set $hasSword to true>>
    <<set $hasBread to false>>
    
    or
    
    <<set $carrying to ["Stick", "Flask of Water"]>>
    
    ... to extremely complex (no example supplied) depending on what features you want the system to have.


    The following are some of the questions a developer needs to ask them self when designing one:

    . Do you need to track how many instances of a particular item is in the inventory?
    eg. 2 x Bread, 5 x Arrow

    . Will other things besides the player also need an inventory?
    eg. Shopkeepers, Party Members, Monsters, Locations.

    . What happens when a item is removed (dropped) from an inventory?
    eg. Does the item disappear from the game; Does in appear on the floor of the current location.

    . How complex are the items in the inventory?
    eg. Is an item just a name like "Rusty Sword" or "Loaf of Bread", or can an item have attributes like {name: "Rod of Lordly Might", type: "sword", damage: 20, weight: 8}
  • edited November 2016
    Thanks, greyelf. Thankfully, if I decide to use an inventory system it would be as simple as listing the item if the player has it (true) and not listing it/removing it from the list if they don't or use/drop it (false)
  • edited November 2016
    Then you would have lots of 'Ifs/Thens/Elses' in the Inventory Passage, I believe. Or a loop testing for true or false? I dunno if that would work or not. I think I was thinking of datamapping your values - Item have? False, etc etc. Then have an for loop checking every item against whether you set it to false or not ?

    Or a series of If/Then/Else checking boolean values - but that's probably a bit unwieldy to be honest. I'll yield to the experts in this case, lol.
  • edited November 2016
    Surely all I would need would be:
    <<if $hasGun is true>>Gun<</if>>
    
    For each of my objects, and just remember to set them to true or false in the relevant passages?
  • edited November 2016
    If you're going for a key item type inventory, then yes.

    That said, you should not test boolean values. Conditional expressions resolve to a boolean, so simply use the value. For example:
    !Items:
    <<if $hasGun>>Gun<br><</if>>
    \<<if $hasKnife>>Knife<br><</if>>
    \<<if $hasBattery>>Battery<br><</if>>
    
  • Thanks. As it happens I did wonder why in the threads I'd found on inventory systems people were using the 'true' value, but I just assumed they knew better.
Sign In or Register to comment.