SCI1.1 Displaying Basic Print Messages

There are two ways to generate the basic messages which appear on the screen. There are some basic drawbacks and benefits to each one and I will try to explain these to some degree. At this point in the tutorial however, you may not fully appreciate these explanations but after you have been working on your game for a while, I expect that they will make much more sense later.

For the purposes of this tutorial, pretty much these two methods are interchangeable and you can use either to accomplish your means. Lets start with the basic workhorse statements that are going to get you through most of the game.


Creating a Standard Print Message via a Messager



Code: [Select]
(send gTestMessager:say(N_DOOR V_LOOK 0 1)) // Noun Verb  Condition Sequence

With this bit of code, it goes directly to the rooms messages that you created using the message editor. It looks for the Noun, Verb, Condition, and sequence specified and displays just that single message entry. If you have several windows that you would like displayed, one right after the other then simply leave off the final parameter.

For example lets say you made four entries using the verb Look and the noun Door and you want them all to display one right after the other. You would simply use the code below to display them in sequential order, in that it displays sequence number one, followed by two, etc until it has reach the final entry for that noun, verb, condition.

Code: [Select]
(send gTestMessager:say(N_DOOR V_LOOK 0)) // Noun Verb  Condition

Now, something that you can not do. If you have multiple statements that you want to display, you CAN NOT line up this command one after the other. For example, this will not display the statements one after the other, but instead will only display the final statement.

Code: [Select]
(send gTestMessager:say(N_DOOR V_LOOK 0 1)) // Noun Verb  Condition Sequence
(send gTestMessager:say(N_DOOR V_LOOK 0 2)) // Noun Verb  Condition Sequence
(send gTestMessager:say(N_DOOR V_LOOK 0 3)) // Noun Verb  Condition Sequence
(send gTestMessager:say(N_DOOR V_LOOK 0 4)) // Noun Verb  Condition Sequence

Hopefully you are with me so far on this. Let's look at the scenario now where you have something that repeats in multiple rooms. You could probably handle this via setting up a region but that's a little more involved than what we are doing right now. Lets say that we are in a room and we want to use the messages that we already created for room 261 when it comes to interacting with the lights. For that we are going to be using the same statement that we have already been using, except now we will be adding a couple of more parameters to the end of it.

First off though, we will also need to include the message resource from room 261. Up at the top of the script with all of your other include statements.

Code: [Select]
(include "261.shm")

Now our send to messager statement with the extra parameters.

Code: [Select]
(send gTestMessager:say(N_LIGHT V_LOOK 1 2 0 261))// Noun Verb Condition Sequence ?? Script


Creating a Standard Print Message via a Print statement



When using the Print command, we will first need to add the print.sc to our room script before we will be able to utilize it. So, before we do anything else, at the top of your room script with all the other use statements we will also need to use print.

Code: [Select]
(use "Print")

Now then, with that done we are ready to start printing messages to the screen. I have found that this one is pretty nice for making print statements on the fly, but it is highly recommended that you make use of the message resources before releasing your game. Filling you room script with actual text will severely effect your available heap memory. But without further ado, let's demonstrate the syntax.

Code: [Select]
  (Print:
    addText("The message to be displayed")
    init()
  )

or if using the message resources like you should be,

Code: [Select]
(Print:
    addText(N_DOOR V_LOOK 0 1)  // Noun Verb  Condition Sequence
    init()
 )

Pulling in text from a far message resource is pretty much the same as described above for the using the messagers.

Code: [Select]
  (Print:
    addText(4 8 1 1 0 0 261) // Noun Verb Condition Sequence x y Resource
    init()
  )




Creating a Print statement with multiple buttons



Code: [Select]
    (switch
       (Print:
                addTitle("Accept Offer")
                addText("\"Is it a deal?\"")
                addButton(1 " Yes " 5 14)
                addButton(0 " No " 45 14)
                init()
              )
(case 0 (Print:addText("You selected No")init()))
(case 1 (Print:addText("You selected Yes")init()))
    )


Create a Print Statement with selectable Text



Code: [Select]
  (send gGame:setCursor(999 1)) // change Cursor to Arrow  
  (switch
    (Print:
      addTitle("A Title")
      addText("Select something:")
      addColorButton(1 " Yes " 5 14)
      addColorButton(2 " Why " 70 14)
      addColorButton(0 " No " 150 14)
      init()
    )
(case 0 (Print:addText("You selected No")init()))
(case 1 (Print:addText("You selected Yes")init()))
(case 2 (Print:addText("You selected Why")init()))
  )
  (send gGame:setCursor(980 1)) // change cursor to walk