diff --git a/Docs/command_reference.md b/Docs/command_reference.md index d645ecc9..00f72716 100644 --- a/Docs/command_reference.md +++ b/Docs/command_reference.md @@ -1,6 +1,6 @@ # Command Reference {#command_reference} -Reference documentation for all Fungus commands and event handlers. +This is the reference documentation for all %Fungus commands and event handlers. ## Commands diff --git a/Docs/fungus_lua/create_menu.md b/Docs/fungus_lua/create_menu.md index d0b88a63..02069038 100644 --- a/Docs/fungus_lua/create_menu.md +++ b/Docs/fungus_lua/create_menu.md @@ -1,10 +1,10 @@ # The Create Menu {#lua_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'. +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. +You can also access these prefabs from %Fungus/Thirdparty/FungusLua/Resources/Prefabs. -![Fungus Create Menu](fungus_lua/create_menu.png) +![%Fungus Create Menu](fungus_lua/create_menu.png) # Lua Prefab @@ -22,7 +22,7 @@ When you create a Lua file, add your Lua script to it in a text editor, and then # Lua Environment Prefab -This prefab provides a @ref lua_environment "LuaEnvironment" component for executing Lua script, and the @ref lua_utils "LuaUtils" component which provides useful utilities for working with Lua, Unity and Fungus. +This prefab provides a @ref lua_environment "LuaEnvironment" component for executing Lua script, and the @ref lua_utils "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). diff --git a/Docs/fungus_lua/execute_lua.md b/Docs/fungus_lua/execute_lua.md index f3055d19..dd9e8fde 100644 --- a/Docs/fungus_lua/execute_lua.md +++ b/Docs/fungus_lua/execute_lua.md @@ -10,16 +10,16 @@ You can also 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. +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. -1. Add a Flowchart object (Tools > Fungus > Create > Flowchart). Add some variables to the Flowchart. -2. Add a LuaBindings object (Tools > Fungus > Create > LuaBindings) +1. Add a Flowchart object (Tools > %Fungus > Create > Flowchart). Add some variables to the Flowchart. +2. Add a LuaBindings object (Tools > %Fungus > Create > LuaBindings) 3. Add a binding to the Flowchart gameobject, and select the Flowchart component. 4. In the Flowchart, add an ExecuteLua command in a block to evaluate the complex expression. Store the return value in a Boolean Flowchart variable. 5. 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. +Note: getvar() returns a reference to the %Fungus variable object. To access the value of this variable use the .value property. # Example diff --git a/Docs/fungus_lua/fungus_module.md b/Docs/fungus_lua/fungus_module.md index 1d599936..67785e4d 100644 --- a/Docs/fungus_lua/fungus_module.md +++ b/Docs/fungus_lua/fungus_module.md @@ -1,6 +1,6 @@ -# Fungus Module {#lua_fungus_module} +# %Fungus Module {#lua_fungus_module} -This Lua module provides handy functions for working with Lua, Unity and Fungus. +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. @@ -42,16 +42,16 @@ 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. +The %Fungus module can be used in three modes, controlled by the %Fungus Module option in the LuaUtils component. -1. 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. -2. 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. -3. No Fungus Module: the Fungus module will not be registered. Used if you don't want to use the Fungus module. +1. 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. +2. 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. +3. 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. ```lua --- sub is a function in the Fungus module, mapped to a global variable +-- sub is a function in the %Fungus module, mapped to a global variable -- Use Global Variables sub('a string') diff --git a/Docs/fungus_lua/lua_bindings.md b/Docs/fungus_lua/lua_bindings.md index 7f70566b..af99de82 100644 --- a/Docs/fungus_lua/lua_bindings.md +++ b/Docs/fungus_lua/lua_bindings.md @@ -10,7 +10,7 @@ As well as scene GameObjects and components, you can bind to any Unity object in To setup LuaBindings in your scene: -1. Create a LuaBindings object (Tools > Fungus > Create > LuaBindings) +1. Create a LuaBindings object (Tools > %Fungus > Create > LuaBindings) 2. Drag the Unity object you want to access to the Object field in the Object Bindings list. 3. 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. 4. If the bound object is a GameObject, you can optionally select a component within it to bind to. diff --git a/Docs/fungus_lua/lua_controlling_fungus.md b/Docs/fungus_lua/lua_controlling_fungus.md index eb9e6bb4..0b7acd16 100644 --- a/Docs/fungus_lua/lua_controlling_fungus.md +++ b/Docs/fungus_lua/lua_controlling_fungus.md @@ -1,14 +1,14 @@ -# Controlling Fungus {#lua_controlling_fungus} +# Controlling %Fungus {#lua_controlling_fungus} -The Fungus module provides several functions for working with the standard Fungus narrative features and flowcharts. +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. +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. +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. ```lua -- Display text in a SayDialog @@ -35,7 +35,7 @@ local choice = choose( {"Go left", "Go right"} ) To use a custom SayDialog: -1. Add as SayDialog to the scene (Tools > Fungus > Create > SayDialog) +1. Add as SayDialog to the scene (Tools > %Fungus > Create > SayDialog) 2. Select the Lua object in the hierarchy and find the LuaBindings component. 3. Add a binding to the SayDialog game object, and select the SayDialog component. N.B. Make sure to select the correct component! 4. In Lua script, you can now activate this SayDialog using the setsaydialog() function, by passing the key of the SayDialog binding. @@ -220,11 +220,11 @@ See the docs for the @ref conversation "Conversation System". # 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: +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: 1. Add a Flowchart and a Block (e.g. "MyBlock") in the scene. -2. Add the Fungus commands you want to execute from Lua in the Block. (e.g Play Sound) -3. Add a Lua object to the scene (Tools > Fungus > Create > Lua) +2. Add the %Fungus commands you want to execute from Lua in the Block. (e.g Play Sound) +3. Add a Lua object to the scene (Tools > %Fungus > Create > Lua) 4. In the LuaBindings component, add a binding to the Flowchart gameobject, and select the Flowchart component. 5. In the LuaScript component, use the runblock() function to execute the Block, passing the bound flowchart and name of the block as parameters. diff --git a/Docs/fungus_lua/lua_environment.md b/Docs/fungus_lua/lua_environment.md index 1ece2da7..7b8a32ca 100644 --- a/Docs/fungus_lua/lua_environment.md +++ b/Docs/fungus_lua/lua_environment.md @@ -2,7 +2,7 @@ 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. +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. ![LuaEnvironment](fungus_lua/lua_environment.png) @@ -16,5 +16,5 @@ The 'Remote Debugger' option activates the built-in MoonSharp remote debugger to # 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 @ref lua_utils "Lua Utils" section for more info. +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 @ref lua_utils "Lua Utils" section for more info. diff --git a/Docs/fungus_lua/lua_fungus_module.md b/Docs/fungus_lua/lua_fungus_module.md index 97a978ac..3ed6e200 100644 --- a/Docs/fungus_lua/lua_fungus_module.md +++ b/Docs/fungus_lua/lua_fungus_module.md @@ -1,6 +1,6 @@ -# Fungus Module {#lua_fungus_module} +# %Fungus Module {#lua_fungus_module} -This Lua module provides handy functions for working with Lua, Unity and Fungus. +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. @@ -42,11 +42,11 @@ 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. +The %Fungus module can be used in three modes, controlled by the %Fungus Module option in the LuaUtils component. -1. 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. -2. 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. -3. No Fungus Module: the Fungus module will not be registered. Used if you don't want to use the Fungus module. +1. 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. +2. 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. +3. 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. diff --git a/Docs/fungus_lua/lua_overview.md b/Docs/fungus_lua/lua_overview.md index e959fa19..11613969 100644 --- a/Docs/fungus_lua/lua_overview.md +++ b/Docs/fungus_lua/lua_overview.md @@ -2,11 +2,11 @@ FungusLua is a simple 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. -At its core, FungusLua allows you to control any Unity object from Lua script. It has useful utilities for using Fungus flowcharts and dialogs, persisting variables between scene loads, localization, and working with the Unity Test Tools. +At its core, FungusLua allows you to control any Unity object from Lua script. 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? +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? -FungusLua comes as part of the [Fungus asset] available on the Unity Asset Store. +FungusLua comes as part of the [%Fungus asset] available on the Unity Asset Store. # Tutorial Video @@ -20,12 +20,12 @@ This video shows how to use many of the features available in FungusLua. It's mo # Using FungusLua On Its Own -FungusLua can easily be used on its own if you don't need the rest of the functionality in Fungus. +FungusLua can easily be used on its own if you don't need the rest of the functionality in %Fungus. -1. In the project window, move the Fungus/Thirdparty/FungusLua folder up to the root of the project. -2. Delete the Fungus and FungusExamples folders. +1. In the project window, move the %Fungus/Thirdparty/FungusLua folder up to the root of the project. +2. 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. +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 @@ -44,7 +44,7 @@ FungusLua is essentially a set of wrapper components built on top of MoonSharp w The [MoonSharp tutorials] and [MoonSharp forum] are great resources to learn how MoonSharp works, especially for more advanced usage. [Lua]: http://www.lua.org/about.html -[Fungus asset]: http://u3d.as/f0T +[%Fungus asset]: http://u3d.as/f0T [Programming in Lua]: http://www.lua.org/pil/1.html [MoonSharp]: http://www.moonsharp.org [MoonSharp tutorials]: http://www.moonsharp.org/getting_started.html diff --git a/Docs/fungus_lua/lua_script.md b/Docs/fungus_lua/lua_script.md index 06bf5cbb..1f275d8d 100644 --- a/Docs/fungus_lua/lua_script.md +++ b/Docs/fungus_lua/lua_script.md @@ -1,6 +1,6 @@ # LuaScript {#lua_script} -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). +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). ![LuaScript](fungus_lua/lua_script.png) diff --git a/Docs/fungus_lua/lua_store.md b/Docs/fungus_lua/lua_store.md index b3aa2cba..518308d3 100644 --- a/Docs/fungus_lua/lua_store.md +++ b/Docs/fungus_lua/lua_store.md @@ -6,7 +6,7 @@ The Lua Store component provides an easy way around this when using Lua scriptin # Example -- Add a LuaStore to the first scene in your game (Tools >Fungus > Create > LuaStore). +- Add a LuaStore to the first scene in your game (Tools >%Fungus > Create > LuaStore). - Set variables in the store in Lua, e.g. ```lua diff --git a/Docs/fungus_lua/lua_string_table.md b/Docs/fungus_lua/lua_string_table.md index fc359cb4..cbe69ef4 100644 --- a/Docs/fungus_lua/lua_string_table.md +++ b/Docs/fungus_lua/lua_string_table.md @@ -3,7 +3,7 @@ The LuaUtils component provides support for simple text localisation. 1. Define your language strings in a JSON file and save it in the project assets folder. -2. Add a LuaEnvironment component to your scene - e.g. Tools > Fungus > Create > LuaEnvironment +2. Add a LuaEnvironment component to your scene - e.g. Tools > %Fungus > Create > LuaEnvironment 3. In the LuaUtils component, set the String Table property to reference your JSON file asset. 4. Use the {$VarName} syntax to subsitute a localised string anywhere that string substitution is supported. e.g. in a Lua script: @@ -24,7 +24,7 @@ You can use the {$VarName} syntax anywhere that variable subsitution is supporte - 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(). +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 diff --git a/Docs/fungus_lua/unity_test_tools.md b/Docs/fungus_lua/unity_test_tools.md index dacd870e..61ee0da3 100644 --- a/Docs/fungus_lua/unity_test_tools.md +++ b/Docs/fungus_lua/unity_test_tools.md @@ -5,7 +5,7 @@ If you are using the [Unity Test Tools], FungusLua is a powerful and fast way to # Example 1. Create a new test in the scene. -2. Add a Lua object (Tools > Fungus > Create > Lua) as a child of the test object. +2. Add a Lua object (Tools > %Fungus > Create > Lua) as a child of the test object. 4. 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: