Fungus Advanced - Narrative Parser Tokens Reference
+Narrative Parser Tags
The following tokens can be used within Story Text to do things such as change the styling of text or clear the contents of a dialog area on input and much more.
-
-
- {b} - Bold start -
- {/b} - Bold end -
- {i} - Italic start -
- {/i} - Italic end -
- {color=red} - Color start -
- {/color} - Color end -
- {w} - Wait -
- {w=0.5} - Wait for a certain amount of time -
- {wi} - Wait for input, but do not clear the dialog area -
- {wc} - Wait for input, clear the dialog area after input -
- {wp} - Wait on punctutation start -
- {wp=0.5} - Wait on punctutation (after a certain amount of time) start -
- {/wp} - Wait on punctuation end -
- {c} - Clear the dialog area -
- {s} - Speed start -
- {s=60} - Speed (with speed setting) start -
- {/s} - Speed end -
- {x} - Exit -
- {m=MessageName} - Send a message with
MessageName
- - {vpunch=0.5} - Vertical punch -
- {hpunch=0.5} - Horizontal punch -
- {shake=0.5} - Shake -
- {shiver=0.5} - Shiver -
- {flash=0.5} - Flash -
- {audio=Sound} - Audio start for
Sound
- - {audioloop=Sound} - Audio loop for
Sound
- - {audiopause=Sound} - Audio pause for
Sound
- - {audiostop=Sound} - Audio stop for
Sound
+ - {b} Bold Text {/b} +
- {i} Italic Text {/i} +
- {color=red} Color Text (color){/color} +
- {size=30} Text size {/size} +
- {s}, {s=60} Writing speed (chars per sec){/s} +
- {w}, {w=0.5} Wait (seconds) +
- {wi} Wait for input +
- {wc} Wait for input and clear +
- {wp}, {wp=0.5} Wait on punctuation (seconds){/wp} +
- {c} Clear +
- {x} Exit, advance to the next command without waiting for input +
- {vpunch=10,0.5} Vertically punch screen (intensity,time) +
- {hpunch=10,0.5} Horizontally punch screen (intensity,time) +
- {punch=10,0.5} Punch screen (intensity,time) +
- {flash=0.5} Flash screen (duration) +
- {audio=AudioObjectName} Play Audio Once +
- {audioloop=AudioObjectName} Play Audio Loop +
- {audiopause=AudioObjectName} Pause Audio +
- {audiostop=AudioObjectName} Stop Audio +
- {m=MessageName} Broadcast message +
- {$VarName} Substitute variable
Examples:
This is a line of dialog.
diff --git a/articles/index.html b/articles/index.html
index 36c47e54..a1eafab2 100644
--- a/articles/index.html
+++ b/articles/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
@@ -300,7 +387,8 @@ David Sherlock
Leah Lee
Konrad Gadzina
diff --git a/blocks/index.html b/blocks/index.html
index 59169d4e..1dde93ea 100644
--- a/blocks/index.html
+++ b/blocks/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/animation_commands/index.html b/commands/animation_commands/index.html
index 7bcc4305..9136f2da 100644
--- a/commands/animation_commands/index.html
+++ b/commands/animation_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/audio_commands/index.html b/commands/audio_commands/index.html
index 04d602cd..8dd71e7a 100644
--- a/commands/audio_commands/index.html
+++ b/commands/audio_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/camera_commands/index.html b/commands/camera_commands/index.html
index a901b3bd..26bdcad1 100644
--- a/commands/camera_commands/index.html
+++ b/commands/camera_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/event_handlers/core_events/index.html b/commands/event_handlers/core_events/index.html
index 4ed2429d..563b333e 100644
--- a/commands/event_handlers/core_events/index.html
+++ b/commands/event_handlers/core_events/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/event_handlers/input_events/index.html b/commands/event_handlers/input_events/index.html
index b0619635..625ff72e 100644
--- a/commands/event_handlers/input_events/index.html
+++ b/commands/event_handlers/input_events/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/event_handlers/sprite_events/index.html b/commands/event_handlers/sprite_events/index.html
index 265ffbcb..2403292b 100644
--- a/commands/event_handlers/sprite_events/index.html
+++ b/commands/event_handlers/sprite_events/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/flow_commands/index.html b/commands/flow_commands/index.html
index c2dbfc7d..b01e61c5 100644
--- a/commands/flow_commands/index.html
+++ b/commands/flow_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/itween_commands/index.html b/commands/itween_commands/index.html
index cc139d28..91ce0a86 100644
--- a/commands/itween_commands/index.html
+++ b/commands/itween_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/narrative_commands/index.html b/commands/narrative_commands/index.html
index 3539d7af..04edfc1b 100644
--- a/commands/narrative_commands/index.html
+++ b/commands/narrative_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/scripting_commands/index.html b/commands/scripting_commands/index.html
index 049efb6b..4077087f 100644
--- a/commands/scripting_commands/index.html
+++ b/commands/scripting_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/sprite_commands/index.html b/commands/sprite_commands/index.html
index a56f548d..8ab7a90b 100644
--- a/commands/sprite_commands/index.html
+++ b/commands/sprite_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/commands/variable_commands/index.html b/commands/variable_commands/index.html
index 8f1a9a99..8422f48a 100644
--- a/commands/variable_commands/index.html
+++ b/commands/variable_commands/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/download/index.html b/download/index.html
index e47bf6af..af0b64b5 100644
--- a/download/index.html
+++ b/download/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/faq/index.html b/faq/index.html
index 6a9f3ec6..de64a715 100644
--- a/faq/index.html
+++ b/faq/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/flowcharts/index.html b/flowcharts/index.html
index ff1c3756..77a55dbb 100644
--- a/flowcharts/index.html
+++ b/flowcharts/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/fungus_lua/controlling_fungus/index.html b/fungus_lua/controlling_fungus/index.html
new file mode 100644
index 00000000..0fbd9592
--- /dev/null
+++ b/fungus_lua/controlling_fungus/index.html
@@ -0,0 +1,541 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Controlling Fungus - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Controlling Fungus
+
+
+ - Narrative example
+
+
+ - Say Dialog functions
+
+
+ - Menu Dialog functions
+
+
+ - Flowchart functions
+
+
+
+
+
+
+Controlling Fungus
+The Fungus module provides several functions for working with the standard Fungus narrative features and flowcharts.
+You can control Say and Menu dialogs in much the same way you use Say and Menu commands in a normal Fungus flowchart.
+When you use the menu() function, you supply another Lua function to call when that menu option is selected. Make sure to define the function higher up in the file before referencing it in a menu() call. If you don't explicitly set a SayDialog or MenuDialog object to use default ones are created automatically.
+Narrative example
+This example Lua script demonstrates some of the Say and Menu dialog functions. To try it out, add a Lua object to the scene (Tools > Fungus > Create > Lua) and copy this script into the Lua Script text box. You may also need to add an EventSystem object in the scene (GameObject > UI > Event System) so that the menu buttons will respond to user input.
+say("Hi there")
+say "This syntax also works for say commands"
+
+-- Lua functions are the equivalent of Fungus blocks
+-- Note that in Lua functions must be defined before they are called.
+
+function goleft()
+ say("You chose left")
+end
+
+function goright()
+ say("You chose right")
+end
+
+menu("Go Left", goleft)
+menu("Go right", goright)
+
+
+Say Dialog functions
+To use a custom SayDialog:
+
+- Add as SayDialog to the scene (Tools > Fungus > Create > SayDialog)
+- Select the Lua object in the hierarchy and find the LuaBindings component.
+- Add a binding to the SayDialog game object, and select the SayDialog component. N.B. Make sure to select the correct component!
+- In Lua script, you can now activate this SayDialog using the setsaydialog() function, by passing the key of the SayDialog binding.
+
+To change the behaviour of the say() function, e.g. to not wait for input when done, do:
+sayoptions.waitforinput = false
+
+
+You can bind Character objects in a similar fashion, and set the speaking character using the setcharacter() function.
+This is the list of available functions for controlling SayDialogs.
+-- Options for configuring Say Dialog behaviour
+sayoptions.clearprevious = true | false
+sayoptions.waitforinput = true | false
+sayoptions.fadewhendone = true | false
+sayoptions.stopvoiceover = true | false
+
+-- Set the active saydialog to use with the say function
+-- saydialog: A binding to a SayDialog component
+setsaydialog(saydialog)
+
+-- Gets the active say dialog, or creates one if none exists yet
+getsaydialog()
+
+-- Set the active character on the Say Dialog
+-- character: A Fungus.Character component
+-- portrait: The name of a sprite in the character's portrait list
+setcharacter(character, portrait)
+
+-- Write text to the active Say Dialog
+-- text: A string to write to the say dialog
+-- voice: A voiceover audioclip to play
+say(text, voiceclip)
+
+
+Menu Dialog functions
+You setup custom MenuDialogs in the same manner as SayDialogs. This is the list of available MenuDialog functions.
+-- Set the active menudialog to use with the menu function
+setmenudialog(menudialog)
+
+-- Gets the active menu dialog, or creates one if none exists yet
+getmenudialog()
+
+-- Display a menu button
+-- text: text to display on the button
+-- callback: function to call when this option is selected
+-- interactive (optional): if false, displays the option as disabled
+menu(text, callback, interactive)
+
+-- Display a timer during which the player has to choose an option.
+-- duration: The length of time to display the timer.
+-- callback: Function to call if the timer expires before an option is selected.
+menutimer(duration, callback)
+
+-- Clear all currently displayed menu options
+clearmenu()
+
+
+Flowchart functions
+We've added special functions for say() and menu() because these are so common in Fungus games. To execute any other commands in Fungus from Lua, you must do it in conjunction with a Flowchart & Block, like this:
+
+- Add a Flowchart and a Block (e.g. "MyBlock") in the scene.
+- Add the Fungus commands you want to execute from Lua in the Block. (e.g Play Sound)
+- Add a Lua object to the scene (Tools > Fungus > Create > Lua)
+- In the LuaBindings component, add a binding to the Flowchart gameobject, and select the Flowchart component.
+- In the LuaScript component, use the runblock() function to execute the Block, passing the bound flowchart and name of the block as parameters.
+
+runblock(flowchart, "MyBlock")
+
+
+You can also access any Flowchart variable from Lua via the getvar() function.
+-- Assume the 'flowchart' variable is bound to a Flowchart component in LuaBindings
+-- MyVar is a string variable defined on the Flowchart
+
+local myvar = getvar(flowchart, "MyVar")
+
+print(myvar.value)
+
+myvar.value = "New value for string"
+
+
+This is the list of available functions for controlling Flowcharts.
+-- Returns the specified Variable in a Flowchart.
+-- To access the value of the variable, use its .value property. e.g.
+-- v = getvar(flowchart, "FloatVar")
+-- v.value = 10 -- Sets the value of the variable to 10
+-- f = v.value -- f now contains 10
+-- flowchart: The Fungus Flowchart containing the Block to run.
+-- varname: The name of the Variable to get.
+getvar(flowchart, varname)
+
+-- Runs the specified Block in a Flowchart
+-- flowchart: The Fungus Flowchart containing the Block to run.
+-- blockname: The name of the Block to run.
+-- nowait: If false, will yield until the Block finishes execution. If true, continue immediately.
+runblock(flowchart, blockname, nowait)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/create_menu/index.html b/fungus_lua/create_menu/index.html
new file mode 100644
index 00000000..fd7c0d64
--- /dev/null
+++ b/fungus_lua/create_menu/index.html
@@ -0,0 +1,444 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Create Menu - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - The Create Menu
+
+
+ - Lua Prefab
+
+
+ - Lua File
+
+
+ - Lua Environment Prefab
+
+
+ - Lua Bindings Prefab
+
+
+ - Lua Script Prefab
+
+
+ - Lua Store Prefab
+
+
+
+
+
+
+The Create Menu
+The easiest way to add Lua scripting to your scene is via the Tools > Fungus > Create menu. This allows you to quickly instantiate one of the Lua prefabs that comes with FungusLua. The FungusLua prefabs all begin with 'Lua'.
+You can also access these prefabs from Fungus/Thirdparty/FungusLua/Resources/Prefabs.
+
+Lua Prefab
+This prefab provides a complete Lua setup, including the LuaEnvironment, LuaUtils, LuaBindings and LuaScript components in a single game object.
+This is perfect when you want to quickly set up a single script with a few bindings. If you're learning FungusLua, use the Lua object until you're comfortable with how all these components work.
+For more sophisticated scenarios it can be better to place these components in different game objects, e.g. one LuaEnvironment object, one LuaBindings object and multiple LuaScript objects that share the environment and bindings. The other prefab types listed below make it easy to set up this kind of configuration.
+Lua File
+This option creates a Lua file in the folder you select. In Unity, Lua files use the .txt extension so they work properly with TextAsset properties and can be opened in the code editor.
+When you create a Lua file, add your Lua script to it in a text editor, and then select the file in the Lua File property of a LuaScript component or Execute Lua command to execute it. You can also use Lua's module system and the require() function to include Lua code from other files.
+Lua Environment Prefab
+This prefab provides a LuaEnvironment component for executing Lua script, and the LuaUtils component which provides useful utilities for working with Lua, Unity and Fungus.
+FungusLua will automatically create a default LuaEnvironment if none exists when the scene starts, so you really only need to create a Lua Environment in your scene when you want to customize the default environment setup (e.g. Adding a string table file or registering additional c# types).
+Lua Bindings Prefab
+This prefab provides a LuaBindings component which you can use to bind objects in your scene / project to Lua variables so they can be accessed from Lua script. You can have multiple Lua Bindings in a scene, or additively load in a scene which contains a Lua Bindings for objects in that scene. At startup, all loaded Lua Bindings register their bindings with every Lua Environment in the scene (unless the All Environments option is switched off).
+If you want to make a prefab using Lua Bindings, all the bound objects must be children of the Lua Bindings prefab in the hierarchy so that Unity can maintain the object references correctly. This is a limitation of how Unity works.
+Lua Script Prefab
+This prefab contains a Lua Script component which you can use to execute Lua script, either typed in the inspector window or loaded via a text file. It also contains an Execute Handler component which supports executing the Lua Script when a Unity event occurs (e.g. start, update, on enter trigger, etc.)
+Lua Store Prefab
+This prefab contains a Lua Store component which you can use to persist Lua variables between scene loads.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/execute_lua/index.html b/fungus_lua/execute_lua/index.html
new file mode 100644
index 00000000..5a2b7873
--- /dev/null
+++ b/fungus_lua/execute_lua/index.html
@@ -0,0 +1,435 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ ExecuteLua command - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - The ExecuteLua Command
+
+
+ - Evaluating expressions
+
+
+ - Example
+
+
+
+
+
+
+The ExecuteLua Command
+This command allows you to embed a Lua script to be executed as part of a command sequence in a Block. The Lua script to be executed can be specified in the inspector or in a text file, in the same way as in the Lua Script component.
+You can provide an optional LuaEnvironment to use for the execution. If none is provided then a LuaEnvironment will be selected / created automatically. You can choose to store the return value from the Lua script in a Flowchart variable.
+Evaluating expressions
+The Fungus If command can only compare 2 variables at a time. For more complex expressions involving multiple variables or math functions, you can use Lua to evaluate the expression and store the result in a Flowchart variable.
+
+- Add a Flowchart object (Tools > Fungus > Create > Flowchart). Add some variables to the Flowchart.
+- Add a LuaBindings object (Tools > Fungus > Create > LuaBindings)
+- Add a binding to the Flowchart gameobject, and select the Flowchart component.
+- In the Flowchart, add an ExecuteLua command in a block to evaluate the complex expression. Store the return value in a Boolean Flowchart variable.
+- Add an If command which checks the value of the Boolean variable.
+
+In the Execute Lua command, you can use the getvar() function to get any Flowchart variables to be used in the expression.
+Note: getvar() returns a reference to the Fungus variable object. To access the value of this variable use the .value property.
+Example
+Here's an example Lua script which evaluates a complex expression involving 3 integer variables defined on a bound Flowchart.
+local v1 = getvar(flowchart, "Var1")
+local v2 = getvar(flowchart, "Var2")
+local v3 = getvar(flowchart, "Var3")
+
+return (v1.value == v2.value or v3.value == 5)
+
+
+Don't forget to use .value to access the value stored in the variable object, rather than the variable object itself!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/fungus_module/index.html b/fungus_lua/fungus_module/index.html
new file mode 100644
index 00000000..f5618096
--- /dev/null
+++ b/fungus_lua/fungus_module/index.html
@@ -0,0 +1,460 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Fungus Module - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Fungus Module
+
+
+ - Inspecting Lua objects
+
+
+ - Running Unity coroutines
+
+
+ - Globals vs Table mode
+
+
+
+
+
+
+Fungus Module
+This Lua module provides handy functions for working with Lua, Unity and Fungus.
+In this page we cover some of the more generic functionality in the module, other major features are described elsewhere in the documentation.
+Inspecting Lua objects
+You can use Lua's built in print() function to get a basic description of any object printed to the console. When you want to get a more detailed description of an object, use inspect().
+-- Prints a short description of object v
+print(v)
+
+-- Prints a summary of object v in a human readable format.
+inspect(v)
+
+
+Running Unity coroutines
+When you bind to a C# component using Lua Bindings, you can access any public method in the class. If a method returns IEnumerator then that method can be executed as a coroutine, which is a powerful way to run asynchronous code.
+The runwait() function allows you to call a C# coroutine method from Lua which may take multiple frames to finish its work, and then carry on with the rest of the Lua code once that C# method has finished executing. This is how the say() function works for example.
+This is the list of available functions for waiting and working with coroutines.
+-- Waits for a number of seconds, then continue execution of Lua script
+wait(duration)
+
+-- Waits until the Lua function provided returns true, or the timeout expires.
+-- Returns true if the function succeeded, or false if the timeout expired
+waitfor(fn, timeoutduration)
+
+-- Run a C# coroutine and continue execution of Lua script
+run(co)
+
+-- Run a C# coroutine, wait until it completes, then continue execution of Lua script
+runwait(co)
+
+
+Globals vs Table mode
+The Fungus module can be used in three modes, controlled by the Fungus Module option in the LuaUtils component.
+
+- Use Global Variables: all module functions are mapped to global functions. This allows for convenient access, but it runs the risk that you might accidentally declare a variable with the same name as a Fungus module function.
+- Use Fungus Variable: all module functions are accessed through a global table called 'fungus'. This gives a degree of namespace safety at the cost of more typing.
+- No Fungus Module: the Fungus module will not be registered. Used if you don't want to use the Fungus module.
+
+Options 1 and 2 are functionaly equivalent, it's just a matter of personal preference which you want to use.
+-- sub is a function in the Fungus module, mapped to a global variable
+
+-- Use Global Variables
+sub('a string')
+
+-- Use Fungus Variable
+fungus.sub('a string')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/images/create_menu.png b/fungus_lua/images/create_menu.png
new file mode 100644
index 00000000..c0f4f9c5
Binary files /dev/null and b/fungus_lua/images/create_menu.png differ
diff --git a/fungus_lua/images/lua.png b/fungus_lua/images/lua.png
new file mode 100644
index 00000000..4bdf7a91
Binary files /dev/null and b/fungus_lua/images/lua.png differ
diff --git a/fungus_lua/images/lua_bindings.png b/fungus_lua/images/lua_bindings.png
new file mode 100644
index 00000000..95edec43
Binary files /dev/null and b/fungus_lua/images/lua_bindings.png differ
diff --git a/fungus_lua/images/lua_environment.png b/fungus_lua/images/lua_environment.png
new file mode 100644
index 00000000..97b131b8
Binary files /dev/null and b/fungus_lua/images/lua_environment.png differ
diff --git a/fungus_lua/images/lua_script.png b/fungus_lua/images/lua_script.png
new file mode 100644
index 00000000..a28e580d
Binary files /dev/null and b/fungus_lua/images/lua_script.png differ
diff --git a/fungus_lua/images/moonsharp.png b/fungus_lua/images/moonsharp.png
new file mode 100644
index 00000000..41574066
Binary files /dev/null and b/fungus_lua/images/moonsharp.png differ
diff --git a/fungus_lua/index.html b/fungus_lua/index.html
new file mode 100644
index 00000000..2d9d64b1
--- /dev/null
+++ b/fungus_lua/index.html
@@ -0,0 +1,438 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - What is FungusLua?
+
+
+ - Quickstart
+
+
+ - Using FungusLua Independently
+
+
+ - About Lua
+
+
+ - About MoonSharp
+
+
+
+
+
+
+What is FungusLua?
+FungusLua is an easy way to embed Lua scripting into your Unity project. Lua is an easy to learn scripting language so it's a great way to empower artists, writers and designers to use more of the power of Unity.
+FungusLua provides a simple way to control Unity objects from Lua scripts. It has useful utilities for using Fungus flowcharts and dialogs, persisting variables between scene loads, localization, and working with the Unity Test Tools.
+We made FungusLua in response to requests from the Fungus community for a way to script Fungus commands from a text file or spreadsheet. We figured that if people are going to be writing commands in text files, why not go all the way and add a powerful embedded scripting language?
+Quickstart
+This tutorial video covers the basics of using FungusLua. This documentation provides more in-depth information about the features avaialable.
+Using FungusLua Independently
+FungusLua can easily be used on its own if you don't need the rest of the functionality in Fungus.
+
+- In the project window, move the Fungus/Thirdparty/FungusLua folder up to the root of the project.
+- Delete the Fungus and FungusExamples folders.
+
+The Tools > Fungus menu will now only show options for creating FungusLua objects. Obviously you won't be able to use Fungus functions like say(), menu(), etc. anymore, but you can still use LuaEnvironment, LuaBindings, LuaScript to add Lua scripting to your game.
+About Lua
+
+Lua is a powerful, fast, lightweight, embeddable scripting language. It is a popular language for game development and supporting user modding. The standard resource for learning Lua is Programming in Lua.
+About MoonSharp
+
+MoonSharp is an open source implementation of the Lua scripting language written entirely in C#.
+FungusLua is essentially a set of wrapper components built on top of MoonSharp which make it easier to use Lua scripting directly in the Unity editor. MoonSharp does all the hard work really and is a completely awesome project :)
+The MoonSharp tutorials and MoonSharp forum are great resources to learn how MoonSharp works, especially for more advanced usage.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/lua_bindings/index.html b/fungus_lua/lua_bindings/index.html
new file mode 100644
index 00000000..8e253d81
--- /dev/null
+++ b/fungus_lua/lua_bindings/index.html
@@ -0,0 +1,441 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Lua Bindings - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - LuaBindings component
+
+
+ - Adding LuaBindings
+
+
+ - Using a global table
+
+
+ - Finding member info
+
+
+ - Register Types option
+
+
+
+
+
+
+LuaBindings component
+The LuaBindings component allows you map gameobjects and components in your scenes to Lua variables which you can then access in your Lua scripts. You can bind to any component, including standard Unity components, components from the Unity Asset Store and your own custom scripts.
+As well as scene GameObjects and components, you can bind to any Unity object in your project. This includes things like Prefabs, Materials, TextAssets, Textures, ScriptableObjects, etc.
+
+Adding LuaBindings
+To setup LuaBindings in your scene:
+
+- Create a LuaBindings object (Tools > Fungus > Create > LuaBindings)
+- Drag the Unity object you want to access to the Object field in the Object Bindings list.
+- The Key field is automatically populated based on the object name. This will be the variable name you use to access the bound object from Lua script. You can change this key to whatever string you prefer.
+- If the bound object is a GameObject, you can optionally select a component within it to bind to.
+
+Using a global table
+The bindings specified in a LuaBindings component are automatically registered as global variables in all LuaEnvironments in the scene at startup.
+Registering as global variables is convenient when writing short scripts, but for more complex scripts it could cause problems if you accidentally define another variable with the same name as a binding. To avoid this problem, you can use the Table Name property to register bindings in a global table to add a degree of namespace safety.
+For example, if your binding is called 'camera' and you've set Table Name to "myobjects", you would access the camera object like this:
+myobjects.camera
+
+
+Note that by default the LuaBindings component will register its bindings with all LuaEnvironments in the scene. If you don't want this behaviour, deselect the 'All Environments' option and select the specific LuaEnvironment you want to use instead.
+Finding member info
+The Member Info dropdown box lets you to quickly lookup properties and methods for any bound object. When you select a member, a description of the member is displayed together with the Lua script needed to access it. When binding to standard Unity objects, you can also check the API docs to find out more about the supported methods and properties.
+Register Types option
+In order to access a C# type from Lua, that type has to be registered with MoonSharp. When the Register Types option is selected, LuaBindings will automatically register the types of bound objects and all public properties & methods that the type uses.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/lua_environment/index.html b/fungus_lua/lua_environment/index.html
new file mode 100644
index 00000000..68efa834
--- /dev/null
+++ b/fungus_lua/lua_environment/index.html
@@ -0,0 +1,424 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Lua Environment - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - LuaEnvironment
+
+
+ - Multiple Environments
+
+
+ - Remote Debugger
+
+
+ - LuaUtils
+
+
+
+
+
+
+LuaEnvironment
+The LuaEnvironment component manages all the variables, functions, executing code, etc. for a single Lua context, and provides handy functions for loading and running Lua scripts. In order to run Lua code there must be at least one LuaEnvironment component present in the scene.
+You can create one via (Tools > Fungus > Create > LuaEnvironment). You usually don't need to explicitly create a LuaEnvironment though because FungusLua will create one automatically when there isn't one in the scene at startup.
+
+Multiple Environments
+You can use multiple LuaEnvironments in your scene to ’sandbox’ the variables, functions and executing code of independent sets of Lua scripts. If you do this, make sure to specify the appropriate LuaEnvironment when using LuaScript components, ExecuteLua commands, etc. or else they'll just use the first one they find in the scene.
+Remote Debugger
+The 'Remote Debugger' option activates the built-in MoonSharp remote debugger tool. The application will halt execution on the first executed line of Lua code and open a MoonSharp debugger window in your browser. See the MoonSharp documentation for more information on using this debugger.
+LuaUtils
+When you create a LuaEnvironment object via (Tools > Fungus > Create > LuaEnvironment), the created gameobject has another component called LuaUtils which adds many useful features to the basic LuaEnvironment setup. See the Lua Utils section for more info.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/lua_script/index.html b/fungus_lua/lua_script/index.html
new file mode 100644
index 00000000..fb040f69
--- /dev/null
+++ b/fungus_lua/lua_script/index.html
@@ -0,0 +1,477 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Lua Script - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - LuaScript
+
+
+ - ExecuteHandler component
+
+
+ - Lua script and files
+
+
+ - Lua modules and require()
+
+
+ - Error messages
+
+
+ - Setting the LuaEnvironment
+
+
+ - RunAsCoroutine option
+
+
+
+
+
+
+LuaScript
+The LuaScript component provides an easy way to run Lua scripts in your scene. You can create a LuaScript object via (Tools > Fungus > Create > LuaScript).
+
+ExecuteHandler component
+When you create a LuaScript object, you'll see that it contains a component called 'ExecuteHandler'. This component allows you to specify options for when the Lua script should execute. By default it executes the Lua script when the scene starts, but you can change this to execute after a delay, on every update, on trigger events, etc.
+If you want to execute a LuaScript from a custom C# script, set On Event to 'Nothing' and instead call the LuaScript.OnExecute() method directly. You can also call the OnExecute() method from a UI event, e.g. a UI Button 'On Click' event.
+Lua script and files
+You can enter the Lua code you wish to execute directly into the 'Lua Script' text box. You can also put Lua code into a text file in your project and use the Lua File property to execute it.
+You can also use both options at the same time. In this case, the Lua File contents are loaded first and the Lua Script text is appended to that. This is a handy feature for code reuse and configuration, e.g. create a Lua text file with Lua functions to control your game, and then call those functions from the Lua Script text box.
+Lua modules and require()
+The Lua module system allows you to create reusable packages of Lua code and include these in your Lua scripts. This tutorial explains how to write Lua modules. Module files in FungusLua need to be put into a special folder structure so that the Lua require() function is able to locate them.
+To use a Lua module:
+
+- Create a Resources/Lua folder in your project. The capitalization here is important. The folder can be created inside an existing folder in your project.
+- Create a mymodule.txt file inside the Resources/Lua folder and add your Lua script to it. (Rename mymodule.txt to whatever you want).
+- You can now use the Lua require function to load the module for use in any Lua script, for example
+
+local mymodule = require("mymodule")
+
+-- Call a function in the module
+mymodule.myfunction()
+
+
+Error messages
+When a script contains errors there are a few techniques you can use to track down the source.
+FungusLua compiles Lua code at scene startup so that it can be quickly executed when needed later on. This means you will usually see Lua syntax error messages in the console at startup (during compilation), and runtime errors when the script executes later on.
+All Lua script errors generate an error message in the Unity log, displayed in red.
+For example, if you try to run this invalid code in a LuaScript object:
+not valid lua
+
+
+It will generate an error message in the log like this
+LuaScript.LuaScript:(1,0-3): unexpected symbol near 'not'
+1: not valid lua
+
+
+
+- The first 'LuaScript.LuaScript' part gives you information about where the Lua script is running from.
+- The next part in brackets '(1,0-3)' tells you the line number and character range where the error is located.
+- The last part gives you a description of the type of error.
+- The next line on gives a listing of the Lua source code. Use the linenumber info above to locate the line causing the problem.
+
+One of the most common errors is attempting to access a variable that doesn't exist. In this example error message, we've tried to access the field 'name' on a variable v that hasn't been defined yet.
+LuaScript.LuaScript:(1,7-9): attempt to index a nil value
+1: print(v.name)
+
+
+To resolve this type of error, carefully check that the variable you want to access has been defined, is spelled correctly and is what you think it is. You can use the print() and inspect() functions to display information about the object in the console. For instance, you may have added a binding to a gameobject, but forgot to select the correct component in the binding.
+For runtime errors, a useful technique is to add print() calls in your code just before where the error occurs, and run it again. This way you can print out information to the console to help track down the cause of the error.
+MoonSharp includes a remote debugger tool which you can use to step through Lua code and inspect variables. See the LuaEnvironment documentation for more information.
+Setting the LuaEnvironment
+By default the LuaScript component will use the first LuaEnvironment it finds in the scene to execute, or create one if none exists. If you want to use a specific LuaEnvironment, set it in the Lua Environment property. This is a good way to keep unrelated sets of Lua scripts sandboxed from each other.
+RunAsCoroutine option
+This option will run the Lua script as a Lua coroutine which is useful for writing asynchronous code via the coroutine.yield() function in Lua. If you don't need to execute your Lua script asynchronously, deselecting this option will avoid the overhead of running as a coroutine. Recommended for advanced users only!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/lua_store/index.html b/fungus_lua/lua_store/index.html
new file mode 100644
index 00000000..d77bf527
--- /dev/null
+++ b/fungus_lua/lua_store/index.html
@@ -0,0 +1,425 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Lua Store - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+LuaStore
+A common issue when working with multiple scenes in Unity is how to persist variable values from one scene to the next. By default, all scene objects and their properties are destroyed when you load another scene.
+The Lua Store component provides an easy way around this when using Lua scripting. A shared global table called ‘store’ is bound in every Lua Environment when the scene starts. This global table persists between scene loads, which means you can set a store variable in one scene, load another scene, then access the same store variable and it will still retain the value you set earlier.
+Example
+
+- Add a LuaStore to the first scene in your game (Tools >Fungus > Create > LuaStore).
+- Set variables in the store in Lua, e.g.
+
+store.name = "John"
+
+
+
+- Load another scene, e.g. using the Load Scene command in Fungus
+- Get the same variable from the store, e.g.
+
+print(store.name) -- prints "John"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/lua_utils/index.html b/fungus_lua/lua_utils/index.html
new file mode 100644
index 00000000..bd3d2202
--- /dev/null
+++ b/fungus_lua/lua_utils/index.html
@@ -0,0 +1,541 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Lua Utils - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - LuaUtils
+
+
+ - Example
+
+
+ - GameObject Functions
+
+
+ - Registering C# Types
+
+
+ - Example JSON Type File
+
+
+ - Registering Types Directly
+
+
+ - Other Utilities
+
+
+ - PODFactory
+
+
+
+
+
+
+LuaUtils
+LuaUtils is a component that extends the Lua environment with some commonly used functionality.
+It can be accessed from Lua scripts via the 'luautils' global variable. This component mostly does a lot of setup work in the background, but it also provides some handy functions for instantiating, finding and destroying gameobjects in the scene.
+Example
+Here's an example of the kind of thing you can do:
+local go = luautils.Find("MyObject") -- Find a game object by name
+luautils.Destroy(go) -- Destroy it
+
+
+GameObject Functions
+This is the list of GameObject functions provided in luautils.
+-- Find a game object by name and returns it.
+GameObject Find(string name)
+
+-- Returns one active GameObject tagged tag. Returns null if no GameObject was found.
+GameObject FindWithTag(string tag)
+
+-- Returns a list of active GameObjects tagged tag. Returns empty array if no GameObject was found.
+GameObject[] FindGameObjectsWithTag(string tag)
+
+-- Create a copy of a GameObject.
+-- Can be used to instantiate prefabs.
+GameObject Instantiate(GameObject go)
+
+-- Destroys an instance of a GameObject.
+Destroy(GameObject go)
+
+-- Spawns an instance of a named prefab resource.
+-- The prefab must exist in a Resources folder in the project.
+GameObject Spawn(string resourceName)
+
+
+Registering C# Types
+The most important function of the LuaUtils component is registering C# types so that instances of those types can be accessed from Lua scripts.
+In order to access the members of a C# type from Lua, the type first has to be registered with MoonSharp. Note that for objects added using the LuaBindings component, the relevant types are registered automatically.
+In some cases however, you will need to register a type explicitly. The easiest way to do this is by adding the type's name to the FungusTypes.txt or UnityTypes.txt JSON files referenced by the LuaUtils component. You can also create your own JSON files to register additional types. Note that types that are not contained in the main application DLL will need to use the namespace qualified type name in the JSON file.
+Example JSON Type File
+Example of a types JSON file:
+{
+ "registerTypes" : [
+ "Fungus.Block"
+ ],
+ "extensionTypes" : [
+ "Fungus.LuaExtensions"
+ ]
+}
+
+
+Registering Types Directly
+If you need to register types directly from C#, or do a more complex type of registration, you can use the MoonSharp UserData class to do this. See the MoonSharp documentation for a list of supported registration methods. A good place to register C# types is in the Awake method of a custom component.
+Other Utilities
+LuaUtils creates bindings for several useful C# classes and components so that you can access them from Lua script.
+
+
+
+Binding name
+Description
+
+
+
+
+time
+The Unity Time class. e.g. 'time.deltaTime' returns the delta time for this frame
+
+
+playerprefs
+The Unity PlayerPrefs class. Used for saving data to disk.
+
+
+prefs
+The FungusPrefs class, our own wrapper around PlayerPrefs that adds a slots systems.
+
+
+factory
+The PODTypeFactory class for creating common plain-old-data types
+
+
+luaenvironment
+The LuaEnvironment component used to execute Lua scripts
+
+
+luautils
+A reference to the LuaUtils component itself
+
+
+test
+Support for Unity Test Tools (if installed)
+
+
+stringtable
+The FungusLua localisation string table
+
+
+
+PODFactory
+Due to limitations in C# / Mono, MoonSharp has limited support for working with Plain-Old-Data (struct) types like Vector3, Color, etc.
+The best approach here is to treat POD properties as immutable objects, and never try to modify a POD variable that has been acquired from a C# object. Instead, you should construct a new POD object, populate it with the required values and then pass that object in calls to C# code. The LuaUtils PODFactory class helps do this for common Unity types.
+-- Returns a new Color object
+local c = luautils.factory.color(1,1,1,1)
+
+-- Returns a new Vector2 object
+local v2 = luautils.factory.vector2(1, 2)
+
+-- Returns a new Vector3 object
+local v3 = luautils.factory.vector3(1, 2, 3)
+
+-- Returns a new Vector4 object
+local v4 = luautils.factory.vector4(1, 2, 3, 4)
+
+-- Returns a new Quaternion object
+local q = luautils.factory.quaternion(float x, float y, float z) -- Rotation in euler angles
+
+-- Returns a new Rect object
+local r = luautils.factory.rect(float x, float y, float width, float height)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/preferences/index.html b/fungus_lua/preferences/index.html
new file mode 100644
index 00000000..2c0b486f
--- /dev/null
+++ b/fungus_lua/preferences/index.html
@@ -0,0 +1,456 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Preferences - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - PlayerPrefs
+
+
+ - FungusPrefs
+
+
+
+
+
+
+PlayerPrefs
+The Unity PlayerPrefs system stores and accesses player preferences between game sessions.
+Here's an example of using PlayerPrefs from Lua.
+-- Saving a value to preferences
+playerprefs.SetInt("SaveName", 1)
+playerprefs.Save()
+
+-- Using a value from preferences
+local v = playerprefs.GetInt("SaveName")
+print(v) -- Will print out 1
+
+
+FungusPrefs
+The FungusPrefs class is a wrapper around PlayerPrefs that adds support for save slots.
+Basically, if you want to store simple values use PlayerPrefs. If you want to store values using multiple player profiles, you should use FungusPrefs. The slot variable is an integer [0..] and key is a string.
+-- Deletes all saved values for all slots.
+prefs.DeleteAll()
+
+-- Removes key and its value from this save slot.
+prefs.DeleteKey(slot, key)
+
+-- Returns the float value associated with this key in this save slot, it it exists.
+prefs.GetFloat(slot, key, defaultValue)
+
+-- Returns the int value associated with this key in this save slot, it it exists.
+prefs.GetInt(slot, key, defaultValue)
+
+-- Returns the string value associated with this key in this save slot, it it exists.
+prefs.GetString(slot, key, defaultValue)
+
+-- Returns true if the key exists in this save slot.
+prefs.HasKey(slot, key)
+
+-- Writes all modified prefences to disk.
+prefs.Save()
+
+-- Sets the value of the preference identified by key for this save slot.
+prefs.SetFloat(slot, key, value)
+
+-- Sets the value of the preference identified by key for this save slot.
+prefs.SetInt(slot, key, value)
+
+-- Sets the value of the preference identified by key for this save slot.
+prefs.SetString(slot, key, value)
+
+-- Returns the combined key used to identify a key within a save slot.
+prefs.GetSlotKey(slot, key)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/string_table/index.html b/fungus_lua/string_table/index.html
new file mode 100644
index 00000000..4c30bbe6
--- /dev/null
+++ b/fungus_lua/string_table/index.html
@@ -0,0 +1,458 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ String Table - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - String Table
+
+
+ - JSON Format
+
+
+ - Lua Functions
+
+
+
+
+
+
+String Table
+The LuaUtils component provides support for simple text localisation.
+
+- Define your language strings in a JSON file and save it in the project assets folder.
+- Add a LuaEnvironment component to your scene - e.g. Tools > Fungus > Create > LuaEnvironment
+- In the LuaUtils component, set the String Table property to reference your JSON file asset.
+- Use the {$VarName} syntax to subsitute a localised string anywhere that string substitution is supported. e.g. in a Lua script:
+
+say("{$hello_world}")
+
+
+You can use the {$VarName} syntax anywhere that variable subsitution is supported. This includes:
+
+- Say command
+- Menu command
+- Set Text command
+- Write command
+- Character object - character name
+- Debug Log command
+- Load Variable command - save key
+- Save Variable command - save key
+- Delete Save Key command
+
+You can also extend the Fungus string substitution system with your own components. Implement the StringSubstituter.ISubstitutionHandler interface in a Monobehavior subclass and then return the modified string from SubstituteStrings().
+JSON Format
+This is an example of the JSON format for the string table. To use this localised string, you would use the {$hello_world} tag.
+{
+ "hello_world" : {
+ "en" : "Hello world!",
+ "fr" : "Bonjour le monde!",
+ "de" : "Hallo Welt!"
+ }
+}
+
+
+Lua Functions
+These Lua functions are available for working with the string table.
+-- Set active language for string table
+setlanguage(languagecode)
+
+-- Get a named string from the string table
+getstring(key)
+
+-- Substitutes variables and localisation strings into a piece of text
+-- e.g. v = 10, "Subbed value is [$v]" => "Subbed value is 10"
+sub(text)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fungus_lua/unity_test_tools/index.html b/fungus_lua/unity_test_tools/index.html
new file mode 100644
index 00000000..923da2cf
--- /dev/null
+++ b/fungus_lua/unity_test_tools/index.html
@@ -0,0 +1,443 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Unity Test Tools - Fungus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Fungus Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ What is Fungus?
+
+
+
+
+-
+ Installation
+
+
+
+
+-
+ Getting Started
+
+
+
+
+-
+ Flowcharts
+
+
+
+
+-
+ Blocks
+
+
+
+
+-
+ Telling a Story
+
+
+
+
+-
+ Playing Audio
+
+
+
+
+-
+ Community Articles
+
+
+
+
+-
+ Glossary
+
+
+
+
+-
+ FAQ
+
+
+
+
+ -
+ Reference
+
+
+
+-
+ Animation Commands
+
+
+
+
+-
+ Audio Commands
+
+
+
+
+-
+ Camera Commands
+
+
+
+
+-
+ Flow Commands
+
+
+
+
+-
+ iTween Commands
+
+
+
+
+-
+ Narrative Commands
+
+
+
+
+-
+ Scripting Commands
+
+
+
+
+-
+ Sprite Commands
+
+
+
+
+-
+ Variable Commands
+
+
+
+
+-
+ Events (Core) Commands
+
+
+
+
+-
+ Events (Input) Commands
+
+
+
+
+-
+ Events (Sprite) Commands
+
+
+
+
+-
+ Narrative Parser Tokens
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
+ -
+ Tutorial Videos
+
+
+
+
+ -
+ Training Course
+
+
+
+
+
+
+
+ -
+ FungusGames.com
+
+ -
+
+ Search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Unity Test Tools
+
+
+ - Example
+
+
+ - Lua Functions
+
+
+
+
+
+
+Unity Test Tools
+If you are using the Unity Test Tools, FungusLua is a powerful and fast way to create integration tests using Lua scripting.
+Example
+
+- Create a new test in the scene.
+- Add a Lua object (Tools > Fungus > Create > Lua) as a child of the test object.
+- In the LuaScript component, use the check() function to assert whatever conditions you need for the test. At the end, call pass().
+
+Example test script:
+-- Check a condition, and output a reason if it fails
+check( myvar < 40, "My var is too big")
+
+-- Just check a condition
+check( myvar > 20 )
+
+-- Test will exit successfully
+pass()
+
+
+If any of the checks fail, then the test fails immediately.
+Lua Functions
+-- Checks if a condition is true
+-- Lua has a built in assert function, so we called this check to avoid conflicting.
+check(c, reason)
+
+-- Pass an integration test
+pass()
+
+-- Fail an integration test
+-- reason: Optional string explaining why the test failed.
+fail(reason)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+ From here you can search these documents. Enter
+ your search terms below.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/getting_started/index.html b/getting_started/index.html
index 37120b67..768a6d99 100644
--- a/getting_started/index.html
+++ b/getting_started/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/glossary/index.html b/glossary/index.html
index 8b792a9a..bdf23b59 100644
--- a/glossary/index.html
+++ b/glossary/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
diff --git a/index.html b/index.html
index b02e9841..66f0a9c0 100644
--- a/index.html
+++ b/index.html
@@ -62,7 +62,7 @@
-
- Documentation
+ Fungus Docs
@@ -223,6 +223,93 @@
+ -
+ FungusLua Docs
+
+
+
+-
+ Overview
+
+
+
+
+-
+ Create Menu
+
+
+
+
+-
+ Lua Environment
+
+
+
+
+-
+ Lua Bindings
+
+
+
+
+-
+ Lua Script
+
+
+
+
+-
+ Lua Utils
+
+
+
+
+-
+ Fungus Module
+
+
+
+
+-
+ Controlling Fungus
+
+
+
+
+-
+ ExecuteLua command
+
+
+
+
+-
+ Preferences
+
+
+
+
+-
+ Lua Store
+
+
+
+
+-
+ String Table
+
+
+
+
+-
+ Unity Test Tools
+
+
+
+
+
+
+
+
-
Tutorial Videos
@@ -288,6 +375,7 @@ Overview
- Download and install instructions
- Tutorial videos
- Fungus Training Course
+- FungusLua scripting system
- Articles by the Fungus community
- Frequently Asked Questions