rocketscompiler
Core Types
You can control the spacecraft by assigning variables of this type with the :=
operator.
You can control the spacecraft by assigning variables of this type with the :=
operator.
For example, Thrust := 1
sets the engine to full power.
A reaction to some event, such as the start of the game or a part exploding.
A reaction to some event, such as the start of the game or a part exploding.
A block of statements that will be written to the game as a program.
A block of statements that will be written to the game
as a program. Primitive statements of this type, such as activateStage()
to start the engine
or assignment statements such as Thruottle := 1
, are provided by this package.
You can group them in blocks if you explicitly type those blocks as SRProgram
.
For example:
def helloWorld: SRProgram =
displayText("Hello")
waitSeconds(1)
displayText("World")
Under the hood, SRProgram
is a context function which takes the object that
will remember all the expressions meant to be written to the game. If you omit the
type, the compiler will complain that it can't find that object.
Entry Points
Where your program starts.
Use this entrypoint if you have more than one event you'd like to react to.
Use this entrypoint if you have more than one event you'd like to react to. This entrypoint can be useful e.g. if you want to start several programs in parallel at the start of the game. In this situation, you can use it as follows:
callbacks("Foo")(
onStart { program1 },
onStart { program2 }
}
- Value parameters:
- name
the name under which the program will be written to the game.
Autopilot
Possible values for hdg
are Retrograde or Prograde.
Possible values for hdg
are Retrograde or Prograde.
Retrograde means "back" and Prograde means "forward" (technically those directions are
defined by the current velocity vector of the spacecraft).
Control
The program control flow structures specified here are exectued by the game during flight.
Immediately exit the loop where break()
is called from.
Immediately exit the loop where break()
is called from.
Custom variables are not implemented yet in this library, so for the time being there is no way to use
varName
from the forLoop
, and the loop is thus equivalent to repeat
.
Custom variables are not implemented yet in this library, so for the time being there is no way to use
varName
from the forLoop
, and the loop is thus equivalent to repeat
.
Log without displaying to the player.
Log without displaying to the player. Logs can be viewed at the end of the flight.