BSL:Comments

From OniGalore
Revision as of 23:11, 16 May 2011 by Iritscen (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

How Comments Work

Lines in a BSL script can be "commented out" so they are ignored by Oni at run-time, and thus have no effect on the level logic. These comments can be used to instruct human readers editing the script file. You produce these comments by putting a # symbol as the first character.

Here's a simple example of comment use in a basic "Hello world!" script:

# This is the main function.
func main {
# We're gonna say hello now
    dmsg "Hello, world!"
# We were going to say goodbye, but I've commented that out
#   dmsg "Goodbye"
}

Comments can also be added at the ends of lines of BSL, however you must be using strong syntax, or else it will cause parsing issues with the surrounding code. Do not do this:

func main {
    dmsg "Hello, world!" # This comment will disable the dmsg command on the next line
    dmsg "Goodbye"
}

You can, however, use end-of-line comments safely with strong syntax:

func main {
    dmsg("Hello, world!"); # This comment is safely contained between a semicolon and a newline character
    dmsg("Goodbye");
}

Proper Usage

It's recommended to use comments, but then again not to overuse them. When they actually help the understanding of the script logic, or act as reminders, they're highly welcome.

Here's an "almost overcommented" dialogue script from a manplant cutscene):

# KONOKO  : This is a wild goose chase.
    sound_dialog_play(c02_06_01konoko); sound_dialog_play_block pause

# GRIFFIN : Explain.
    sound_dialog_play(c02_06_02griffin); sound_dialog_play_block pause

# KONOKO  : This whole place. It's a trap. They planted that datapad.
    sound_dialog_play(c02_06_03konoko); sound_dialog_play_block pause

# GRIFFIN : To what end?
    sound_dialog_play(c02_06_04griffin); sound_dialog_play_block pause

# KONOKO  : It's a diversion. It has to be. The syndicate is going to 
#           try something big while my team and I are busy here.
    sound_dialog_play(c02_06_05konoko); sound_dialog_play_block pause

# GRIFFIN : I'll try to confirm your suspicions. Until then, your orders 
#           are unchanged. Find something I can use to shut them down.
    sound_dialog_play(c02_06_06griffin); sound_dialog_play_block pause

# KONOKO  : I'm on it.
    sound_dialog_play(c02_06_07konoko); sound_dialog_play_block pause
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox