Howdy, Stranger!

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

Creating a skills string.

So, in the game i am creating, you learn skills from skillbooks found around the world. The problem is that I have no idea how to use strings, and i feel like this is what i'd need to be able to make it, as otherwise i would have to create loads of variables. If you can help in any way, please reply.

Comments

  • So, I'm sure there is a more technical definition, but to the layman a string is just an ordered pair of characters. In other words, text. For example, JavaScript defines strings as one of it's main data types alongside booleans, numbers and so on. If I had an object that represents a person, and that person had a name, then logically I would use a string to represent that property. If it had an age, I could use a number.

    So with that said, I'm not quite sure exactly what your trying to achieve but with the little understanding I do have, whenever you talk about skills and the like, I wouldn't necessarily see any reason you would need to use a string. I'd be more than happy to give some more info, but you'd need to be a little bit more specific.

    Also, it would help if you specified which story header your using, (SugarCane, Johan, SugarCube etc..) because a lot of the time, answers to questions depend specifically on the story header and what macros and features are available to them.
  • Sorry about that. I am using sugar-cane, and the reason I want to use a string would be because of the sheer amount of said skills I want to add in. I don't know what detail more you would want, so if you could please specify that, I would most likely be able to provide. Thanks for your time ;D
  • The issue with your question is that you don't clearly state what it is you're trying to do, so we don't know what information you need to know.

    You don't know how to "use strings"; this is an issue because you want players to learn skills from skillbooks in your game.

    It would be helpful if you provide more detail on what you want to do with skills and skillbooks, the relation between skills, skillbooks, and strings, and what precisely you don't understand about strings that is preventing you from using them.

    All of that said, I will take a guess at what you mean: it seems like you want the names of your variables to be skill names. It's very simple; in Twine, just declare it and name it anything you want, so long as it's prefixed by $. Examples:
    <<set $engineering = 50>>

    <<set $painting to "Novice">>
    <<set $sculpture to "Amateur">>

    note: "=" and "to" are interchangeable
    You can use strings in both the variable name and its value. In both, strings are case-sensitive.
Sign In or Register to comment.