Skip to reading
BASIC Scripting

Write text, quotes and comments

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

THE BASIC LANGUAGE

A line of story text often contains punctuation BASIC also uses. A sign that reads “Closed” is a good example.

Code example
FUNCTION Run()
    REM A notice painted on the wall.
    DIM notice = "The sign reads ""Closed""."
    ' Keep the punctuation when adding the second line.
    RETURN notice & "\n" & "Come back at dawn."
END FUNCTION

The outer double quotes mark the start and end of a string. Two double quotes inside that string produce one visible quotation mark. An apostrophe starts a comment outside quoted text. REM at the start of a line also marks an author’s note.

Read the result#

Code example
The sign reads "Closed".
Come back at dawn.

The backslash and n inside the string produce a newline. The ampersand joins the pieces. Keep straight double quotes in code, even if your word processor prefers curly ones.

Keywords and BASIC identifiers are case-insensitive. TRUE and true mean the same thing. Text inside quotes keeps its spelling and capitalization. Copy project IDs and named action fields exactly as shown by the editor.

Page 6 of 86Permalink
Go to page