Get bot status

This script requests a bot’s current status and displays it in local chat.

Place this code in an in-world object and replace the variables at the beginning with your own values.


// IMPORTANT! Paste SmartBots LSL Helper Functions (smartbotsAPI/smartbotsAPIJSON) before saving.

// <= Paste SmartBots LSL Helper Functions here

default {
    state_entry() {
        llOwnerSay("Script initialized");
    }

    touch_start(integer total_number) {
        llOwnerSay("Requesting bot status...");
        smartbotsAPIJSON("status", []);
    }
    
    // Get the SmartBots API reply
    http_response(key request_id, integer status, list metadata, string body) {
        // llOwnerSay("API raw response: " + body);
        
        string status = llJsonGetValue(body, ["status"]);
        string slname = llJsonGetValue(body, ["slname"]);
        string uuid = llJsonGetValue(body, ["uuid"]);
        string location = llJsonGetValue(body, ["location"]);
        
        llOwnerSay("Bot status:\n" + 
            "name: " + slname + " / " + uuid + "\n" +
            "online status: " + status + "\n" +
            "location: " + location
        );
    }
}