Now that we have successfully
Created a New Game, we may as well touch on the first room that it is we see when we start up the game, the Title Screen. At this point we aren't going to get all carried away attempting to get a cycling palette going on in the background or an elaborate cut scene with a rocking theme song, hopefully by the time we have gotten to the end of these tutorials you will be able to manage that all by yourself though. Instead we are going to take it nice and slow and just play with a little bit of text that appears on the screen. We'll also go ahead and show you how to change to a plain black background instead of the Sierra clone that currently shows, and finally we may touch on a bit of the timing of how soon the play/restore/quit dialog window pops up.
Like I said, nothing too major, really it's just a few edits here and there to get us through this. Now, I don't plan to show a screen shot of every single button that I will need you to click. If you don't know what I mean when I say open the Message editor, or open the Script editor then you may really want to take a second and look through some of the help file documentation that Phil put together when he released sciCompanion. He did a ton of work on that alone and I would hate to see it go to waste, or repeat it all... at least not at this point. Instead I want to see you get a game up and running.
Now then, if you remember correctly, this is our starting point. The default title screen.
First let's go ahead and open up the TitleScreen script, number 100, in the Script Editor. Now then, changing out the Sierra logo in the background for the all black picture resource 0. About 20 lines down from the top of the script, you should see this small snippet of code.
(instance rm100 of Room
(properties
picture 100
)
This is simply telling the interpreter, that picture resource 100 is to be used as the background. So when the room loads up, picture 100 is loaded up and drawn. To change this, all we have to do is replace 100 with whatever number it is that we want to use, in this case 000 or 0, same difference as it just comes down to your preference.
(instance rm100 of Room
(properties
picture 000
)
Once we hit the compile button, then the change will take effect, and running our game would show us the black background instead of pic 100. Before we do that though, let's go ahead and adjust the timing that a player has to wait before getting the dialog box to play, restore, or quit. Yes, they can trigger the dialog by clicking the mouse already, but if they don't, there is no reason to just let them stare at a black screen is there.
Further down this same room script, around line 70, you should see an instance of rmScript which includes a changeState method.
(instance rmScript of Script
(properties)
(method (changeState newState &tmp temp0 [temp1 10])
(switch (= state newState)
(0 (= seconds 4))
; Wait 4 seconds before going to the next state.
The changeState method, steps through different case statements until it either comes to the end, or is not told to go forward. Case 0 is by default always the first case statement to be fired off. In this particular instance, the only thing that happens is that it waits 4 seconds and then continues on to case 1 which in this instance, fires off the print statement. This is what we intend to change, lets go ahead and drop that 4 and make it a 2 for now. The line directly below this case statement is a comment, you can either edit it also to tell you that it's a 2 second wait, delete it because case 0 is already pretty self explanatory just from looking at it, or simply ignore it. Personally, I chose to delete that line entirely.
(instance rmScript of Script
(properties)
(method (changeState newState &tmp temp0 [temp1 10])
(switch (= state newState)
(0 (= seconds 2))
Now then, we have changed the background image, changed the timing of when the dialog displays, finally lets change the text that appears in the dialog box. For this we are going to want to look at the Print statement that can be found in case 1 and try to break it down a bit. Really in it's current state, it is kind of a mess. The whole thing is broken up into two Print statements unnecessarily.
(Print
dialog: myDialog
font: gFont
width: 150
mode: alCENTER
addText: N_TITLEMENU V_LOOK 0 4 0 0 0
addText: N_TITLEMENU V_LOOK 0 5 0 10 0
addColorButton: 0 N_TITLEMENU V_LOOK 0 1 0 20 0 0 11 23 5 5 5
addColorButton: 1 N_TITLEMENU V_LOOK 0 2 0 30 0 0 11 23 5 5 5
)
(= temp0
(Print
addColorButton: 2 N_TITLEMENU V_LOOK 0 3 0 40 0 0 11 23 5 5 5
init:
)
)
Before we go any further into this, let's fix this Print statement, it's a bit more confusing than it needs to be and just plain looks sloppy. The two Print statements seen above, actually act like one statement. You will notice that only the bottom Print statement includes the init: command. It is this init: which tells the interpreter that it is time to display the statement on the screen. I am trying to think of the best way to describe this scenario, here goes... The first Print statement loads up all of the properties that it is declaring as well as the text that it includes into a print buffer and then the second Print statement comes along, adding a bit more text to the print buffer before it then tells the print buffer to dump everything and display the contents to the screen. I could think of a couple of scenarios where this would be useful, but in reality, this is not one of them. Before we start editing the text, lets put this Print statement together. The cleaner you can keep your code the better.
(= temp0
(Print
dialog: myDialog
font: gFont
width: 150
mode: alCENTER
addText: N_TITLEMENU V_LOOK 0 4 0 0 0
addText: N_TITLEMENU V_LOOK 0 5 0 10 0
addColorButton: 0 N_TITLEMENU V_LOOK 0 1 0 20 0 0 11 23 5 5 5
addColorButton: 1 N_TITLEMENU V_LOOK 0 2 0 30 0 0 11 23 5 5 5
addColorButton: 2 N_TITLEMENU V_LOOK 0 3 0 40 0 0 11 23 5 5 5
init:
)
)
Alright, now that we have a good looking Print statement to look at, lets focus on the addText lines. Those two lines correspond to the First two lines of the dialog box. The order that the parameters appear are important and they tell the interpreter where to go in order to find the correct text to display. Here is the explanation of which values are currently being set.
addText: Noun Verb Condition Sequence xPosition yPosition resourceNumber
So using that, let's apply it to the first addText line.
addText: N_TITLEMENU V_LOOK 0 4 0 0 0
Tells the interpreter to look for the text that corresponds to the TITLEMENU noun, LOOK verb, 0 Condition, 4 Sequence, offset the X position by 0, offset the Y position by 0, and finally in message resource 0. So with all of that in mind, let's head over to the message editor and see if we can't find the text that it is calling out in resource 0.
With any luck, you were able to locate this. Now then, in order to change the text displayed on your title screen, you simply need to change the text stored in this resource. Likewise, the Subtitle text which is stored in Sequence 5 right next to it. Alter the text however you see fit, click commit and then finally save the resource. For instance I changed the game title to Tutorial Game and the subtitle to The Beginning. With everything committed and saved, let's run our game and see our changes.
And there you have it, we are done here for now. Now let's move on to the next chapter were we will be getting our status bar (the area across the top when the menu bar isn't present) Squared away. Much later in these tutorials, after you have become far more comfortable with everything, we will be readdressing our title screen to include a splash screen, followed by a title screen, followed by an introduction cut scene. But for now, let's carry on to Chapter 3,
Editing the Status Bar.