Chapter 6. Ryos

Table of Contents

Lua scripting interface

Lua scripting interface

Lua scripts can manipulate the LEDs of supported Ryos keyboards. Supported devices are Ryos MK Pro, Ryos TKL Pro and Ryos MK FX.

To interact with the device the eventhandler defines the table ryos with the following fields to be called from client code. These methods use a color table with keys red, green and blue defined. It's values are integers in the range [0-255].

ryos.EVENT_KEY

Returned by get_event*() methods.

Supported since roccat-tools version 4.0.0

ryos.activate()

Activates effects if allowed. This deactivates the keyboards light settings.

Supported since roccat-tools version 5.0.0

ryos.allowed()

Returns true if effects are allowed to be shown on device, else false.

Supported since roccat-tools version 5.0.0

ryos.are_all_off()

Returns true if all keys are off, else false.

Supported since roccat-tools version 4.0.0

ryos.deactivate()

Deactivates effects. This restores keyboards light settings.

Supported since roccat-tools version 5.0.0

ryos.emulated()

Returns boolean false if script is interacting with actual hardware, true if it's dealing with an emulation like in the devices config tool.

Supported since roccat-tools version 5.1.0

ryos.get_event()

Returns event_type, value1 and value2. If event type is ryos.EVENT_KEY, value1 is an integer indicating the sdk key index, value2 is boolean indicating the action of the event, true if pressed, false if released. This function blocks until an event is available or the stop condition is met. In this case the return value is nil.

Supported since roccat-tools version 4.0.0

ryos.get_event_timed(microseconds)

Returns event_type, value1 and value2. If event type is ryos.EVENT_KEY, value1 is an integer indicating the sdk key index, value2 is boolean indicating the action of the event, true if pressed, false if released. Returns nil if no event occured in @microseconds time, or as soon as the stop condition is met.

Supported since roccat-tools version 4.0.0

ryos.get_key(sdk_key_index)

Gets actual values of a key. Returns boolean representing current key state and a color table for the key represented by @sdk_key_index.

Supported since roccat-tools version 4.0.0

ryos.send()

Sends the current data to the keyboard. This operation takes around 10 milliseconds.

Supported since roccat-tools version 4.0.0

ryos.set_all_states(state)

Sets all keys states to the given boolean @state.

Supported since roccat-tools version 4.0.0

ryos.set_all_colors(color)

Sets all keys colors to the given @color table.

Supported since roccat-tools version 4.0.0

ryos.set_key_color(sdk, color)

Sets single or multiple keys to a single color. @sdk is either a single integer or an array with integer values indicating the sdk key index. @color is a color table.

Supported since roccat-tools version 4.0.0

ryos.set_key_colors(table)

Sets multiple keys to individual colors. @table keys are integers representing sdk key index. @table values are color tables.

Supported since roccat-tools version 4.0.0

ryos.set_key_state(sdk, state)

Sets single or multiple keys to a single state. @sdk is either a single integer or an array with integer values indicating the sdk key index. @state is a boolean indicating if the keys lights should get activated or deactivated.

Supported since roccat-tools version 4.0.0

ryos.set_key_states(table)

Sets multiple keys to indiviual states. @table keys are integers representing sdk key index. @table values are boolean indicating the key state.

Supported since roccat-tools version 4.0.0

ryos.should_stop()

Returns true if the script should exit.

Supported since roccat-tools version 4.0.0

ryos.sleep(microseconds)

Sleeps until @microseconds time passed or the stop condition is met. In this case it returns true. false is returned if time passed fully.

Supported since roccat-tools version 4.0.0

ryos.supports_color()

Returns a boolean indicating if the keyboard supports distinct color settings. At the moment the only device that supports distinct color settings is the Ryos MK FX.

Supported since roccat-tools version 4.0.0

ryos.wait_for_allowance()

Waits until effects are allowed to be shown on the device or the stop condition is met. Returns true if stop condition applies, else false.

Supported since roccat-tools version 5.0.0