UI
User interface elements (DIVs, images, etc.).
Availability: Client-only
Methods
- addDIV
- addImage
- getDIVText
- getProp
- getSize
- hideCrosshair
- hideDefault
- moveDIV
- removeDIV
- updateDIV
- updateDIVText
UI.addDIV
client
Add a DIV element to the UI. Returns the element ID.
Signature: str action(str, str, str, str)
Parameters:
| Name | Type | Description |
|---|---|---|
elementId | str | The elementId parameter |
vis | str | The vis parameter |
styl | str | The styl parameter |
parentId | str | The parentId parameter |
Returns: str
str result = GAME.UI.addDIV("value", "value", "value", "value");
UI.addImage
client
Add an image element to the UI using an asset ID
Signature: str action(str, str, bool, str, str)
Parameters:
| Name | Type | Description |
|---|---|---|
assetId | str | The asset ID for the image |
elementId | str | Unique ID for the element |
vis | bool | Whether the element is visible |
styl | str | CSS style string |
parentId | str | Parent element ID (default: 'game') |
Returns: str - The element ID if created successfully
str result = GAME.UI.addImage("value", "value", true, "value", "value");
UI.getDIVText
client
Get the text content of an element
Signature: str action(str)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Element ID |
Returns: str - The text content
str dIVText = GAME.UI.getDIVText(0);
UI.getProp
client
Get a CSS property value from an element
Signature: str action(str, str)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Element ID |
prop | str | CSS property name |
Returns: str - The property value
str prop = GAME.UI.getProp(0, "color");
UI.getSize
client
Get the current window/viewport size
Signature: obj action()
Returns: obj - Object with width and height properties
obj size = GAME.UI.getSize();
UI.hideCrosshair
client
Hide the default game crosshair
Signature: action()
GAME.UI.hideCrosshair();
UI.hideDefault
client
Hide all default game UI elements (health, ammo, etc.)
Signature: action()
GAME.UI.hideDefault();
UI.moveDIV
client
Move a DIV element to a different parent, optionally renaming it
Signature: str action(str, str, str)
Parameters:
| Name | Type | Description |
|---|---|---|
oldId | str | Current element ID |
parentId | str | New parent element ID |
newId | str | Optional new ID for the element |
Returns: str - The element ID after moving
str result = GAME.UI.moveDIV("value", "value", "value");
UI.removeDIV
client
Remove a DIV element from the UI
Signature: action(str)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Element ID to remove |
GAME.UI.removeDIV(0);
UI.updateDIV
client
Update a CSS property on an element
Signature: action(str, str, str)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Element ID |
prop | str | CSS property name |
val | str | New property value |
GAME.UI.updateDIV(0, "color", 100);
UI.updateDIVText
client
Update the text content of an element
Signature: action(str, str)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Element ID |
text | str | New text content |
GAME.UI.updateDIVText(0, "Hello");