Difference between revisions of "User:Chaser Zaks/Persistant Bots"

From Second Life Wiki
Jump to navigation Jump to search
(w)
 
(No difference)

Latest revision as of 14:21, 16 April 2019

Persistent bots are bots that will automatically reconnect to Second Life when they are disconnected. This often, unfortunately, includes when they are administratively kicked.

Proper bots should not attempt to reconnect when they receive KickUser from the simulator.

Example message

{
    "KickUser":
    {
        "TargetBlock":
        {
            "TargetIP": "0.0.0.0",
            "TargetPort": 0
        },
        "UserInfo":
        {
            "AgentID": gAgent.getID(),
            "SessionID": gAgent.getSessionID(),
            "Reason": "You have been logged out by an administrator."
        }
    }
}

Example Implementation

class bot:
    def connect(self):
       ...
    def onMessage(self, msg):
        if msg.name == "KickUser":
            self.kicked = True

while True:
    bot.connect()
    if bot.kicked:
        break