The item functions provide direct access to GD’s Item Edit and Item Compare triggers. While counters handle most arithmetic at a higher level, these functions let you compose advanced item expressions with full control over types, operators, and modifiers. Item IDs for counters can be retrieved fromDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/g-js-api/G.js/llms.txt
Use this file to discover all available pages before exploring further.
counter.item.
For background context on counters see Counters and Conditions.
Constants Reference
These constants are exported fromgeometry-dash-gjs and used throughout the item API.
Item Type Constants
| Constant | Value | Description |
|---|---|---|
ITEM | 1 | Standard item (pickup, counter) |
TIMER | 2 | Timer item |
POINTS | 3 | Points/score item |
TIME | 4 | Level time |
ATTEMPT | 5 | Attempt number |
Assignment Operator Constants (assign_op)
| Constant | Value | Operation |
|---|---|---|
EQ | 0 | target = expression |
ADD | 1 | target += expression |
SUB | 2 | target -= expression |
MUL | 3 | target *= expression |
DIV | 4 | target /= expression |
Comparison Operator Constants (compare_op)
| Constant | Value | Condition |
|---|---|---|
GREATER | 1 | item1 > item2 |
GREATER_OR_EQ | 2 | item1 >= item2 |
LESS | 3 | item1 < item2 |
LESS_OR_EQ | 4 | item1 <= item2 |
NOT_EQ | 5 | item1 ≠ item2 |
Abs/Neg Constants (absn1, absn2)
| Constant | Value | Effect |
|---|---|---|
ABS | 1 | Take absolute value |
NEG | 2 | Negate the value |
Round/Floor/Ceil Constants (rfc1, rfc2)
| Constant | Value | Effect |
|---|---|---|
RND | 1 | Round to nearest integer |
FLR | 2 | Floor to nearest integer below |
CEI | 3 | Ceil to nearest integer above |
item_edit
Low-level implementation of the GD Item Edit trigger. Computes an expression from two source items and assigns the result to a target item. The formula is roughly:Item ID 1. Retrieve from
counter.item.Item ID 2. Retrieve from
counter.item.Target item ID to write the result into.
Type of item 1. Use
ITEM, TIMER, POINTS, TIME, or ATTEMPT.Type of item 2.
Type of the target item.
Assignment operator applied to the target. Use
EQ, ADD, SUB, MUL, or DIV.Operator combining item1 and item2. Use
ADD, SUB, MUL, or DIV.Operator combining the intermediate result with
mod.Scalar modifier applied via
op2 to the entire expression.Apply
ABS or NEG to item1 before the operation.Apply
ABS or NEG to item2 before the operation.Apply
RND, FLR, or CEI to item1.Apply
RND, FLR, or CEI to item2.GJsObject — call .add() to place the trigger in the level.
You must call
.add() on the returned object for the trigger to be included in the exported level.item_comp
Low-level implementation of the GD Item Compare trigger. Compares two items and calls one of two groups depending on the result.First item ID.
Second item ID.
Type of item 1. Use
ITEM, TIMER, POINTS, TIME, or ATTEMPT.Type of item 2.
Comparison operator. Use
GREATER, GREATER_OR_EQ, LESS, LESS_OR_EQ, or NOT_EQ.Group to call when the comparison is
true.Group to call when the comparison is
false.Modifier for item 1 applied via
op_1.Modifier for item 2 applied via
op_2.Tolerance offset applied to the result.
Operator for
mod_1. Use ADD, SUB, MUL, or DIV.Operator for
mod_2.Apply
ABS or NEG to item 1.Apply
ABS or NEG to item 2.Apply
RND, FLR, or CEI to item 1.Apply
RND, FLR, or CEI to item 2.GJsObject — call .add() to place the trigger in the level.
compare
Higher-level helper that compares two counters and calls the appropriate group without requiring manual type annotations.First counter or item to compare.
Comparison operator. Use
GREATER, GREATER_OR_EQ, LESS, LESS_OR_EQ, or NOT_EQ.Second counter or item to compare.
Group to call when the comparison is true.
Group to call when the comparison is false.