From 2aa20e0d53e21ab5cf090e41a5bbda62889f1906 Mon Sep 17 00:00:00 2001 From: Dudekahedron <49531350+StanleyDudek@users.noreply.github.com> Date: Fri, 3 Nov 2023 09:58:48 -0400 Subject: [PATCH] Update snippets.md with guihooks examples --- docs/en/beamng/snippets.md | 42 +++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/en/beamng/snippets.md b/docs/en/beamng/snippets.md index e4122010..502a66f5 100644 --- a/docs/en/beamng/snippets.md +++ b/docs/en/beamng/snippets.md @@ -83,7 +83,47 @@ Here is a custom marker example from [BeamNG-FuelStations](https://github.com/Be end ``` +### guihooks examples +```lua +--guihooks.trigger('toastrMsg', {type, title, msg, config = {timeOut}}) +guihooks.trigger('toastrMsg', {type = "info", title = "Info Message:", msg = "Info Message Text Here", config = {timeOut = 5000}}) +guihooks.trigger('toastrMsg', {type = "warning", title = "Warning Message:", msg = "Warning Message Text Here", config = {timeOut = 5000}}) +guihooks.trigger('toastrMsg', {type = "error", title = "Error Message:", msg = "Error Message Text Here", config = {timeOut = 5000}}) + +--guihooks.trigger('Message', {msg, ttl, category, icon}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "arrow_upward", icon = "arrow_upward"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "arrow_downward", icon = "arrow_downward"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "flag", icon = "flag"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "check", icon = "check"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "check_circle", icon = "check_circle"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "warning", icon = "warning"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "error", icon = "error"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "directions_car", icon = "directions_car"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "star", icon = "star"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "timeline", icon = "timeline"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "save", icon = "save"}) +guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "settings", icon = "settings"}) + +--guihooks.trigger('ScenarioFlashMessage', {{msg, ttl, sound, big}} ) -- requires RaceCountdown ui app +guihooks.trigger('ScenarioFlashMessage', {{"Message", 5.0, 0, true}} ) +guihooks.trigger('ScenarioFlashMessage', {{"Message Text Here", 5.0, 0, false}} ) + +--countdown example, when all executed at once, the items are queued and will follow eachother after the previous ttl expires +guihooks.trigger('ScenarioFlashMessage', {{"3", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown1')", true}}) +guihooks.trigger('ScenarioFlashMessage', {{"2", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown2')", true}}) +guihooks.trigger('ScenarioFlashMessage', {{"1", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown3')", true}}) +guihooks.trigger('ScenarioFlashMessage', {{"GO!", 3.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_CountdownGo')", true}}) + +--another sound example +guihooks.trigger('ScenarioFlashMessage', {{"Teleported!", 3.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Checkpoint')", false}}) + +--guihooks.trigger('ScenarioRealtimeDisplay', {msg = msg} ) -- requires Race Realtime Display ui app +guihooks.trigger('ScenarioRealtimeDisplay', {msg = "Message Text Here"} ) +--these messages persist, clear with a blank string +--if you are running live data, this is a good one to update rapidly (think timers, distance calcs, et cetera) +guihooks.trigger('ScenarioRealtimeDisplay', {msg = ""} ) +``` ## IMGUI Code Snippets -## CEF UI Code Snippets \ No newline at end of file +## CEF UI Code Snippets