DIFF

class DiagMenuSource

Part of Diag menu API definition

Methods 21

static proto bool IsInitialized()

Checks if DiagMenu is initialized

static proto void InitScriptDiags()

To be used before registering scripted diags

static proto void ClearScriptDiags()

To be used when scripted diags should not be present

static proto void RegisterMenu(int id, string name, int parent)

Register a new menu

id
int The unique ID of the menu in the range [0,512]
name
string The name of the menu
parent
int The index of the parent of the menu
static proto void RegisterItem(int id, string shortcut, string name, int parent, string values, func callback = null)

Register a new item

id
int The unique ID of the item in the range [0,512]
shortcut
string The keyboard shortcut of the item
name
string The name of the item
parent
int The index of the parent of the item
values
string The values of the item separated by commas, internally this will be an int starting at 0 for the first item
callback
func Callback to call when the value is changed (OPTIONAL) (Also read BindCallback)
static proto void RegisterBool(int id, string shortcut, string name, int parent, bool reverse = false, func callback = null)

Register a new bool item

id
int The unique ID of the item in the range [0,512]
shortcut
string The keyboard shortcut of the item
name
string The name of the item
parent
string The index of the parent of the item
values
string The values of the item, separated by commas
reverse
bool Whether to reverse the bool (OPTIONAL)
callback
func Callback to call when the value is changed (OPTIONAL) (Also read BindCallback)
NoteThis is just a RegisterItem with value="true,false" or when reversed value="false,true"
static proto void RegisterRange(int id, string shortcut, string name, int parent, string valuenames, func callback = null)

Register a new range item

id
int The unique ID of the item in the range [0,512]
shortcut
string The keyboard shortcut of the item
name
string The name of the item
parent
int The index of the parent of the item
values
string Range specification in format "min,max,startValue,step"
callback
func Callback to call when the value is changed (OPTIONAL) (Also read BindCallback)
static proto void Unregister(int id)

Unregister the item at given id

static proto bool IsRegistered(int id)

Check if the item at given id has been registered

static proto bool BindCallback(int id, func callback)

Bind a callback to the given id

NoteOnly one callback can be registered, so when attempting to registering multiple, only the last one will be present
NoteThe callbacks are required to have one of following signatures - All Register... support: o static void Callback(); - RegisterItem & RegisterBool: o static void Callback(int value); o static void Callback(int value, int id); o static void Callback(bool value); o static void Callback(bool value, int id); - RegisterRange: o static void Callback(float value); o static void Callback(float value, int id); o static void Callback(int value); o static void Callback(int value, int id);
NoteKeep in mind that bool and int are interchangeable, so 'bool value' is possible for RegisterRange too
static proto void UnbindCallback(int id)

Unbind the callback from the given id

static proto bool GetBool(int id, bool reverse = false)

Get value as bool from the given script id

static proto void SetRangeValue(int id, float value)

Set range value at the given script id

static proto int GetEngineValue(int id)

Get value at the given engine id

static proto void SetEngineValue(int id, int value)

Set value at the given engine id

static proto float GetEngineRangeValue(int id)

Get range value at the given engine id

static proto void SetEngineRangeValue(int id, float value)

Set range value at the given engine id