summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2023-09-22 15:43:07 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2023-09-22 15:43:07 +0100
commita5415b6afc17474a9462fb8e395263ceef887162 (patch)
tree399766aa3cc71a8f6222daf396b8132e4dae6e6f /scripts
parentfac31ad392c3df22b2254a00e75c841050195763 (diff)
DRTVWR-589 - updates to demo.lua, take avs from library
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lua/demo.lua99
1 files changed, 99 insertions, 0 deletions
diff --git a/scripts/lua/demo.lua b/scripts/lua/demo.lua
new file mode 100644
index 0000000000..9748384d75
--- /dev/null
+++ b/scripts/lua/demo.lua
@@ -0,0 +1,99 @@
+function popup_and_wait_ok(message)
+ args = {{"MESSAGE", message}}
+ notif_response = nil
+ show_notification("GenericAlertOK", args, "notif_response")
+ while not notif_response do
+ sleep(0.2)
+ end
+
+ local response = notif_response
+ return response
+end
+
+function demo_environment()
+ popup_and_wait_ok("Change Environment")
+ run_ui_command("World.EnvSettings", "midnight")
+ sleep(2)
+ run_ui_command("World.EnvSettings", "sunrise")
+ sleep(2)
+ run_ui_command("World.EnvSettings", "noon")
+ sleep(2)
+end
+
+function demo_avatar()
+ popup_and_wait_ok("Change Avatar")
+ wear_by_name("Greg")
+ run_ui_command("Avatar.ResetSelfSkeletonAndAnimations")
+ sleep(8)
+
+ wear_by_name("Petrol Sue")
+ sleep(8)
+
+end
+
+function demo_ui()
+
+
+ -- adding items to 'Build' menu
+ -- popup_and_wait_ok("Extend UI")
+
+ notif_response = nil
+ args = {{"MESSAGE", "Extend the UI now?"}}
+ show_notification("GenericAlertYesCancel", args, "notif_response")
+ while not notif_response do
+ sleep(0.2)
+ end
+ if notif_response ~= 0 then
+ popup_and_wait_ok("Exiting")
+ return
+ end
+
+ menu_name = "BuildTools"
+ add_menu_separator(menu_name)
+
+ params = {{"name", "user_sit"}, {"label", "Sit!"},
+ {"function", "Self.ToggleSitStand"}}
+
+ add_menu_item(menu_name, params)
+
+ params = {{"name", "user_midnight"}, {"label", "Set night"},
+ {"function", "World.EnvSettings"}, {"parameter", "midnight"}}
+
+ add_menu_item(menu_name, params)
+
+ -- adding new custom menu
+ new_menu_name = "user_menu"
+ params = {{"name", new_menu_name}, {"label", "My Secret Menu"}, {"tear_off", "true"}}
+ add_menu(params)
+
+ -- adding new item to the new menu
+ params = {{"name", "user_debug"}, {"label", "Console"},
+ {"function", "Advanced.ToggleConsole"}, {"parameter", "debug"}}
+
+ add_menu_item(new_menu_name, params)
+
+ -- adding new branch
+ new_branch = "user_floaters"
+ params = {{"name", new_branch}, {"label", "Open Floater"}, {"tear_off", "true"}}
+ add_branch(new_menu_name, params)
+
+ -- adding items to the branch
+ params = {{"name", "user_permissions"}, {"label", "Default permissions"},
+ {"function", "Floater.ToggleOrBringToFront"}, {"parameter", "perms_default"}}
+
+ add_menu_item(new_branch, params)
+
+ params = {{"name", "user_beacons"}, {"label", "Beacons"},
+ {"function", "Floater.ToggleOrBringToFront"}, {"parameter", "beacons"}}
+
+ add_menu_item(new_branch, params)
+ sleep(5)
+
+end
+
+function call_once_func()
+
+ demo_environment()
+ demo_avatar()
+ demo_ui()
+end