HotCosmo
Just a guy
- Joined
- Oct 3, 2023
- Posts
- 34
Well, I've been lately having a little writer's block, so I did the second-best thing after writing: create Ink's functionalities.
I present you text_generator(), a tunnel that would make it possible for your player to write some text, like, for example, a name. The code of the functionality is in the next post of this thread (apparently I was exceeding the maximum number of characters
) for you to copy-paste in your story game, but first let's go to look at how it works and how you must use it.
First, you have to declare a global variable called 'text', just like in the next example:
Nothing will work if you don't declare this variable. I recommend declaring it at the start of the game.
Second, call the functionality whenever it's needed in the story:
So this functionality has two parameters:
Third, call the variable with the text of the player whenever it's necessary. Once you have used text_generator(), the variable 'text' contains the text of the player. You can call it using the braces {}:
Although I don't recommend doing it in this way. The reason is simple: you can use text_generator() as many times as you wish, and each time 'text' would be replaced. Imagine that you want the player to not only name his character but also name a pet or a friend or even to make them write some kind of text that you want to reproduce at any moment of the story, like, for example, their favorite food. So my proposal is to create a variable to hold the concrete information and let 'text' be a temporary holder of your player texts, like for example:
I recommend doing some experiments before adding text_generator() to your story game and not using it very frequently or giving the player the option to use it or not (for example, existing a default name if the player doesn't want to typewrite their name. Picking your own name is cool, but maybe a little boring if it's your third time playing the game. Although I try to make the functionality easy to use and simple, it's far slower than, for example, typewriting on a phone or computer.
The functionality only allows you to erase the whole word and restart, not the last character.
The special symbols are the most improvable part of this functionality, so don't be afraid to add symbols that you need. I'm sure once you look at the code, you would have no problem figuring out how to add an extra symbol if you think that some of your players need it.
Well, I hope this functionality can be helpful for all of you. If you have any questions or ideas to improve it, I'm open to any comment.
I present you text_generator(), a tunnel that would make it possible for your player to write some text, like, for example, a name. The code of the functionality is in the next post of this thread (apparently I was exceeding the maximum number of characters
First, you have to declare a global variable called 'text', just like in the next example:
Code:
VAR text = ""
Second, call the functionality whenever it's needed in the story:
Code:
-> text_generator(0, 25)->
- The first one (the zero in the example) is 'esp,' and depending on its value, the player could use spaces and special characters. The player has access to the 26 letters of the Latin alphabet in their uppercase and lowercase forms and with most of their accents (Ä, á, û...). Allowing special characters, the player has access to symbols like Æ, &, $...
- 0: Space and Special Characters blocked
- 1: Space allowed, Special Characters blocked
- 2: Space blocked, Special Characters allowed
- 3: Space and Special Characters allowed
- The second parameter (the 25 in the example) is 'max_char' is the maximum number of characters that you allow the player to use. Be aware that spaces count as a character.
Third, call the variable with the text of the player whenever it's necessary. Once you have used text_generator(), the variable 'text' contains the text of the player. You can call it using the braces {}:
Code:
His name was {text}.
Code:
VAR text = ""
VAR name = ""
-> text_generator(2, 25)->
~ name = text
His name was {name}.
I recommend doing some experiments before adding text_generator() to your story game and not using it very frequently or giving the player the option to use it or not (for example, existing a default name if the player doesn't want to typewrite their name. Picking your own name is cool, but maybe a little boring if it's your third time playing the game. Although I try to make the functionality easy to use and simple, it's far slower than, for example, typewriting on a phone or computer.
The functionality only allows you to erase the whole word and restart, not the last character.
The special symbols are the most improvable part of this functionality, so don't be afraid to add symbols that you need. I'm sure once you look at the code, you would have no problem figuring out how to add an extra symbol if you think that some of your players need it.
Well, I hope this functionality can be helpful for all of you. If you have any questions or ideas to improve it, I'm open to any comment.