Howdy, Stranger!

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

Can a room(passage) have objects that the player can examine or take?

Well that's my question! :)

Comments

  • the answer is yes.

    You write in the objects as part of your story, and you use variables to track whether the object is taken or not.

    What version of Twine are you using? What story format are you using? (depending on the answers to your questions is how you write the code to track your variables.)
  • Exactly right, FeliWebWork. You just write in the code to illustrate anything you want the reader to know.

    Sharpe has a good example, here:



    Is this what you mean?

    There is a [book]<book| on the <table|.

    (click: ?book)[A heavy tome with an age-worn leather cover.]

    (click: ?table)[A massive oak dining table.]

    Or, maybe this can be better styled to what you seek:
    There is a [book]<book| on the <table|.

    (click: ?book)[(replace: ?book)[heavy tome with an age-worn leather cover]]

    (click: ?table)[(replace: ?table)[massive oak dining table]]

    See if either of those dogs will hunt.
  • note: you need to state which story format you are using as answers can be different for each one. I am going to assume you are using Harlowe.

    As @feliwebwork and @Sage have already said, the answer is yes.

    You can use $variables to track if the Reader has done an action (like picking up a book) or not.
    Expanding on @Sage's example, try adding the following to a passage:
    (set: $haveBook to false)
    
    There is a [book]<book| on the [table]<table|.
    (click: ?book)[(replace: ?book)[heavy tome with an age-worn leather cover]]
    (click: ?table)[(replace: ?table)[massive oak dining table]]
    
    (if: not $haveBook)[(link: "Take Book")[(set: $haveBook to true)]]
    
    The first line is setting up the $haveBook variable being used to track if the Reader has the book or not, you should setup all the $variables with default values within the first passage of your story.

    The $haveBook variable starts out as false and is changed to true is the Reader clicks on the Take Book link. The Take Book link will only appear if the Reader does not have the book. Ideally the room description should also be changed so that the book is not on the table.

    To see what the passage will look like if the Reader has the book already, change the first line of the above example to the following and Test your story again:
    (set: $haveBook to true)
    
  • Yep they shore wud! Thanks, I'm going to try that. I'll get back with you if I have problems. Thanks for anwswering so quickly, both of you!
    Paul
Sign In or Register to comment.