Skip to content

3.X Beginners Guide

Ava Pek edited this page Feb 27, 2021 · 1 revision

This is the guide for Rumor scripting. If you are a developer interested in integrating Rumor into your project, see the Integrating Rumor guide instead.

Unfortunately, due to the nature that Rumor is only a framework, there is no easy way to try any of the examples in this guide right away. You will either need the assistance of a developer or you will need to integrate Rumor yourself. After Rumor has been integrated into a project, all examples can be saved in a text file and be run by Rumor. The exact process by which a text file is sent to Rumor, so it can be run, depends on how Rumor has been integrated.

Additionally, given the many different ways Rumor can be integrated, any sentence that refers to "input" from the user refers to the method by which Rumor is asked to advance to the next line. In most projects, this input will be a mouse button click, a keyboard button, or a controller button.

General Structure

A Rumor script is a text file that contains commands. Usually, a programmer will load the script from disk and then compile it so it can be run in your game.

Basic Example

say "Alex" "Hello world! The weather seems rather nice today, doesn't it?"

say "Me" "Yeah."

say "I wasn't, in fact, paying attention at all to the weather."

say "Me" "It sure is bright and sunny outside."

say "Alex" "...It's raining. I thought that was your favourite weather?"

This is a basic Rumor script. It contains one of the most commonly-used commands in Rumor: The say command.

There are two versions of the say command. The first is the word say followed by a string (which begins with ", contains text, and ends with ") on a line by itself, which is used for the default character (usually the narrator). The second form has the word say followed by two strings. In this case, the first string is the name of the character and the second string is what that character is saying.

When strings contain " characters, they need have a backslash prefixed to them. For example:

say "Alex" "Were you listening when I said \"The weather seems nice today\"?"

Commands

All commands in Rumor are structured the same way; each starts with a "keyword" and can be followed by a number of arguments. This section will briefly go over default commands that are available to your disposal.

$ (expression)

The expression command starts with $. It executes any expression that follows it.

$ me = "Me"

In this case, you are assigning the value "Me" to the variable me. Rumor will not wait for input from the user before proceeding to the next line.

For more information about expressions and how to use them, see the Expressions page.

say

If you want to say something, use the say command. The say command clears the stage and replaces it with the specified dialog.

say "Hello world!"

In this case, the stage is cleared and replaced it with the dialog "Hello world!". You can also specify a speaker:

$ me = "Me"
say me "Hello world!"

In this case, a speaker along with the dialog they said is added to the stage instead. If you don't specify a speaker, the default speaker is used instead.

add

The add command is like the say command, except it doesn't clear the stage. This can be used two different ways.

You can use it to show two people speaking at the same time.

$ me = "Me"
$ you = "You"
say me "I'm speaking at the same time as you."
add you "Hello!"

When this is executed, the stage will contain the speaker "Me" saying "I'm speaking at the same time as you.", and then it will also contain the speaker "You" saying "Hello!" after input is received from the user.

The add command can also be used to append more dialog to the end of the previous say. This only works if the speaker is the same person.

$ me = "Me"
say me "Hi..."
add me "how are you?"

When this is executed, the stage will contain the speaker "Me" saying "Hi...", and then it will contain the speaker "Me" saying "Hi... how are you?" after input is received from the user.

pause

Sometimes it may be nice to pause execution of the script for a moment before continuing. Pauses don't wait for input from a user.

$ me = "Me"
say me "Hi..."
pause 1
add me "how are you?"

When this is executed, the stage will contain the speaker "Me" saying "Hi...". After input is received from the user, the dialog system will wait for a second before showing the speaker "Me" saying "Hi... how are you?".

choice

The choice command is used to offer the player a choice between several options.

say "What would you like to do?"
choice "Open the closet":
    say "You open the closet."
choice "Go to the living room":
    say "You go to the living room."
choice "Eat an orange":
    say "You eat an orange."

Here, the player sees the dialog "What would you like to do?" right before being offered the choices "Open the closet", "Go to the living room", and "Eat an orange".

If the player chooses "Eat an orange", they will then see the dialog "You eat an orange.". None of the other paths are executed.

Control Flow Commands

Control flow commands are more advanced, but also let you have more interactive scripts.

if, else, and elif

if, else, and elif are conditional commands that can be used to choose different options depending on the value of a variable. For example:

$ foo = 3
if foo < 3:
    say "You don't have enough oranges!"
if foo == 3:
    say "You have just enough oranges."
if foo > 3:
    say "You have too many oranges!"

These conditional commands can also be used to "skip" choices, in addition to many other uses. For example:

choice "I turned away":
    say "I turned away, for I had no money."
if money >= 4:
    choice "I paid 4 coins to enter.":
        money = money - 4 # Sorry I haven't implemented -= yet
        say "I entered the gates to the theme park."
choose

In the above example, the first choice is always added, but the second choice is never added unless the value of money is greater than or equal to 4. If the second choice is not added, the user will never see it.

label

A label is a location in the script that can be jumped to or called (which we are about to cover). Labels are also ways to categorize sections of code. You can add code to a label by indenting it (by either using tabs or spaces -- but pick one and stick with it!). For example:

label start:
    say "Hello world!"
    say "How are you today?"
    say "Do you have the oranges?"

jump

Normally, scripts in rumor execute starting from the top, and proceed line by line until it reaches the bottom. This flow can be altered with a jump statement. The jump command moves execution to whichever label is specified. For example:

label start:
    say "This dialog will never ever end."
    say "Isn't that great?"
    say "We can eat oranges for forever!"
    jump start
    say "This dialog is never seen."

call

A call statement is like a jump, except that it will return to where you used the call command after the label has finished execution. For example:

$ s = "someone"
jump start
label forever:
    say s "This dialog will never ever end."
    say s "Isn't that great?"
    say s "We can eat oranges for- wait, where are you going?"
label start:
    call forever
say "You sigh in relief as you exit that deranged world."

In this example, the Rumor dialog system will first jump to the start label. Then, it will execute the children of the start label, which is the call command. The call command enters the forever label, prints the three lines of dialog in it, and then exits the forever label. Lastly, the Rumor dialog system will exit the start label and then print the last line of dialog.

return

The return statement is used to exit the label early. For example:

label start:
    say "This will be printed."
    return
    say "This will never be printed."
say "This is still printed.

It can also be used to end execution, if used outside of a label

say "This will be printed."
return
say "The dialog has ended before this is printed.

Reference

More commands can also be found in the Command Reference