Howdy, Stranger!

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

New to Twine, how do I make a text box or input text?

Hi guys,

I'm new to Twine and I've discovered that Twine has thrown away the <<textinput>> format because I saw that this format used to be the old one. I've looked literally all over the internet, I don't know how to read codes, there's no information ANYWHERE on how to simply incorporate a text box aka let the player input text. I'm not talking about putting in their name, I'm talking about actually typing in something. To be more specific, I want the player to type in what it is they are afraid of. Please help, my game is due for a college project on Tuesday ): And as stated, I have no idea how to read codes so if someone could just copy and paste the new format that'd be amazing <3

Comments

  • We need to know which Story Format you're using in order to help. I'm going to assume you're using Harlowe 1.2.4, which I think is the default for the latest version of Twine, but I unfortunately can't get the latest version to run for me, so I can't check right now.

    In Harlowe, there is is not <<textinput>> macro or an equivalent, but you can use the (prompt:) macro to do something very similar:
    (set: $name to (prompt: "Enter your name:"))
    

    You can then print the player's name in your story using the variable $name.
  • Chapel wrote: »
    We need to know which Story Format you're using in order to help. I'm going to assume you're using Harlowe 1.2.4, which I think is the default for the latest version of Twine, but I unfortunately can't get the latest version to run for me, so I can't check right now.

    In Harlowe, there is is not <<textinput>> macro or an equivalent, but you can use the (prompt:) macro to do something very similar:
    (set: $name to (prompt: "Enter your name:"))
    

    You can then print the player's name in your story using the variable $name.

    Yes I'm using Harlowe

  • Chapel wrote: »
    We need to know which Story Format you're using in order to help. I'm going to assume you're using Harlowe 1.2.4, which I think is the default for the latest version of Twine, but I unfortunately can't get the latest version to run for me, so I can't check right now.

    In Harlowe, there is is not <<textinput>> macro or an equivalent, but you can use the (prompt:) macro to do something very similar:
    (set: $name to (prompt: "Enter your name:"))
    

    You can then print the player's name in your story using the variable $name.

    Yes I'm using Harlowe

    Is there a way I can switch over to sugarcube instead of Harlowe? because if there isn't an equivalent macro that's existing right now in Harlowe for the player to type in the game, then is there a way I can switch to be able to use sugarcube?
  • Chapel wrote: »
    We need to know which Story Format you're using in order to help. I'm going to assume you're using Harlowe 1.2.4, which I think is the default for the latest version of Twine, but I unfortunately can't get the latest version to run for me, so I can't check right now.

    In Harlowe, there is is not <<textinput>> macro or an equivalent, but you can use the (prompt:) macro to do something very similar:
    (set: $name to (prompt: "Enter your name:"))
    

    You can then print the player's name in your story using the variable $name.

    Yes I'm using Harlowe

    Is there a way I can switch over to sugarcube instead of Harlowe? because if there isn't an equivalent macro that's existing right now in Harlowe for the player to type in the game, then is there a way I can switch to be able to use sugarcube?

    Nevermind i found a simple HTML format that worked!! <3
  • edited May 2017
    Is there a way I can switch over to sugarcube instead of Harlowe? because if there isn't an equivalent macro that's existing right now in Harlowe for the player to type in the game, then is there a way I can switch to be able to use sugarcube?

    There's a little arrow at the bottom left of the screen, next to your story's file name. Click it to bring up the menu and go to Change Story Format. You'll want to select SugarCube 2.x, not 1.x.

    Depending on how far along you are and how much code you have, you may have to rewrite quite a bit of it, since SugarCube has a completely different syntax from Harlowe. To make a text input in SugarCube 2:
    <<textbox "$name">>
    

    There are some other things you can do to, like set up the text input to forward the user to a new passage when enter is pressed.

    You can check out SugaCube's documentation if you have further questions.
Sign In or Register to comment.