# sim_restart

Begins the sim restart routine. Also used to cancel the restart routine previously started.

```csharp

smartbotsAPI("sim_restart", ["state", "begin"]); // See "LSL Helper Functions" page for this function
```

```snippet http-api-variables-OmJyUigTgO
```

```snippet http-api-input-basic-parameters-5FcVlaJbq0 action="sim_restart"
```

```snippet http-api-input-q5yvAagqsZ
state | yes      | The restart state:<br>• begin - begin restarting current sim (the restart occurs in 120 seconds)<br>• cancel - stop restarting sim
delay | optional | optional delay before restart, seconds. Default 120, minimum 30, maximum 240.
```

```snippet http-api-output-JAwUcmg7i7
```

# Comments

* You have to teleport bot to the region first.
* To execute this function your bot needs to be an [Estate Manager](http://wiki.secondlife.com/wiki/Estate_Manager).
* You **don't** need a "Sim Governor" bot add-on to use this function.

# Examples

Teleport to DuoLife region and restart it (well, at least try!):

```csharp
// You need to adjust the vars below:
string sbApiKey = "...";
string sbBotName = "...";
string sbBotApiToken = "...";

string myHome = "DuoLife/128/128/20";

// First, teleport to the desired region

string params = llDumpList2String([
  "action="  + "teleport",
  "location=" + llEscapeURL(myHome),
  "apikey="  + llEscapeURL(sbApiKey),
  "botname=" + llEscapeURL(sbBotName),
  "secret="  + llEscapeURL(sbBotApiToken)
  ], "&");
 
llHTTPRequest("https://api.mysmartbots.com/api/bot.html",
  [HTTP_METHOD,"POST"], params);

// Then restart it:
params = llDumpList2String([
  "action="  + "sim_restart",
  "state=" + "begin",
  "location=" + llEscapeURL(myHome),
  "apikey="  + llEscapeURL(sbApiKey),
  "botname=" + llEscapeURL(sbBotName),
  "secret="  + llEscapeURL(sbBotApiToken)
  ], "&");

llHTTPRequest("https://api.mysmartbots.com/api/bot.html",
  [HTTP_METHOD,"POST"], params);
```