Run Use from an object’s right-click event
Record ID: right_use. Global Script: off. Attach this to the ordinary scene object’s On Right Click pointer event in the Direct-mode recipe.
extends "res://scripts/runtime/script_base.gd"func run(event_context: Dictionary = {}) -> Variant:
var target: String = str(event_context.get("entityId", ""))
if target.is_empty():
return false
Runtime.call("set_verb", "use")
await Runtime.call("execute_selected_verb", target)
return true1. Enable the object’s hotspot and define its Use verb result.
2. Add a Run Script action to its On Right Click event, selecting right_use.
3. Test without an item, then with a selected matching item.
4. Keep the script out of the Use result itself, or it would call the same interaction recursively.
The script expects entityId from a world-object event. It is intentionally not a general “use whatever is under the current pointer” function.
