set_url - ryzom/ryzomcore GitHub Wiki


title: Set URL description: Add a URL action to an NPC's contextual menu published: true date: 2026-11-12T00: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 spawned 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.

How It Works

  1. A CCreatureSetUrlMsg listing every spawned bot of the group is sent to EGS
  2. For each of these bots, 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://example.ryzom.dev/example.php");
// Dynamic URL with player context
($playerEid)getCurrentPlayerEid();
()setUrl("Check your stats", "https://example.ryzom.dev/stats.php?eid=" + $playerEid);
// Remove the menu entry again
()clearUrl();

Notes

  • The URL is applied to all bots of the group that are spawned when the function is called.
  • The menu entry is removed with clearUrl.
  • In a server built with the Ryzom Forge option (WITH_RYZOM_FORGE), setting the URL to "*" removes the menu entry as well. In any other build "*" has no special meaning and is stored as the URL.
  • 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

  • clearUrl - Remove the URL action again
  • 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** ⚠️