Browse Source

Added variable overview to documentation

master
desktop-maesty/steve 6 years ago
parent
commit
3814fbfcf3
  1. 5
      Docs/fungus_docs/text_variation_system.md
  2. 79
      Docs/fungus_docs/variables.md
  3. BIN
      Docs/resources/variables/variable_add_button.png
  4. BIN
      Docs/resources/variables/variable_data.png
  5. BIN
      Docs/resources/variables/variable_data_type.png
  6. BIN
      Docs/resources/variables/variable_highlight.png
  7. BIN
      Docs/resources/variables/variable_inspector.png
  8. BIN
      Docs/resources/variables/variable_scope.png
  9. BIN
      Docs/resources/variables/variable_window.png
  10. 1
      Docs/top_pages/mainpage.md

5
Docs/fungus_docs/text_variation_system.md

@ -1,4 +1,5 @@
# Text Variation System # {#text_variation_system} # Text Variation System # {#text_variation_system}
[TOC]
A system for selecting a sub section of a larger string. Allows for simple changes to occur within the same block of text, instead of having to create multiple commands. The Text Variation System is inspired by [Ink]'s [Variable Text system](https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#6-variable-text). Fungus' Writer and Menu classes currently use this system, as such Say, Menu and Conversation commands can make use of it. Fungus Lua actions that result in Lua passing strings to the Fungus Writer or Menu will also work. A system for selecting a sub section of a larger string. Allows for simple changes to occur within the same block of text, instead of having to create multiple commands. The Text Variation System is inspired by [Ink]'s [Variable Text system](https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#6-variable-text). Fungus' Writer and Menu classes currently use this system, as such Say, Menu and Conversation commands can make use of it. Fungus Lua actions that result in Lua passing strings to the Fungus Writer or Menu will also work.
@ -18,7 +19,7 @@ This behaviour can be modified with certain characters at the start of the [], e
- ! does not hold the final element, it instead returns empty for the varying section - ! does not hold the final element, it instead returns empty for the varying section
- ~ chooses a random element every time it is encountered - ~ chooses a random element every time it is encountered
##Example Usage## # Example Usage # {#example}
In a simple case you may want to have a line read differently the first time the user encounters it. Perhaps a shop keeper, first time they say In a simple case you may want to have a line read differently the first time the user encounters it. Perhaps a shop keeper, first time they say
``` ```
@ -50,7 +51,7 @@ We could do a variation of
For a more complete and thorough example, see example scene at FungusExamples\VariationText\TextVariation.unity For a more complete and thorough example, see example scene at FungusExamples\VariationText\TextVariation.unity
##Future Work## # Future Work # {#future_work}
* Bundling of state tracking of variations so they can be saved along with other fungus data in save files * Bundling of state tracking of variations so they can be saved along with other fungus data in save files
* Loading and Unbundling of state tracking for variations so that variations can continue across instances of the applications life. * Loading and Unbundling of state tracking for variations so that variations can continue across instances of the applications life.

79
Docs/fungus_docs/variables.md

