SCI Studio Tutorial Chapter 14 - Making The Title Screen

From SCI Wiki
Jump to: navigation, search

We will now begin the script programming! To start, we will customize the title screen.

Getting Started

Open the game and the Game Explorer will load. It will show a list of the game's resources.

Script folder

Click on the script folder and the list of scripts in your game will appear on the right, along with a preview of the first script.


Title screen

Double click the script named "TitleScreen", and the script editor will open up. TitleScreen is the script containing the code base to create your title screen.

The Script Editor

Script Editor

Start by scrolling down to the TitleScreen instance. It is the first instance in the script.

We will now begin customizing the title screen.

The TitleScreen instance, derrived from the Rm (room) class is where the title screen's execution begins. The init() method is the first code block which is executed.

Intro script

Scroll down to the bottom of the init() method until you find the "Display" function. This the a kernel function which displays text on the screen.

This code draws the text "Intro/Opening Screen" to the screen at the coordinates (90,80) in white, with a transparent background.

Begin by changing the text from "Intro/Opening Screen" to "Tutorial Quest".

Compile and run

Click the "Compile and Run" button. This compiles the code (converts it from the text you type into binary SCI program code). You will see your brand new title screen! Continue to the next game screen and select "File"->"Quit" from the menu. You will return to SCI Studio.

That wasn't so hard now, was it?

The first dsCOORD parameter is the X value. It can be any number from 0 to 319, and specifies how much from the left of the screen the text will be. The second is the Y value. It can be any number from 0 to 189, and specifies how much from the top of the screen the text will be.

The dsCOLOR paramater specifes the color to use for printing the text. It can be one of 17 different values, defined in SCI.SH as follows:

clBLACK, clNAVY, clGREEN, clTEAL, clMAROON, clPURPLE, clBROWN, clSILVER, clGREY, clBLUE, clLIME, clCYAN, clRED, clFUCHSIA, clYELLOW, clWHITE or clTRANSPARENT.

The dsBACKGROUND operates identical to dsCOLOR, except it specifies the color to use for the background of the text instead of the foreground.

The next step will be to add another Display() call to your title screen to print the text "By <your name>". Set up it's colors and coordinates appropriately. You can adjust the colors and coordinates for the first Display() call as well.

Finished script

When done, your code will look something like this.


Compile and run

Click the "Compile and Run" button and you will see your new title screen.

Your finished title screen will look something like this:  
Finished title screen

InfoFor further reading, take a look at the documentation for the Display() function section from the SCI Studio Help File. You will find information on it's other parameters, enabling you to do things such as setting the text's font, and text alignment.

The title screen is now done. In the next chapter, you will learn about scripting the first room!

 

< Previous: Chapter 13 - Conditional and Looping StatementsNext: Chapter 15 - Programming The First Room >