Howdy, Stranger!

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

Character Name Twine 2 Sugarcube 1.03.34

Hey guys, I have a quick question

In my game I want the user to be able to name their character

I have the CSS for the textbox (<<textbox "$name" $name>>), that the character will use to set their name. What would be the CSS for the character's name to be displayed throughout the story?

For example, if I name myself "Bob" in the textbox and then next passage I want it to say "Good job 'Bob'"

Comments

  • edited June 2017
    That isn't CSS, it's a macro. In fact nothing in your question has anything to do with CSS as far as I can tell.

    Your macro doesn't seem well-formed either, it should be:
    <<textbox variable_name default_value [passage_name] [autofocus]>>
    


    Documentation to read for more.


    So you probably want something like:
    <<textbox '$name' '' autofocus>>
    
    [[Link to your next passage.|next passage name]]
    

    Or:
    <<textbox '$name' '' 'next passage name' autofocus>>
    
    [[Link to your next passage.|next passage name]]
    

    Then you can just enter the variable name in a passage to display its value thanks to SugarCube's naked variable markup:
    Good job, $name.
    

    You can also use the <<print>> macro, but you shouldn't need to for anything like this.
  • I see. I'm extremely new to twine and coding so I don't understand all the coding and terminology yet. Thanks for clearing it up

    The naked variable examples cleared everything up. I got this to work, thanks for your help
Sign In or Register to comment.