Skip to content

Commit 017700f

Browse files
committed
Expand examples tab with title and LifeBots examples
1 parent dd2d107 commit 017700f

1 file changed

Lines changed: 114 additions & 6 deletions

File tree

_tabs/examples.md

Lines changed: 114 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
---
22
layout: post
33
post_style: page
4-
title: Examples
4+
title: LifeBots and Corrade Command and Control Examples
55
icon: fas fa-info-circle
66
toc: true
77
order: 5
88
---
99

10-
# Example Corrade Bot Command Line Control Scripts
10+
## Example LifeBots Control Panel Bot Command and Control Scripts
11+
12+
These LSL scripts provide examples of how to command and control `LifeBots` bots using
13+
the `LifeBots Control Panel` in-world object. The `LifeBots Control Panel` acts as a
14+
bridge between your user script and the `LifeBots` API.
15+
16+
- [Avatar Picks LifeBots Control Panel Example](https://slbotcontrol.github.io/posts/lifebots-control-panel-example-avatar-picks/)
17+
- [Channel Relay LifeBots Control Panel Example](https://slbotcontrol.github.io/posts/lifebots-control-panel-example-channel-relay/)
18+
19+
## Example Corrade Bot Command Line Control Scripts
1120

1221
These `Bash` scripts provide examples of how to automate some simple `Corrade` bot actions.
1322

@@ -19,7 +28,7 @@ name or an alias for the name you have configured.
1928
we are using the `corrade` command. The same command could be run using the `botctrl`
2029
command but it would be `"botctrl -c Easy ..."`, using the `-c Name` instead.
2130

22-
## Get Corrade Bot Outfits
31+
### Get Corrade Bot Outfits
2332

2433
To retrieve a list of a configured Corrade bot's Outfits use the `corrade` command
2534
with the `get_outfits` action.
@@ -41,7 +50,16 @@ else
4150
fi
4251
```
4352

44-
## Wear Corrade Bot Outfit
53+
Example Returned Output:
54+
55+
```
56+
Bikini - Purple
57+
Metallic Blue with Black Boots
58+
Female Party Outfit
59+
Pretty in Pink
60+
```
61+
62+
### Wear Corrade Bot Outfit
4563

4664
To change the outfit of a configured Corrade bot use the `corrade` command
4765
with the `wear_outfit` action.
@@ -75,7 +93,9 @@ else
7593
fi
7694
```
7795

78-
## Get Avatar Pick Description
96+
Example Returned Output: `Outfit change succeeded! We can go out to the club now.`
97+
98+
### Get Avatar Pick Description
7999

80100
To view a pick description of an avatar using a configured Corrade bot,
81101
use the `corrade` command with the `avatar_picks` action to retrieve the avatar's
@@ -123,7 +143,17 @@ else
123143
fi
124144
```
125145

126-
## Get Corrade Bot Position
146+
Example Returned Output:
147+
148+
```
149+
Avatar Missy Restless's pick: "* Inspire Space Park"
150+
151+
Meditate in a cosmic sci-fi natural outer space galaxy built by talented SL artists.
152+
Blast off into the heavens, a universe of magic! Float amidst the stars & planets,
153+
listen to soothing ambient tunes.Affordable land rentals!Moonbase homes too-No Children
154+
```
155+
156+
### Get Corrade Bot Position
127157

128158
To retrieve the position of a configured Corrade bot use the `corrade` command
129159
with the `currentsim` and `selfdata` actions.
@@ -150,3 +180,81 @@ else
150180
corrade -a selfdata -n "${BOT_NAME}" -D SimPosition
151181
fi
152182
```
183+
184+
Example Returned Output:
185+
186+
```
187+
Region: Brightbrook Isle
188+
Coordinates: <36.667843, 71.732635, 21.86871>
189+
```
190+
191+
## Example LifeBots Bot Command Line Control Scripts
192+
193+
These `Bash` scripts provide examples of how to automate some simple `LifeBots` bot actions.
194+
195+
In these examples we specify the bot name as `Anya`, an alias configured in
196+
`~/.botctrl` with `BOT_NAME_Anya="Anya Ordinary"`. Replace `Anya` with your LifeBots bot's
197+
name or an alias for the name you have configured.
198+
199+
### Get LifeBots Bot Outfits
200+
201+
To retrieve a list of a configured `LifeBots` bot's Outfits use the `lifebot` command
202+
with the `get_outfits` action. In this example we specify the bot name as Anya, an
203+
alias configured in ~/.botctrl with BOT_NAME_Anya="Anya Ordinary"
204+
205+
In this example we use the jq JSON parser, if it is available, to filter the returned
206+
JSON, displaying only a list of the outfit names. If jq not available we use grep.
207+
208+
```sh
209+
#!/bin/bash
210+
#
211+
# Replace 'Anya' with your LifeBots bot name or an alias for the name you have configured
212+
BOT_NAME="Anya"
213+
214+
have_jq=$(type -p jq)
215+
if [ "${have_jq}" ]; then
216+
lifebot -a get_outfits -n "${BOT_NAME}" | jq -r '.outfits[].name'
217+
else
218+
lifebot -a get_outfits -n "${BOT_NAME}" | grep name
219+
fi
220+
```
221+
222+
Example Returned Output:
223+
224+
```
225+
Cute Paradisis Ensemble
226+
Blue Leather Bikini
227+
Black Lacey Top & Latex Shorts
228+
Dirty Silks
229+
Sonia Rosalinda White Dress
230+
Vinyl Dress
231+
```
232+
233+
### Get LifeBots Bot Position
234+
235+
To retrieve the position of a configured `LifeBots` bot use the `lifebot` command
236+
with the `bot_location` action. In this example we specify the bot name as Anya,
237+
an alias configured in ~/.botctrl with BOT_NAME_Anya="Anya Ordinary"
238+
239+
```sh
240+
#!/bin/bash
241+
#
242+
# Replace 'Anya' with your LifeBots bot name or an alias for the name you have configured
243+
BOT_NAME="Anya"
244+
245+
debug=
246+
[ "$1" == "-v" ] && debug=1
247+
248+
if [ "${debug}" ]; then
249+
lifebot -a bot_location -n "${BOT_NAME}" -v
250+
else
251+
have_jq=$(type -p jq)
252+
if [ "${have_jq}" ]; then
253+
lifebot -a bot_location -n "${BOT_NAME}" | jq -r '"\(.region), \(.x), \(.y), \(.z)"'
254+
else
255+
lifebot -a bot_location -n "${BOT_NAME}"
256+
fi
257+
fi
258+
```
259+
260+
Example Returned Output: `Brightbrook Isle, 37.84563, 73.68094, 21.880709`

0 commit comments

Comments
 (0)