Skip to content

get_bot_index

Ryzom Core Wiki edited this page Jul 8, 2024 · 3 revisions

title: Get Bot Index description: published: true date: 2023-03-16T23:06:59.903Z tags: editor: markdown dateCreated: 2023-03-16T22:23:32.204Z

getBotIndex

The getBotIndex AI script function is used to get the bot index in the group by its entityId.

Syntax

(botIndex: f)getBotIndex(botEid: s) // getBotIndex_s_f

Arguments

  • botEid (string): The entityId given by the bot.

Return values

  • botIndex (float): The position of the bot in the group or -1 if the entityId is not from a bot of the group.

Examples

($botEid)getCurrentSpeakerEid();
(index)getBotIndex($botEid);
if (index != -1)
{
    ()phrasePushValue("entity", $botEid);
    ()phraseEndNpcMsg(index, "PHRASE_YOUR_ARE_CLICKING_ON_ME");
}

This example code gets the current speaker's entityId and then gets its index in the group using the getBotIndex function. If the index is not -1 (meaning the entityId is from a bot of the group), it pushes the entityId on the parameter stack and ends an npc message with the phraseEndNpcMsg function.

Clone this wiki locally