Device Functions
Here we will cover a few functions available within your code, these functions
Function
Description
Zen
Plus
Returns the elapsed time between main iterations in milliseconds
✔️
✔️
Returns the active slot number
✔️
✔️
Loads a specified slot
✔️
✔️
Returns the identifier of the controller button
✔️
✔️
Sets the vm timeout for the next iteration
✔️
✔️
Sets the stick output at a given angle and radius with a high resolution value
✔️
❌
Sets the LED on the ZEN to the supplied RGB color
✔️
❌
Sets the LED on the ZEN to the supplied HSB color
✔️
❌
The clamp() function clamps a value between an upper and lower bound. clamp() enables selecting a middle value within a range of values between a defined minimum and maximum. It takes three parameters: a minimum value, a preferred value, and a maximum allowed value.
✔️
❌
get_rtime
get_rtime
returns the elapsed time between the current and previous iteration of the main function. The value returned is in milliseconds.
You can see this function in action by using this counter script:
get_rtime ( );
None
The elapsed time, in milliseconds, between the main iteration
get_slot
get_slot
returns an int value representing the current active slot of the Cronus Device.
getslot();
None
An int value representing the current active slot of the Cronus Device.
load_slot
load_slot
will attempt to load the slot number specified within its parameter. If there is no script current stored in the specified slot, then it will unload the current slot and load slot 0 of the device.
load_slot ( <slot_number> );
<slot_number> : A value which represents a slot number to load with a range of 0 - 9 on Cronus MAX Plus or 0 - 8 on Cronus ZEN.
Nothing
get_ctrlbutton
get_ctrlbutton
returns the current control button. The control button is set in the Device tab within Cronus PRO's Options window or the Device Tab of the Cronus Zen. The enable remote control switch on device dictates which button it is set to
{{IMAGE PLACEHOLDER}}
get_ctrlbutton( );
Nothing
Depending on the remote slot settings the value can be 0, 1 or 8.
vm_tctrl
Sets the virtual machine timeout for the next iteration. By default, the virtual machine runs the main loop every 10 milliseconds as it aids stability. You can however adjust how often each main iteration is run. Just be aware than changing this setting may cause instability within your script.
vm_tctrl( <variable> );
<variable> : Numeric value to add to the Virtual Machine base time. Range -9 ~ 10
Nothing
set_polar
Sets the stick output at a given angle and radius with a high resolution value
set_polar(stick,angle,radius);
stick: defined stick (POLAR_LS or POLAR_RS).
angle: index point of the bit to be set with a range of 0 to 359.
radius: index point of the bit to be set with a range of -32768 to 32767.
Nothing
set_rgb
Sets the LED on the ZEN to the supplied RGB color (Red,Green,Blue).
set_rgb(red,green,blue);
red: index point of the bit to be set with a range of 0 - 255
green: index point of the bit to be set with a range of 0 - 255
blue: index point of the bit to be set with a range of 0 - 255
Nothing
set_hsb
set_hsb sets the LED colors on the Zen eyes or a Playstation controller based on the Hue, Saturation, and Brightness.
set_hsb( Hue, Saturation, Brightness);
hue: index point of the bit to be set with a range of 0 - 359
saturation: index point of the bit to be set with a range of 0 - 100
brightness: index point of the bit to be set with a range of 0 - 100
Nothing
clamp function
The clamp function clamps x to the range [min, max].
clamp (x, min, max)
x — The number to clamp.
min — Lower bound of range to which x is clamped. Minimum value returned.
max— Upper bound of range to which x is clamped. Maximum value returned.
Returns min if x is less than min, max if x is greater than max, and x otherwise.
Last updated