From 2cd9f8541cb0e92e9da725bf8d0a66f4520f6077 Mon Sep 17 00:00:00 2001 From: Anna Puddles <113144806+annapuddles@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:29:15 -0500 Subject: [PATCH] Create monitor.lsl --- file server/example/monitor.lsl | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 file server/example/monitor.lsl diff --git a/file server/example/monitor.lsl b/file server/example/monitor.lsl new file mode 100644 index 0000000..1e70c73 --- /dev/null +++ b/file server/example/monitor.lsl @@ -0,0 +1,39 @@ +/* This script controls the monitor on the example server mesh. */ + +/* Link number of the monitor. */ +integer media_link = LINK_THIS; + +/* Face to display media on. */ +integer media_face = 1; + +default +{ + link_message(integer sender, integer num, string str, key id) + { + string jsonrpc_method = llJsonGetValue(str, ["method"]); + + /* When a new URL is obtained, display that URL on the media. */ + if (jsonrpc_method == "prim-dns:url-request-granted") + { + string url = llJsonGetValue(str, ["params", "url"]) + "/"; + + llSetLinkPrimitiveParamsFast(media_link, [PRIM_FULLBRIGHT, media_face, TRUE]); + + llSetLinkMedia(media_link, media_face, [ + PRIM_MEDIA_AUTO_PLAY, TRUE, + PRIM_MEDIA_AUTO_SCALE, FALSE, + PRIM_MEDIA_WIDTH_PIXELS, 512, + PRIM_MEDIA_HEIGHT_PIXELS, 256, + PRIM_MEDIA_CURRENT_URL, url, + PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_ANYONE, + PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_NONE + ]); + } + /* When the server is shut down, remove the media. */ + else if (jsonrpc_method == "prim-dns:shutting-down") + { + llSetLinkPrimitiveParamsFast(media_link, [PRIM_FULLBRIGHT, media_face, FALSE]); + llClearLinkMedia(media_link, media_face); + } + } +}