@ -0,0 +1,79 @@
# Variables # {#variables}
[TOC]
%Fungus Variables live on flowcharts. Acting like a blackboard, they allow Commands, Blocks and Flowcharts to set and share data.
<!-- **************************************************** -->
# What is a Variable? # {#variable}
If you have scripted or programmed before you are most likely familiar with the concept. At it's most simple, a variable is a named place or location to keep data. Since variables in %fungus live on Flowcharts they exist for the life of the flowchart.
They are commonly used to keep track of progress or choices made by the player. They are also commonly used to pass data from one command to another.
Variables do not automatically save and restore themselves between runs of the application. The saving mechanisms can, however, be used to load and save variables to disk.
<!-- **************************************************** -->
# The Variable list # {#variable_list_window}
they are in the flowchart window
![variable window]
also on the flowchart inspector
![variable inspector]
The large variable button toggles showing the variable list. Hiding it can be useful when you have a large number of variables on a flowchart and need the extra screen real estate to see the flowchart blocks within the window or other components on the GameObject you want to be able to see.
This is where fungus variables are added (created) and removed. Clicking the plus button shows a menu to select the type of variable to add. Pressing the minus button will remove the currently selected variable from the list.
![variable add button]
Variables will highlight when they are being referenced by the currently selected %Commmand.
![variable highlight]
Each variable needs a name, this is how it is shown to you in command drop downs and how it is referred to when using variable substitution within strings. You can set the value of variables directly in the variable list for most variable types. In all cases you will want to make sure that the starting value makes sense. For example, an Integer variable called Lives, might want to start at 3.
<!-- **************************************************** -->
# What is a Variable Type? # {#variable_type}
Mimicing c#, %Fungus Variables declare the type of data they are going to contain.
![variable data type]
Simple applications will most commonly use Booleans, variables that hold either true or false, and Strings, Unicode characters, such as words, sentences and paragraphs.
<!-- **************************************************** -->
# What is Variable Scope? # {#variable_scope}
The scope of the variable determines how the variable is used by fungus and how it is exposed to other parts of the system.
![variable scope]
Presently these can be set to, private, public or global.
Private is not directly available to other flowcharts. Indicating that the variable is only relevant and only to be used by the flowchart it is declared on. This does not limit its ability to be used by commands.
Public indicates that the variable can be found and is intended to be used or modified by other flowcharts. Those other flowcharts will need to be able to directly access the flowchart the variable is declared on to modify it. Public also makes the variable available to other flowcharts during variable substitution.
Global allow for sharing state among all flowcharts, without direct access to the other flowcharts. It also allows for the value of the variable to outlive the flowchart that declared it. All flowcharts that have a variable of the same type and name and are global access have the same underlying value, stored on the FungusManager.
During variable substitution, the flowchart looks for name matches on itself. Then public variables on all active flowcharts.
<!-- **************************************************** -->
# What is a Fungus Variable Data? # {#variable_data}
Commands within blocks may use either a Variable reference directly or a Variable Data. Variable Data is a mechanism for %Fungus to use either a Fungus Variable or a manually entered value of the same type. This allows for more generic commands.
![variable data]
[variable window]: ./variables/variable_window.png "Variable section of the flowchart window"
[variable inspector]: ./variables/variable_inspector.png "Variable section of the flowchart inspector"
[variable add button]: ./variables/variable_add_button.png "Plus button shows selection of variable types to add."
[variable highlight]: ./variables/variable_highlight.png "The variable(s) being referenced by the current command are highlighted in the list."
[variable data type]: ./variables/variable_data_type.png "Fungus supports a number of types of variables"
[variable scope]: ./variables/variable_scope.png "Scope determines where and how the variable is accessable."
[variable data]: ./variables/variable_data.png "Data with a manual value entered. The drop down shows the compatible variable types on this flowchart that could be used instead of the manually entered value."
<!--
-adding your own variables to fungus
-variableinfo
-variableproperty
-accessing variable in c# code
-->

BIN
Docs/resources/variables/variable_add_button.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
Docs/resources/variables/variable_data.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
Docs/resources/variables/variable_data_type.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
Docs/resources/variables/variable_highlight.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
Docs/resources/variables/variable_inspector.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
Docs/resources/variables/variable_scope.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
Docs/resources/variables/variable_window.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

1
Docs/top_pages/mainpage.md

@ -11,6 +11,7 @@ There's a wide range of training material available here, suitable for both begi
* @subpage getting_started * @subpage getting_started
* @subpage flowcharts * @subpage flowcharts
* @subpage blocks * @subpage blocks
* @subpage variables
* @subpage telling_a_story * @subpage telling_a_story
* @subpage playing_audio * @subpage playing_audio
* @subpage conversation_system * @subpage conversation_system

Loading…
Cancel
Save