set_url - ryzom/ryzomcore GitHub Wiki


title: Set URL description: Add a URL action to an NPC's contextual menu published: true date: 2026-03-14T00:00:00.000Z tags: editor: markdown dateCreated: 2023-03-16T22:29:29.437Z

setUrl

The setUrl native AI script function sets a URL action on all bots in the group. This adds an entry to the bot's right-click contextual menu that opens the specified URL in the in-game browser when clicked by a player.

Syntax

()setUrl(actionName: s, url: s)

Arguments

  • actionName (string): The text displayed in the contextual menu entry.
  • url (string): The URL to open when the player clicks the menu entry. Set to "*" to clear the URL and remove the menu entry.

How It Works

  1. A CCreatureSetUrlMsg is sent to EGS for each spawned bot in the group
  2. EGS sets the WebPageFlag in the creature's BotChat program and stores the URL and action name
  3. On the client, when the player right-clicks the NPC, the action name appears as a menu entry (only if WebPageFlag is set)
  4. Clicking the entry opens the URL in the in-game web browser

Examples

// Add a web link to the NPC
()setUrl("Visit our website", "https://app.ryzom.dev/example.php");
// Dynamic URL with player context
($playerEid)getCurrentPlayerEid();
()setUrl("Check your stats", "https://app.ryzom.dev/stats.php?eid=" + $playerEid);
// Clear the URL (removes the menu entry)
()setUrl("", "*");

Notes

  • The URL is applied to all bots in the group.
  • Setting the URL to "*" clears the WebPageFlag on EGS, effectively removing the contextual menu entry.
  • The in-game browser has limited capabilities compared to a full web browser. Test your URLs in-game.
  • The URL can point to server-side scripts that interact with the game's web services (WebIG).

See also

  • addBotChat - Add other types of contextual menu entries
  • npcSay - Make an NPC say something in chat

Source: ryzom/server/src/ai_service/nf_grp.cpp (setUrl_ss_), ryzom/server/src/entities_game_service/creature_manager/creature_manager.cpp (CCreatureSetUrlImp::callback)

⚠️ **GitHub.com Fallback** ⚠️