User Tools

Site Tools


hpl2:amnesia:script_language_reference_and_guide:variables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl2:amnesia:script_language_reference_and_guide:variables [2012/12/28 02:14]
thegreatcthulhu
hpl2:amnesia:script_language_reference_and_guide:variables [2012/12/30 01:44] (current)
thegreatcthulhu [Discussion]
Line 134: Line 134:
 </​code>​ </​code>​
  
-<note tip>​Since the engine exposes the SetGlobalVar//​Typename//​() & SetLocalVar//​Typename//​() functions (and their Add- and Get- counterparts) for seting //game variables//,​ where the terms global and local have a slightly different meaning ​then what was presented here for //script variables//,​ here's a table that explains how these predefined functions and script-declared variables compare:</​note>​+<note tip>​Since the engine exposes the SetGlobalVar//​Typename//​() & SetLocalVar//​Typename//​() functions (and their Add- and Get- counterparts) for seting //game variables//,​ where the terms global and local have a slightly different meaning ​than what was presented here for //script variables//,​ here's a table that explains how these predefined functions and script-declared variables compare:</​note>​
  
 {{ :​hpl2:​amnesia:​script_language_reference_and_guide:​variablescope_table.jpg?​direct |}} {{ :​hpl2:​amnesia:​script_language_reference_and_guide:​variablescope_table.jpg?​direct |}}
  
-<note tip>The functions which manipulate global game variables, SetGlobalVar//​Typename//​(),​ AddGlobalVar//​Typename//​() and GetGlobalVar//​Typename//​() [where //​Typename//​ can be either Int, Float, or String], provide a way for you to store and use a value in a storage location which is maintained for the duration of your game (or custom story). It can be accessed from more than one map script, and any changes in one map will be visible from the others. They are global //relative to the maps//.+<note tip>The functions which manipulate global game variables, SetGlobalVar//​Typename//​(),​ AddGlobalVar//​Typename//​() and GetGlobalVar//​Typename//​() [where //​Typename//​ can be either Int, Float, or String], provide a way for you to store and use a value in a storage location which is maintained for the duration of your game (or custom story). It can be accessed from more than one map script, and any changes ​made in one map will be visible from the others. They are global //relative to the maps//.</​note>​
  
-Functions which manipulate local game variables, SetLocalVar//​Typename//​(),​ AddLocalVar//​Typename//​() and GetLocalVar//​Typename//​(),​ allow you to define and use storage locations for the current map script. They are visible from every part of the map script, once set for the first time. So they are //local to that particular map script// (cant use them from a different map), but are //global relative to functions// in that script. In this respect, they are similar to the script variables declared globally (outside any function, or code block).</​note>​+<note tip>Functions which manipulate local game variables, SetLocalVar//​Typename//​(),​ AddLocalVar//​Typename//​() and GetLocalVar//​Typename//​(),​ allow you to define and use storage locations for the current map script. They are visible from every part of the map script, once set for the first time. So they are //local to that particular map script// (can'​t ​use them from a different map), but are //global relative to functions// in that script. In this respect, they are similar to the script variables declared globally (outside any function, or code block).</​note>​
  
 === Simultaneous Declarations === === Simultaneous Declarations ===
Line 165: Line 165:
  
 <code c++> <code c++>
 +// Example: Fictional Help-Script
 +// -----------------------------------
 +
 // Replace these assignments to match the names in your map // Replace these assignments to match the names in your map
 string scriptArea_jumpScare1 = "​Area_JumpScare1";​ string scriptArea_jumpScare1 = "​Area_JumpScare1";​
Line 178: Line 181:
 // ... // ...
  
-// Script ​that uses the variables above (omitted).+// Here goes the code that uses the variables above (omitted)
 +// Note: the script would use a variable wherever the corresponding value would otherwise appear. E.g.: 
 +// FadeIn(screenFadeInTime); ​        // ---> instead of the hard-coded FadeIn(6.0f);​ 
 + 
 +// ...
 </​code>​ </​code>​
  
hpl2/amnesia/script_language_reference_and_guide/variables.1356660849.txt.gz · Last modified: 2012/12/28 02:14 by thegreatcthulhu