Difference between revisions of "Bot Playground/Events/sit"
From SmartBots Developers Docs
(One intermediate revision by the same user not shown) | |||
Line 10: | Line 10: | ||
{{API Variable|sitting|boolean}} [boolean] true if bot seated on the object, false if it stands | {{API Variable|sitting|boolean}} [boolean] true if bot seated on the object, false if it stands | ||
{{API Variable|object_uuid}} the UUID of the object bot is sitting on. NULL_KEY if bot is standing. | {{API Variable|object_uuid}} the UUID of the object bot is sitting on. NULL_KEY if bot is standing. | ||
− | {{API Variable| | + | {{API Variable|position|object { x, y, z } }} the sitting position (offset). Empty object if ''sitting==false'' |
{{API Variables Table End}} | {{API Variables Table End}} | ||
Line 19: | Line 19: | ||
Bot.on("sit", function(event) { | Bot.on("sit", function(event) { | ||
if(event.sitting) { | if(event.sitting) { | ||
− | + | console.log("I'm sitting on the object ", event.object_uuid); | |
} else { | } else { | ||
console.log("I'm standing now"); | console.log("I'm standing now"); |
Latest revision as of 12:39, 1 March 2017
Fires when bot sits on the object
Bot.on("sit", function(event) { ... });
Reference
This event comes with the following event object:
Variable | Required | Description | |
---|---|---|---|
event object properties: | |||
sitting | boolean | [boolean] true if bot seated on the object, false if it stands | |
object_uuid | the UUID of the object bot is sitting on. NULL_KEY if bot is standing. | ||
position | object { x, y, z } | the sitting position (offset). Empty object if sitting==false |
Example
Bot.on("sit", function(event) {
if(event.sitting) {
console.log("I'm sitting on the object ", event.object_uuid);
} else {
console.log("I'm standing now");
}
});