alisp:frontierspace_operators
This is an old revision of the document!
Table of Contents
Special FrontierSpace Math Operators
There are several ALisp built-in operators that work with the FrontierSpace engine. These are further categorized as follows:
ALisp Boolean Operators
not - returns the boolean opposite of its one argument ! - alias for not eq? - returns whether its arguments are the same object equal? - returns whether or not its arguments are all equal = - alias for equal? != - equivalent of applying not to equal? > - returns whether its arguments are in strictly descending order >= - returns whether its arguments are in descending order < - returns whether its arguments are in strictly ascending order <= - returns whether its arguments are in ascending order xor - returns whether exactly one of its arguments is true; evaluates only enough arguments from left to right to determine its result
ALisp Miscellaneous Operators
and - returns #f if any of its arguments is false, or its last argument if all of them are true; evaluates only enough arguments from left to right to determine its result or - returns #f if all of its arguments are false, or the first one that is true; evaluates only enough arguments from left to right to determine its result apply - applies its first argument to the list of arguments given as its second argument eval - evaluates its argument quote - returns its single argument unevaluated define - sets the global variable named by its first argument to equal its optional second argument or #U if not given declare - ensures that the global variable named by its first argument exists and, if it has no value, sets the value its optional second argument or #U if not given; does not change existing values set - changes the value of the local variable named by its first argument to equal its second argument undefine - removes the global variable named by its single argument lambda - see the topic 'ALisp lambda' macro - see the topic 'ALisp macro' cond - see the topic 'ALisp cond' let - see the topic 'ALisp let' let* - see the topic 'ALisp letstar' throw - see the topic 'ALisp Exceptions' catch - see the topic 'ALisp Exceptions' make-error - see the topic 'ALisp Exceptions' error-name - see the topic 'ALisp Exceptions' compile - compile the closure given as its first argument, optionally giving the symbol passed as the second argument as the compiled closure's name; returns the compiled closure disassemble - returns a list of the assembly instructions that make up the body of the compiled closure passed as its first argument
ALisp Math Operators
integer? - returns whether or not its argument is an integer float? - returns whether or not its argument is a floating-point number number? - returns whether or not its argument is any type of number + - returns the sum of all its arguments - - returns its first argument minus all its other arguments * - returns the product of all its arguments / - returns its first argument divided by all its other arguments % - return the remainder of dividing its first argument by its second sqrt - returns the square root of its argument max - returns the maximum of all of its arguments min - returns the minimum of all of its arguments cos - returns the cosine of its argument, given in radians sin - returns the sine of its argument, given in radians tan - returns the tangent of its argument, given in radians acos - returns the arccosine of its argument in radians asin - returns the arcsine of its argument in radians atan - returns the arctangent of its argument in radians
Space Informational Operators
space:name - returns the name of the hull space:hull-name - returns the alias of the hull space:coords - returns the coordinates of the hull space:heading - returns the heading the hull is facing as a vector of the form #(bearing mark) space:desired-heading - returns the desired heading in the same form that space:heading uses, setting the desired heading if it receives an argument that is a two-element vector of numbers space:docking-ports - returns an associative list with keys corresponding to docking port numbers and values indicating the hull that is docked on each port or #f if no hull is space:docking-door - returns a string representing the status of the docking door; one of "Open", "Closed", "Opening", "Closing", or "Not Present" space:open-door - opens the docking door space:close-door - closes the docking door space:docked - returns #f if not docked or a pair of the form (hull . port-number) indicating where the hull is docked space:landed - returns #f if not landed or the name of the hull where the current hull is landed space:linked - returns an associative list with keys corresponding to link point numbers and values indicating the hull that is linked to each point or #f if no hull is space:power - returns a vector of power availability and usage from the last update: #(main batt comp repair prop charge) Main and batt are the main and battery power pool availability, respectively; comp is the amount that was used by components on the hull; repair is the amount that was used for repairs; prop is the amount used for propulsion; and charge is the amount used to charge batteries. space:repair-crews - returns a list of repair crews on the ship, each as a list of the form (capacity efficiency men assignment) space:accel - return the current available acceleration in m/s^2 space:speed - return the current speed in m/s space:at-warp - return #t if at warp, #f otherwise space:warp-factor - return the current warp factor space:mass - return the current total mass of the ship space:visibility - return the current visibility of the ship space:transponder - return #t if the transponder is active, #f otherwise; if an argument is given, set the transponder status first space:transponder-code - return the ship's full transponder code space:can-land - return #t if the hull can land; #f otherwise space:can-launch - return #t if the hull can launch; #f otherwise space:hatch - return #t if the hatch is open, #f if closed space:open-hatch - open the hatch space:close-hatch - close the hatch space:integrity - return a list of (current max) hull integrity space:mount-point-flags - return a list of strings naming the flags that the named mount point has set
Space Action Operators
space:undock - causes the hull to undock, returning a boolean success value space:launch - causes the hull to launch along the heading given as a 2- or 3-element vector argument space:unlink - causes the hull to unlink on the given numeric link point, returning a boolean success value space:assign - assigns the numeric repair crew given by its first argument to the mount point given by name as its second argument; "Hull" is a valid second argument space:trigger - triggers all devices on the hull and all linked hulls, executing the callback named by its first argument with the rest of its arguments as arguments to the callback (see 'Space Devices' for more information)
Space Component Operators
space:mount-points - returns an associative list with string keys representing the names of mount points and values of #f for empty mount points or of type component for occupied mount points space:get-component - return a component object by mount point name space:mount-point-name - return the name of the mount point the given component occupies space:destroyed - return #t if the component is destroyed; #f otherwise space:disabled - return #t if the component has been temporarily disabled; #f otherwise space:type - returns a string representing the type of the component given as its argument space:settings - returns a list of settings available on the component given as its argument space:get-setting - returns a setting object from the component given as the first argument, named by the second argument space:setting-name - returns a string representing the name of the setting given as its argument space:setting-readonly? - returns #t if the setting is read-only or #f if it can be changed space:setting-units - returns a string naming the units in which the given setting is specified space:setting - returns a list of the form (min max current) if given one argument or a boolean success value of setting the setting to its second argument if present space:commands - returns a list of commands available on the component given as its argument space:get-command - returns a command object from the component given as the first argument, named by the second argument space:command-name - returns a string representing the name of the command given as its argument space:command - activates the command given as its first argument, passing any additional arguments to the command and returning the result of the command
Space Commodity Operators
space:get-commodity - return a commodity object from the given commodity number space:commodity-name - returns the name of the commodity given as its first argument space:commodity-unit-name - returns the name of the unit of the commodity, in singular form if the second argument is not present, is equal to #f, or is equal to 1 and in plural form if the second argument is equal to #t or any number other than 1 space:commodity-mass - returns the mass per unit of the commodity, in kilograms per unit space:commodity-volume - returns the volume per unit of the commodity, in cubic meters per unit space:commodity-volatile? - returns a boolean value telling whether the commodity is volatile space:commodity-explosive-yield - returns the potential energy of the commodity if it is volatile and left uncontained, in kilojoules per unit
Space Callback Operators
alisp/frontierspace_operators.1292552787.txt.gz · Last modified: 2018/06/23 00:30 (external edit)