SmartBots (SmartBots2Life)

Second Life group direct invitation bots


Support Managers

Rehnaeaislinn online
Brimstone Firehawk offline
show offline managers
English, German, Japanese, Russian

http_query (SBSL Command)

Have a question? Ask at SmartBots DevPortal!

DevPortal is a blog and forum for developers. Ask your questions to get a prompt reply!

Continue to DevPortal

Does HTTP POST request to a specific URL and returns a reply.

Very flexible command which allows easily extending your bot's functionality to no limits.



Command parameters

The following table explain the entries of the command:

Entry Description
URL the URL to call
QUERY-PARAMS URL-encoded values to post to the URL. Looks like a usual query string: action=check&item=XXX (without quotes)

Return value

The command waits for a reply from the URL and puts this reply to $http_reply variable. This value can be used in subsequent commands.


This command is very useful when you need to extend the bot's functionality using PHP, Perl or any other script.

SBSL interpreter calls the given URL using a POST request. The query string must be properly encoded.

Passing SBSL variables to the URL

http_query parameters does not accept any variables (thus, you can't write "action=check&uuid=$speaker_uuid").

Instead, all event variables (like $speaker_uuid, $message and others) are automatically added to the query params, you don't need to pass them manually.

For example, this call

instant_message {
  http_query action=check&item=123

passes the following variables to your HTTP script:

  • Vars from your query params:
    • action: check
    • item: 123
  • Event vars:
    • speaker_type: the value of event's $speaker_type variable
    • speaker_name: equals to $speaker_name
    • speaker_uuid: equals to $speaker_uuid
    • message: equals to $message
  • System vars:
    • bot_slname: the name of the bot

Controlling your bot from HTTP script

You may use HTTP API functions to control your bot from the web script invoked by http_query.

See the examples for more info.


Gives resident a notecard (or whatever else) when resident starts talking with bot:

start_typing {
  # Check if we know this resident. We pass "action=check", and other
  # event variables will be added automatically.
  http_query action=check
  # Processor returns NEW if we don't know this resident
  if $http_reply == NEW
    im $speaker_uuid Hello $speaker_name! Please read our rules.
    give_inventory $speaker_uuid 3b65a122-8f77-64fe-5b2a-225d4c490d9c
    # Save this resident's visit
    http_query action=save
    im $speaker_uuid Hello $speaker_name! Nice to meet you again!

<< return back to SBSL commands

Questions, wishes and discussion