GPC Developer Guides
Functions

Internal Functions

Within this section of the guide, you will find the functions and commands the Virtual Machine uses to handle data in GPC scripts.

BIT Functions

Function

Description

set_bit

Sets one Bit.

clear_bit

Clears one Bit.

test_bit

Tests a Bit.

set_bits

Stores a value into a Bit Index.

get_bits

Gets a value from the Bit Index.

Internal functions for Bit Functions can be found here: Bit Functions

Combo Functions

Function

Description

combo_run

Runs a combo.

combo_running

Checks if a combo is running.

combo_stop

Stops a running combo.

combo_restart

Restarts a running combo.

combo_suspend

Suspends (pauses) a combo.

combo_suspended

Checks if a combo is in the suspended state.

combo_current_step

keywords returning the current step.

combo_step_time_left

the time left of the currently executed step.

combo_stop_all

Stops all combos.

combo_suspend_all

Suspends (pauses) all combos.

combo_resume

Resumes the suspended combo or the already running combo.

combo_resume_all

Resumes all suspended combos.

Internal functions for Combo Functions can be found here: Combo Functions

Math Functions

Function

Description

abs

Returns an absolute value of a number.

inv

Returns the inverse value of a number.

pow

Raise and value to the specified power.

isqrt

Calculates an integer square root.

random

Generates a random value between the specified range.

clamp

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.

min

Gets the minimum of two values.

max

Gets the maximum of two values.

Internal functions for Math Functions can be found here: Math Functions

Device Functions

Function

Description

get_rtime

Returns the elapsed time between main iterations in milliseconds

get_slot

Returns the active slot number.

load_slot

Loads a specified slot.

get_ctrlbutton

Returns the identifier of the controller button.

vm_tctrl

Sets the vm timeout for the next iteration.

set_polar

Sets the stick output at a given angle and radius with a high resolution value.

get_polar

Retrieves the current angle or radius of either the left or right analog stick.

get_ipolar

Retrieves the current unmodified angle or radius of either the left or right analog stick.

set_rgb

Sets the LED on the ZEN to the supplied RGB color.

set_hsb

Sets the LED on the ZEN to the supplied HSB color.

get_info

Detects the state of the MK Profile in use.

Internal functions for Device Functions can be found here: Device Functions

LED Display Functions

Function

Description

pixel_oled

Draws a pixel on the OLED display.

line_oled

Draws a line on the OLED display.

rect_oled

Draws a rectangle on the OLED display.

circle_oled

Draws a circle on the OLED display.

putc_oled

Puts a character into the string buffer for puts_oled.

puts_oled

Draws the characters supplied using putc_oled on the OLED display.

cls_oled

Sets the entire OLED display to a single color.

print

Draws a string on the OLED display.

Internal functions for OLED Display Functions can be found here: OLED Display Functions