Skip to content

4.3 Misc functions

Davide Magni edited this page Sep 29, 2017 · 7 revisions

timer()

This function returns a text with the current KSP time. The function is based on KSP_TIMER. This is NOT an inline function, therefore it needs to be loaded inside a variable before being able to process it.

The function returns a time in format hh:mm:ss:ms.

WARNING: it's important to include the brackets () while using the function!

WARNING: timer() is 20+ lines long, so be aware that your script will become longer by using this function.

timer()

Example:

@current_time := timer()

search_ctrl_number

Useful when you need to retrieve the number of an UI control by knowing its UI ID. The number of an UI control is linked to the order of declaration of the UI controls. It is one-based. The number of a UI control is also shown in the UI debugger inside "Ctrl Num" label.

search_ctrl_number(<ui_id>)

  • ui_id UI ID of the desired UI control.

search_ctrl_id

Opposite of search_ctrl_number. By feeding this function with the number of the UI control, you can get the UI ID of that control. Useful, for instance, if you need to load an array with all the UI IDs of the controls.

search_ctrl_id(<ctrl_num>)

  • ctrl_num Number of the desired UI control.

break and break_downto

These functions can be used to softly terminate an ongoing loop by setting its counter out of the range of the loop itself. break is used if the counter is incremental (e.g. while using the syntax for count := 0 to 100), while break_downto is used if the counter is decremental (e.g. while using the syntax for count := 15 downto 0).

To be used in loops only!

break(<counter>) break_downto(<counter>)

  • counter Name of the variable used as counter for the loop.

HOST_BPM and HOST_BPM_FLOAT

These functions return the current host tempo. They are inline functions, so they may be used for inline operations. HOST_BPM_FLOAT is available in Kontakt 5.6 and greater only.

HOST_BPM HOST_BPM_FLOAT

Clone this wiki locally