Howdy, Stranger!

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

How do I implement this?

Okay, so I want to do something along the lines of the following in a Twine story (underlined text denotes links; text between >>and<< is clicked links):
[quote="Your Front Door"]Ah, home sweet home. It's been a while since you came here. The welcome mat is displayed before the >>door<<.
[quote="The Door"]It's your own front door! >>Open it<<?
[quote="Can't open it!"]Mrmmph! It's locked! Oh yeah, you locked this before you left, right? Now where did you put >>that key<<...
[quote="Your Front Door"]Ah, home sweet home. It's been a while since you came here. The >>welcome mat<< is displayed before the door.
[quote="Welcome Mat"]It's a welcome mat. Didn't you put your key under here? Ah yes, it's right here. You make a quick look around and slyly >>pick it up<<.
[quote="Your Front Door"]Ah, home sweet home. It's been a while since you came here. The welcome mat is displayed before the >>door<<.
[quote="The Door"]It's your own front door! >>Open it<<?
[quote="Your Front Door"]With key in hand, you easily open the door. Now that the door's open, you can enter it. The welcome mat is displayed before the door.
Sorry if that was too verbose. Basically I'm trying to figure out how to keep track of variables and such, since I've never really used them before. Thanks for your help.

Comments

  • Read the tutorial by Sharpe and look at the sample RPG in the Workshop area.
  • Wraithbane wrote:

    Read the tutorial by Sharpe and look at the sample RPG in the Workshop area.

    You mean this one? (Sharpe has two tutorials, one for Javascript objects and another for CSS.) It looks pretty complicated for what I'm doing, but I'll keep it in mind. As for the sample RPG, I'm not sure I'll need it at all, as this project is more of a very simple adventure game type deal.
  • Wraithbane's heart was in the right place and I'm glad he's directing people to helpful resources. Most will find my beginner tutorials very handy and anyone seeking to make a turn-based RPG in Twine should certainly take a look at my example.

    However, at this stage in the game, "everyone's" first tutorial might be of more help: http://www.auntiepixelante.com/twine/

    Basically, you set variables and you check variables. That's about all you do with them.

    To set the variable "$color", do this:
    <<set $color = "green">>
    To check the variable "$color", use an if conditional branch like this:
    <<if $color eq "green">>
    The color is green.
    <<else>>
    The color is red.
    <<endif>>
    The operator "eq" means "equal to". You can use "is" or "==" in place of "eq"; they are synonymous and work the same way. So, the conditional branch is "checking" the $foo variable basically by saying, "If the variable '$color' is equal to green, print that the color is green. Elsewise, print that the color is red." Sure, there's a lot more to it, but that's the foundation of variables. Pretty simple stuff once you see it in action.

    Also, I made your game real quick. Note that there are about 10,000 ways to create the scenario you proposed. Feel free to ask questions.

    Hope that helps! :)
  • Thanks! Sorry I didn't reply to your help earlier, but your example was what I needed to get through my project. Now I'm stuck on something different, though. I want the player to be able to do a series of actions that will annoy someone, and once the player has done one said annoying action, that action shouldn't "count" anymore. Once the person has been properly annoyed, they'll leave. I may not be doing a good job of explaining what I want, so as a parser example, I want to do basically the "getting some chicken from the lady" puzzle from Ryan Veeder's You've Got a Stew Going! (And I know about the actions macro, but I want to do this with the same adventure game style set-up I've been using for the rest of the game.)
  • Sharpe wrote:
    The operator "eq" means "equal to". You can use "is" or "==" in place of "eq"; they are synonymous and work the same way.
    Just as a side note: I personally discourage all future use of "eq" - I added "is" as a replacement because it needed to be replaced. So, I encourage exclusively using "is" for all future examples.
  • Healy wrote:
    I want the player to be able to do a series of actions that will annoy someone, and once the player has done one said annoying action, that action shouldn't "count" anymore.


    Would just not giving them the option to do the same action again work?

    This example uses "setter links." See here: http://twinery.org/wiki/link
    <<if $foo is 0>>[[Do annoying thing][$foo = 1]]<<endif>>
    Example attached. Note that I used the "nobr" tag on the Start passage, and made whitespace with HTML <br> tags. You'll see what I mean. It keeps from having a "hole" between options after removing them. Also note that you can kick the door repeatedly, but you get a different answer after trying once, which may be what you're seeking. I put a couple more comments in the code as well.

    Hope that helps! :)
  • Hmm, not quite like that; I need all the actions the player does to have a cumulative effect, and I need for them to be able to try them in any order. (So, I don't think that code snippet is quite going to work.
  • You didn't download the TWS I wrote for you. It does just that.
  • You can use a variable as a counter - [foo to foo +1] - and hide old actions or expose new ones when it exceeds certain threshold values.  You could also use a separate counter for each actions, decreasing its effectiveness.

    <<set $annoyance = 0>>
    <<set $annoy_poke = 3>>
    <<if $annoyance lte 10 & $annoy_poke gt 0>>[[Poke|here][$annoyance +=$annoy_poke;$annoy_poke -= 1]]<<endif>>

    ...repeat for different options...
Sign In or Register to comment.