pevhs.ch ~/prog/prol/

BSH

BSH The B grade shell syntax

This is a text file containing some informations on the syntax of bsh scripts, and on some commands either internal to bsh, or used by prol.

Basics

A command looks like the following: command arg1 arg2 ... where arg1, arg2, etc. are strings of text separated by spaces or enclosed in single/double quotes. Commands must be followed by a space if other characters must be written after it.

Commands are closed by a newline or a semicolon. Newlines can be escaped with a backslash, which will translate them into a space. Take note that due to a limitation, this space will currently be treated as an escaped char and thus will not be separated into arguments.

Internal commands

By default, bsh only recognises the following commands:

Single and double quotes

Text containing spaces in single or double quotes do not get separated in arguments. Additionnaly:

Parentheses

Commands can receive input from other commands if the latter ones are between parentheses: foo (bar) (baz) will translate into foo result of bar result of baz

Prol specific commands

Those are commands used by prol on top of bsh. The commands are:

echo string
Prints the following string.
mdladd modelname shaderid texid
Create a new model modelname using the shader shid and texture texid.
Prints: the id of the spawned model, or -1 on error.
Returns: same thing in integer format.
mdlpos mid x y z
Positions the model mid at pos x, y, z.
Returns: 0, -1 on error.
exec path/to/script
Executes the script located at path/to/script.
Returns: the result of the last command in the script, or -1 on error.
return res
Returns the integer res. This command doesn't actually quit the script.
?
Prints the return value of the previous command.
fov val
Sets the fov to val.
bind key command
Binds key to the given command. If prepended by a '+', the command is executed on each keypress, otherwise it is executed constantly while the key is pressed.
Returns: 0, -1 on error.
movefront, moveback, moveleft, moveright, moveup, movedown
Moves the player.
quit
Sends the exit signal to the program.
playerpos
Prints the player's current coordinates in x y z format.