Aw botmenu send

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 4.1
SDKbuild 53


int aw_botmenu_send (void)

Description

Sends a list of menu items to be shown in the browser when right-clicking the bot.

Callback

AW_CALLBACK_BOTMENU_RESULT

Notes

AW_BOTMENU_QUESTION is a string containing space-delimited line numbers corresponding to lines in a botmenu file. Browsers will download this file from an URL specified by "Botmenu URL" (AW_WORLD_BOTMENU_URL) in the World Features. E.g.: If AW_BOTMENU_QUESTION contains "1 5 3" then the lines 1, 5 and 3 from the botmenu file will be displayed when right-clicking the bot in world.

When a botmenu item is selected in a browser, it will put the selected line number in AW_BOTMENU_QUESTION and send it back to the bot (see AW_EVENT_BOTMENU).

This method can also be used for bot to bot communication. There is an additional attribute AW_BOTMENU_ANSWER that can be used for such purposes. It is currently not used by the browser. Note, that AW_BOTMENU_QUESTION and AW_BOTMENU_ANSWER can only contain numbers with space delimiters. Neither attribute will pass any other alphanumeric values to the target session.

Arguments

None

Argument attributes

AW_BOTMENU_TO_SESSION
AW_BOTMENU_QUESTION
Space-delimited string of line numbers in a botmenu file.
AW_BOTMENU_ANSWER

Return values

RC_SUCCESS (1) (2)
RC_NOT_INITIALIZED (1)
RC_NO_INSTANCE (1)
RC_NO_CONNECTION (1)
The connection to the world is down.
RC_UNAUTHORIZED (2)
Only instances owned by a caretaker (i.e. aw_bool (AW_WORLD_CARETAKER_CAPABILITY) returns 1) may use this method.

(1) Possible return values when a callback is installed.

(2) Returned by the world server.

Returned attributes

None

Usage

The content of a botmenu file might be:

Help
Take a tour
Buy clothes
Change clothes
Show current location
How late is it?

Bot sends a set of questions (menu items):

aw_int_set (AW_BOTMENU_TO_SESSION, session);
aw_string_set (AW_BOTMENU_QUESTION, "1 5 3");
aw_botmenu_send ();

This would make the following items appear (when right-clicking the bot):

Help
Show current location
Buy clothes

See also