Post by BusterTheFox on Jul 6, 2012 5:43:13 GMT -8
As us Creators strive to make Stagecast games that come closer and closer to the quality of commercial games, we innovate and create new techniques and systems for not only making things look better, but also for making things easier on the Creator him or herself. One thing I've always wanted to do was to create a game with a perfectly functioning text system, like you would see in an RPG. Of course, just about EVERY game these days has some type of text system; Sometimes they're just subtitles for the voice acting. Other times, the text system displays every single line of speech in the game! The point is, text in video games has been around since even before the 8-bit days. Why shouldn't Stagecast have a method for this as well?
Of course, it's just begging to have one created for it; Stagecast even comes with a specialized "Text" character! Pair that with the text functions located within the Calculator app and you've got a recipe for success. Needless to say, this tutorial will be utilizing both of these features!
OLD VERSIONS:
I've spent a lot of time getting this system to where it is today. It all started with a basic idea.
Ver. 0.0 - The original idea; have a character with a different appearance for each and every letter of the alphabet. Have pictures for punctuation such as commas, periods, exclamation points, etc. Have a large box-shaped character to act as the "text box". Display each character one-by-one via rules.
PROBLEMS:
The biggest problem with using this system was the fact if you made a typo, you would have to completely re-make the rule from scratch. And if you had another rule after that one, you would have to remake that one, as well. Not to mention you would run out of space VERY quickly. Punctuation was a huge mess; It just looked BAD.
Ver. 1.0 - Use the Text character to display text and use Global variables for storing the actual text. Press space, the text poofs in there. Depend on what text was in the text box to know which text to display next. Worked MUCH better than the sprite idea, but still was by no means perfect.
PROBLEMS:
While this system made the execution look better and made it MUCH easier to create and display text, it shared most of the problems its counterpart had. Because it relied upon what text was in the text box for deciding what text to display next, it nulled out the possibility of being able to edit the text if you made a mistake or wanted to change it for any reason. On top of that, a new problem sprang up; because the text was displayed instantly, a player could easily accidentally press Space twice and skip right by an important block of text. It was no good.
Ver. 2.0 - Use the text calculator to display text one word at a time from the global variable, based upon what the Display variable said. I don't remember a lot of specifics, but I'm pretty sure it's almost exactly the same as version 3.
PROBLEMS: This was the first solid version of the text system I ever created. It would display the text word by word into the text box. Considering words differ in size from one to another, it looked pretty weird, but it still worked pretty darn well. Of course, the biggest trade-off was that this system made it MUCH harder for the Creator to actually display the text. The was because it used all kinds of complex calculations to get the text to display just right. If you got even one little thing wrong, you would have to re-do it; and that was for every rule. Oh, but I changed it to depend on Display instead of what text was in the text box when displaying new text, so it made it easy to edit text.
Ver. 3.0 - Use the text box to display text. Store text blocks in separate Global variables. Use a Display variable to tell the text box what to display next. Use the text calculator to display a Global variable character by character depending on what was in display.
PROBLEMS:
For a long time, I could see no better system than this. It was the same thing as version 2.0; The only difference was that it displayed the text one letter at a time, so it looked a LOT better. As such, it was rather complex to use.
Ver. 4.0 - The current text system! I came across this one day while making a specialized text system for NPCs in Stick RPG 2. Basically, each NPC had a personal variable titled "Text". When you pressed space next to an NPC, it would copy that text into another Global variable titled, "TempText". That served as a temporary location for the text to be stored. Then, as long as display wasn't "-" (meaning if it said 5, 99, or simply NPC), it would display what was in that variable. It worked out in such a way that I didn't need any new rules after I made the originals; Every NPC worked the same way. Eventually, I realized that I could use that exact same system for displaying ALL text, not just NPC text. So, here it is; my most simple and easy-to-edit text system to date!
tl;dr: I make a bunch of updates to this text system but this is the best, KTHX.
OKAAAY! Now, let's get started! Here's a few pre-tutorial steps to take:
1. Start a New Sim.
2. Enter Global Variables
3. Create a "TextTemp" variable. Leave it empty.
4. Create a "Text1" variable. Enter whatever message you want in there.
5. Create a "Text2" variable. Enter another message in here.
6. Create a "Display" variable. Put "-" into its value.
7. Grab a text box from the Special drawer and stretch it across the stage however you like.
There's no need to create any actual characters. We'll be putting all of our rules on the Text Box you just stretched across the stage.
Okay! Start by making a rule on your text box. The first thing we want to do is tell the game that it's time to display some text. Now is a good time to choose an "Action Button"; for this tutorial, let's use the Space Bar. Now, for the first rule, do the following:
IF:
'Display' is '-'
'Space' is pressed
'TempText' is '(empty)'
THEN:
Put '1' into 'Display'
Put 'Text1' into 'TempText'
REVIEW: What this rules says is basically: If no text is being displayed and the players hits the Action Button, then display the first block of text. For those of you who may notice, I like to include the TempText part in the IF side for an extra layer of bug-protection. Saves me the trouble of editing later on if something pops up.
Now then, at this point, you're ready to display the text, but you obviously haven't made the rules for doing that yet. So, let's do that now! Make sure you follow along closely, because this is the complicated part. Make another rule on your text box:
IF:
'Display' is not '-'
'TempText' is NOT '(empty)'
THEN:
Put (Calculation) into (The text box's text)
Put (Calculation) into 'TempText'
Okay! To create those calculations, first go into the "Then" side of the Rule Maker. Next, click on the calculator icon at the top of the window.
First things first; Click on the yellow tab at the right side of the calc window to open up the full interface. Then, hit the "Text" button located to the left of the calc window.
THE FIRST CALCULATION:
- Take your "TempText" variable and drag it into the Calculator's 'screen'. You should see your text appear there.
- Next, Go into the new window you opened when you clicked on the Text button. Click on the "Char. #" button.
- Click on the "1" in the calculator interface.
- Click on the "=" button.
*THIS SHOULD GIVE YOU THE FIRST LETTER OF YOUR MESSAGE. FOR INSTANCE, IF YOU TYPED IN, "This is my message.", THE CALCULATOR SHOULD NOW BE DISPLAYING, "T".*
- Open up the Text Box's variables and find the "Text" variable. Drag that into the calculator as well.
- Go back to the Text functions and click on "Append Chars."
- Finally, drag the result of the last calculation into the calculator's window (The "T" from "This is my message").
- Drag the Calculator window into the first part of the rule!
- Go back into the Text Box's variables and put the "Text" variable into the second half of the rule.
DONE! The first letter of your message should now be displayed in the text box.
REVIEW: This calculation works by taking the first character of the TempText variable and putting it into the Text Box. Of course, by itself, it'll just keep on putting the first letter of your message into the text box. This is why we need the SECOND calculation!
THE SECOND CALCULATION:
- Open the calculator the same way as before, opening the yellow tab and the Text options.
- Drag "TempText" into the calculator.
- In the Text options, select "Remove Char. #"
- On the main interface, click on "1".
- Click on the "=" button.
- Drag the finished calculation into the first half of the rule!
- Drag TempText into the second half of the rule.
Congratulations! Hit Done and finish the rule. Now, press play! If you were able to follow the instructions correctly, you should now see your message scrolling in your text box! Looks good, doesn't it?
REVIEW: Why the second calculation? Well, as I mentioned above, with only the first calculation, the rule would just keep on displaying "T" forever, right? What the second calculation does is remove that first character from the TempText variable; This way, the next time the rule looks at the first calculation, it'll read the first character again, but this time the first character will be "h", which was originally part of "This is my message". Every time it does this, it removes the first character from the variable. This creates the effect of the text scrolling in letter by letter.
Now then, what about the second text block? It's time to learn how easy it is to work this text system!
It's time for a new rule. Throw it onto the text box and get cracking:
IF:
'Display' is '1'
'TempText' is '(empty)'
The 'Space' key is pressed
THEN:
Put '(empty)' into 'Text'
Put '2' into 'Display'
Put 'Text2' into 'TempText'
REVIEW: For this system, Display has two functions:
1. Telling when text is to be displayed
2. Telling the game which text block to load next when the Action Button is pressed.
In this case, when Display was "1", the next block to be displayed was "2". So, you tell the game to load it up!
TempText has to be empty or the player could press Space while the text is still displaying. This could be bad since the player might accidentally press Space twice without thinking and skip the whole thing. Regardless of whether or not you understand why, I highly recommend that you include this in your rule.
Anyway, hit Play again! TA-DA~! Now your second block of text is displaying! Try pressing Space. Nothing should happen!
Finally, let's make on last rule to make your text demonstration 100% workable.
IF:
'Display' is '2'
'TempText' is '(empty)'
The 'Space' key is pressed
THEN:
Put '(empty)' into Text
Put '-' into Display'
This'll set it all back to the beginning; you have a rule already to deal with space being pressed while Display is set to "-". According to your rule that displays the text, nothing will be displayed as long as Display is set to "-". Go ahead, type something into TempText! It's perfectly stable. Change Display to anything else and that text WILL begin to display, however, so be careful!
Well, that about explains it all! There are many possibilities within this text system. For instance, you could display the player's name, along with changing things to "him" or "her" depending on the player's gender. How you allow the player to type in that information will have to be saved for another topic, though.
NOTE: Stagecast seems to use its own version of the three fonts you're allowed to use. It doesn't support many special characters, such as ♥. Basically, if you need the Alt key to type it, chances are it'll show up as "?" in the text box. Some of them, such as ©, do work, however.
NOTE: Something interesting to note is that when you press the Tab key, it actually types an invisible character there. Not like a space or anything, but just an invisible character. If you hit back space on it, it'll go away. It's not worth using, though, because if the TAB character is anywhere in the text box, it breaks the Word Wrapping feature for some reason.
NOTE: If you type your text within the actual text box, it's possible to include line breaks within your Text variables. Line Breaks will show up as "[]" (a square) in the actual variable. Just be careful if you're using them at the beginning or end of your text block, because they tend to disappear if they're not surrounded by other characters.
NOTE: You can use a series of spaces to make it look like the text has paused for a moment. Works best after a sentence and before a Line Break. As noted above, do NOT use the TAB character for this because the text's formatting will get messed up!
Have fun! And remember to keep the subject of your text at PG-13 level if you plan to post your game here!