Using The Print Procedures

The print procedures allow you to print message boxes. These are most commonly used to simply print messages throughout the game, but they are also used for things such as the quit dialog, death dialog, and more! They can do far more than print messages. They can have buttons, title bars and icons. You can set their width, font, coordinates and more!

There are five different print procedures, each with their own purpose. They are Print, IconPrint, EditPrint, GetNumber and FormatPrint. The following examples help to demonstrate their use. Notice that even though these examples show the actual text used, it is highly suggested that you make use of the text resources instead of embedding the actual text in the scripts... It may just save you some serious memory issues later.

Printing a Plain Message
Code: [Select]
(Print {Hello World}) ; using actual text
(Print 23 42) ; would print the text found in text resource 23, line 42


Printing a Message With a Title
Code: [Select]
(Print {Hello World} #title {This is the title!})


Changing the Font
Code: [Select]
(Print
  {Hello World}
  #title {This is the title!}
  #font LARGE_FONT
)


With an Icon
Code: [Select]
(Print
  {Look! It's an icon!}
  #title {An Icon Print!}
  #font LARGE_FONT
  #icon 0 0 0 ; view, loop, cel
)


With Buttons
Code: [Select]
(if (== (Print
  {Do you want to click Yes or No?}
  #title {Click What?}
  #font LARGE_FONT
  #icon 0 0 0
  #button { Yes } 1
  #button { No } 0)
  1)
  (Print {You clicked YES})
else
  (Print {You clicked NO})
)


When specifying the buttons, you give their name, and then their number ID. It then returns the ID of the button clicked. In the example, we check which button was clicked, then display another message box stating which button the player clicked.