Changeset 7601 for code/trunk/src/modules/objects/Script.h
- Timestamp:
- Oct 30, 2010, 1:54:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/objects/Script.h
r7486 r7601 28 28 */ 29 29 30 /** 31 @file Script.h 32 @brief Definition of the Script class. 33 @ingroup Objects 34 */ 35 30 36 #ifndef _Script_H__ 31 37 #define _Script_H__ … … 42 48 { 43 49 50 /** 51 @brief The mode a specific @ref orxonox::Script "Script" is in. 52 */ 44 53 namespace ScriptMode 45 54 { 46 //! Modes of the Script class.47 55 enum Value 48 56 { 49 normal, 50 lua 57 normal, //!< The @ref orxonox::Script "Scripts'" code is executed through the @ref orxonox::CommandExecutor "CommandExecutor". 58 lua //!< The @ref orxonox::Script "Scripts'" code is executed through lua. 51 59 }; 52 60 } … … 56 64 The Script class lets you execute a piece of code, either the normal way or in lua, through XML. It can be specified whether the code is executed upon loading (creation) of the object. Additionally the code is executed each time a trigger event comes in. 57 65 There are three parameters: 58 'code':The code that should be executed.59 'mode': The mode, specifying whether the set code should be executed the normal way ('normal') or in lua ('lua'). Default is 'normal'.60 'onLoad': Whether the code is executed upon loading (creation) of this object. If this is set the code is executed ofr all players, regardless of the value of parameter 'forAll'. Default is true.61 'needsGraphics':Whether the code needs graphics to be executed or not. Default is false.62 'forAll': Whether the code is executed for all players each time the Script is triggered or jut for the player triggering the Script. If forAll is false, which is default, the event that triggers the Script must come from a PlayerTrigger.66 - @b code The code that should be executed. 67 - @b mode The mode, specifying whether the set code should be executed the normal way (<em>normal</em>) or in lua (<em>lua</em>). Default is <em>normal</em>. 68 - @b onLoad Whether the code is executed upon loading (creation) of this object. If this is set the code is executed ofr all players, regardless of the value of parameter <em>forAll</em>. Default is true. 69 - @b needsGraphics Whether the code needs graphics to be executed or not. Default is false. 70 - @b forAll Whether the code is executed for all players each time the Script is triggered or jut for the player triggering the Script. If forAll is false, which is default, the event that triggers the Script must come from a @ref orxonox::PlayerTrigger "PlayerTrigger". 63 71 64 72 Here are two examples illustrating the usage: … … 66 74 <Script code="showGUI QuestGUI" needsGraphics=true /> 67 75 @endcode 68 This would show the QuestGUI opon creation of the object. The mode is 'normal', not specified here since that is the default, also onLoad is true, also not specified, since it is the default as well. Also needsGraphicsis set to true because showGUI needs graphics to work.76 This would show the QuestGUI opon creation of the object. The <em>mode</em> is <em>normal</em>, not specified here since that is the default, also <em>onLoad</em> is true, also not specified, since it is the default as well. Also <em>needsGraphics</em> is set to true because showGUI needs graphics to work. 69 77 70 78 @code … … 77 85 </Script> 78 86 @endcode 79 This would hide the QuestGUI as soon as a Pawn got in range of the DistanceTrigger. The mode is 'normal', it is specified here, but could be ommitted as well, since it is the default. OnLoad is false, that is why it can't be ommitted. Also needsGraphics is set to true because showGUI needs graphics to work. 87 This would hide the QuestGUI as soon as a @ref orxonox::Pawn "Pawn" got in range of the @ref orxonox::DistanceTrigger "DistanceTrigger". The mode is <em>normal</em>, it is specified here, but could be ommitted as well, since it is the default. <em>OnLoad</em> is false, that is why it can't be ommitted. Also <em>needsGraphics</em> is set to true because showGUI needs graphics to work. 88 80 89 @author 81 90 Benjamin Knecht
Note: See TracChangeset
for help on using the changeset viewer.