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:
🔴 Syntax
get_rtime ( );
⚪ Parameters
None
🔵 Returns
The elapsed time, in milliseconds, between the main iteration
Main Sectionget_slot
get_slot
returns an int value representing the current active slot of the Cronus Device.
🔴 Syntax
getslot();
⚪ Parameters
None
🔵 Returns
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.
🔴 Syntax
load_slot ( <slot_number> );
⚪ Parameters
<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.
🔵 Returns
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}}
🔴 Syntax
get_ctrlbutton( );
⚪ Parameters
Nothing
🔵 Returns
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.
🔴 Syntax
vm_tctrl( <variable> );
⚪ Parameters
<variable> : Numeric value to add to the Virtual Machine base time. Range -9 ~ 10
🔵 Returns
Nothing
set_polar
Sets the stick output at a given angle and radius with a high resolution value
🔴 Syntax¹ ² ³
set_polar(stick,angle,radius);
⚪ Parameters
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.
🔵 Returns
Nothing
set_rgb
Sets the LED on the ZEN to the supplied RGB color (Red,Green,Blue).
🔴 Syntax¹ ² ³
set_rgb(red,green,blue);
⚪ Parameters
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
🔵 Returns
Nothing
set_hsb
set_hsb sets the LED colors on the Zen eyes or a Playstation controller based on the Hue, Saturation, and Brightness.
🔴 Syntax¹ ² ³
set_hsb( Hue, Saturation, Brightness);
⚪ Parameters
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
🔵 Returns
Nothing
clamp function
The clamp function clamps x to the range [min, max].
🔴 Syntax¹ ² ³
clamp (x, min, max)
⚪ Parameters
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
Returns min if x is less than min, max if x is greater than max, and x otherwise.
Last updated