Difference between revisions of "QuickScripts"
m (→SDL BoolShowHide: Add optional setting for SDL Variable name (PyPRP commit 5ff48e510bcd)) |
(add some links to SDL page) |
||
Line 9: | Line 9: | ||
== StateAnimation == | == StateAnimation == | ||
− | A QuickScript for animations with two states. For example a door which opens and closes. The open and closed states are saved to a SDL variable. The SDL variable is controlled by Python script. Don't worry about that because we are using Cyan's global Python files. You don't have to write a single byte of Python code. | + | A QuickScript for animations with two states. For example a door which opens and closes. The open and closed states are saved to a SDL variable (see the [[SDL|SDL documentation]] and [[Using SDL States]]). The SDL variable is controlled by Python script. Don't worry about that because we are using Cyan's global Python files. You don't have to write a single byte of Python code. |
=== QuickScript Settings === | === QuickScript Settings === | ||
Line 52: | Line 52: | ||
</pre> | </pre> | ||
*''region:'' The region around your clickable object. See also [[How to make an Object Clickable]]. | *''region:'' The region around your clickable object. See also [[How to make an Object Clickable]]. | ||
− | *''sdlname:'' The name of your SDL variable. If your animated object is a door you probably should call it something like DoorOpen. DEFAULT=0 means that the door is initially closed. See also [[ | + | *''sdlname:'' The name of your SDL variable. If your animated object is a door you probably should call it something like DoorOpen. DEFAULT=0 means that the door is initially closed. See also the [[SDL|SDL documentation]]. Example SDL file: |
VAR BOOL DoorOpen[1] DEFAULT=0 | VAR BOOL DoorOpen[1] DEFAULT=0 | ||
*''facevalue:'' The tolerance for the facing condition. Optional (default = no facing condition). This was thrown in for completeness sake but you can leave it out if you don't need it. The facing condition is discussed here: [[How to make an Object Clickable#Facing condition]]. | *''facevalue:'' The tolerance for the facing condition. Optional (default = no facing condition). This was thrown in for completeness sake but you can leave it out if you don't need it. The facing condition is discussed here: [[How to make an Object Clickable#Facing condition]]. | ||
Line 113: | Line 113: | ||
This QuickScript creates a Conditional Object. This is an object controlled by a special type of SDL variable, which shows or hides an object as the age loads. If the SDL state changes the visibility of the object will immediately conform to it. | This QuickScript creates a Conditional Object. This is an object controlled by a special type of SDL variable, which shows or hides an object as the age loads. If the SDL state changes the visibility of the object will immediately conform to it. | ||
− | There is a minimal amount of Python programming required in order to switch your SDL state (see [[Using SDL States]]), but the rest will be handled by the global Python script. | + | There is a minimal amount of Python programming required in order to switch your SDL state (see the [[SDL|SDL documentation]] and [[Using SDL States]]), but the rest will be handled by the global Python script. |
=== QuickScript Settings === | === QuickScript Settings === | ||
Line 168: | Line 168: | ||
Why do we need a region for this? In a multiplayer environment the object could show up right under the nose of another player. A strategically placed region prevents that. As long as there is a player in the region the visibility state of the object does not change. | Why do we need a region for this? In a multiplayer environment the object could show up right under the nose of another player. A strategically placed region prevents that. As long as there is a player in the region the visibility state of the object does not change. | ||
− | Now place the following variables in the age SDL file. | + | Now place the following variables in the age SDL file (see the [[SDL|SDL documentation]] and [[Using SDL States]]). |
<pre> | <pre> | ||
Line 193: | Line 193: | ||
A QuickScript which can be used for clickable objects that should only become clickable once certain conditions are met. ''For example:'' The player must pull lever A first in order to power up button B. ''Or another example:'' Make a control panel unclickable if someone else is already using it. | A QuickScript which can be used for clickable objects that should only become clickable once certain conditions are met. ''For example:'' The player must pull lever A first in order to power up button B. ''Or another example:'' Make a control panel unclickable if someone else is already using it. | ||
− | There is a minimal amount of Python programming required in order to switch your SDL state (see [[Using SDL States]]), but the rest will be handled by the global Python script. | + | There is a minimal amount of Python programming required in order to switch your SDL state (see the [[SDL|SDL documentation]] and [[Using SDL States]]), but the rest will be handled by the global Python script. |
''Note:'' This currently works only in combination with the SimpleClick or StateAnimation QuickScripts (reason = there must be a known activator). | ''Note:'' This currently works only in combination with the SimpleClick or StateAnimation QuickScripts (reason = there must be a known activator). |
Latest revision as of 06:15, 8 July 2015
Contents
About QuickScript
QuickScript is the shorthand version of AlcScript. It does not replace AlcScript but writes a full AlcScript in the background. While QuickScript is relatively easy to use its possibilities are limited. It cannot create complex processes!
Those who are eager to learn more about the Plasma engine are advised not to use QuickScript but instead use AlcScript, which more closely follows the logic of the Plasma engine.
StateAnimation
A QuickScript for animations with two states. For example a door which opens and closes. The open and closed states are saved to a SDL variable (see the SDL documentation and Using SDL States). The SDL variable is controlled by Python script. Don't worry about that because we are using Cyan's global Python files. You don't have to write a single byte of Python code.
QuickScript Settings
<clickable object>: quickscript: stateanimation: objectname: <animated object> region: <clickable region> sdlname: <sdl variable> facevalue: <tolerance for facing condition> clicktimeout: <time to disable clickable> avatar: animation: <avatar animation> animtarget: <avatar animation target> marker: <callback marker> forewards: animation: <opening animation> animsound: <opening sound emitter> clickanim: <clickable opening animation> clicksound: <clickable opening sound emitter> backwards: animation: <closing animation> animsound: <closing sound emitter> clickanim: <clickable closing animation> clickreverse: <true | false> clicksound: <clickable closing sound emitter>
General info: Leave out the <> characters. These are variables you need to replace with your own object names. Leave out the | character as well. It means you can use only one of the choices given (true or false).
Settings Explained
- objectname: This is your animated object. Since we are using a clickable to activate the animation we have to make sure it does not start automatically or keeps looping once it has started. For more information about setting up animations see Animations.
<animated object>: animations: - name: <opening animation> autostart: 0 loop: 0
- region: The region around your clickable object. See also How to make an Object Clickable.
- sdlname: The name of your SDL variable. If your animated object is a door you probably should call it something like DoorOpen. DEFAULT=0 means that the door is initially closed. See also the SDL documentation. Example SDL file:
VAR BOOL DoorOpen[1] DEFAULT=0
- facevalue: The tolerance for the facing condition. Optional (default = no facing condition). This was thrown in for completeness sake but you can leave it out if you don't need it. The facing condition is discussed here: How to make an Object Clickable#Facing condition.
- clicktimeout: Disables the hotspot of the clickable object during the time you set here. Optional (default = no time out). Leave this out if you do not need it. The time is a float value (for example 3.5).
- avatar: Here you can set parameters for the avatar animation. These are optional. So again you can leave this out of your script if you do not need it.
- animation: The name of the avatar animation without the Male/Female prefix.
- animtarget: The name of an empty object placed at the position where you want the avatar animation to start.
- marker: You can optionally specify the name of a callback marker within the avatar animation you use. By default the callback will be the end of the animation.
- forewards: This is where you set the variables for the "opening" or "forwards" animation. The spelling of "forewards" is not an error but is kept consistent with the full AlcScript which in turn conforms to Cyan's spelling.
- animation: The name of your opening animation.
- animsound: The name of the emitter object for the opening sound. Optional. See also Adding Sounds I.
- clickanim: The name of the opening animation for the clickable object (for example a door button). Optional.
- clicksound: The name of the emitter object for the opening sound of the clickable. Optional.
- backwards: This is where you set the variables for the "closing" or "backwards" animation.
- animation: The name of your closing animation. If it is the same as the opening animation that animation will be automatically reversed.
- animsound: The name of the emitter object for the closing sound. Optional. Can be the same as the opening sound.
- clickanim: The name of the closing animation for the clickable object (for example a door button). Optional. Can be the same as the opening clickable object animation.
- clickreverse: Optional. The closing animation for the clickable object (if any) will not be reversed by default if it is the same as the opening animation. Setting this to true will play the opening clickable object animation backwards. Setting this to false is effectively similar to simply omitting this line. This setting is ignored if opening and closing clickable object animations are different.
- clicksound: The name of the emitter object for the closing sound of the clickable. Optional. It can be the same as the opening sound.
SimpleClick
documentation in progress (outdated info here: How to make an Object Clickable#The simpleclick quickscript
QuickScript Settings
documentation in progress
Settings Explained
documentation in progress
SelfAnimation
Makes the avatar do an animation when entering a region. See also Avatar Animations.
QuickScript Settings
<region>: quickscript: selfanimation: animation: <avatar animation name> animtarget: <seekpoint empty>
Settings Explained
- animation: The name of the avatar animation without the Male/Female prefix.
- animtarget: The name of an empty object placed at the position where you want the avatar animation to start.
SDL BoolShowHide
Uses global Python script: xAgeSDLBoolShowHide
This QuickScript creates a Conditional Object. This is an object controlled by a special type of SDL variable, which shows or hides an object as the age loads. If the SDL state changes the visibility of the object will immediately conform to it.
There is a minimal amount of Python programming required in order to switch your SDL state (see the SDL documentation and Using SDL States), but the rest will be handled by the global Python script.
QuickScript Settings
<object name>: quickscript: sdl: type: boolshowhide name: <SDLVariablename>
Settings Explained
The "name" setting is optional. If provided, <SDLVariablename> will be used as the SDL variable name. This is useful if you want multiple objects to be controlled by a single variable. If no "name" setting is specified, the <object name> will be used instead, and the QuickScript will create a reference to an SDL variable <object name>Vis. The "Vis" suffix is added automatically!
So for the above example (but without the "name" setting used) your SDL file would look like this.
STATEDESC <your age name> { VERSION 1 VAR BOOL <object name>Vis[1] DEFAULT=1 DEFAULTOPTION=VAULT }
The SDL value is a boolean so its initial state can be either 0 (invisible) or 1 (visible).
SDL RandomBool
Uses global Python script: xRandomBoolChange
Remember that random Yeesha page in the Neighborhoods? Or the elusive Bahro stone by the Ferry Terminal? That trick was done with a Random Conditional Object.
There is no Python programming required for this. Everything will be handled by the global Python script.
QuickScript Settings
<object name>: quickscript: sdl: type: randombool region: <region name>
Settings Explained
Replace <object name> with the name of your object and replace <region name> with the name of your region.
Why do we need a region for this? In a multiplayer environment the object could show up right under the nose of another player. A strategically placed region prevents that. As long as there is a player in the region the visibility state of the object does not change.
Now place the following variables in the age SDL file (see the SDL documentation and Using SDL States).
STATEDESC <your age name> { VERSION 1 # Random object VAR BOOL <object name>Vis[1] DEFAULT=1 DEFAULTOPTION=VAULT VAR BOOL <object name>Enabled[1] DEFAULT=1 DEFAULTOPTION=VAULT VAR BYTE <object name>Chance[1] DEFAULT=50 DEFAULTOPTION=VAULT VAR BOOL <object name>Proximity[1] DEFAULT=0 DEFAULTOPTION=VAULT }
The boolean values can be either 0 or 1, but use the above settings if you want this enabled by default. The chance variable can be any number between 0 and 100. Do not use a chance of 0 because that makes the object always show up (and all your work would be for nothing).
SDL IntActEnabler
Uses global Python script: xAgeSDLIntActEnabler
A QuickScript which can be used for clickable objects that should only become clickable once certain conditions are met. For example: The player must pull lever A first in order to power up button B. Or another example: Make a control panel unclickable if someone else is already using it.
There is a minimal amount of Python programming required in order to switch your SDL state (see the SDL documentation and Using SDL States), but the rest will be handled by the global Python script.
Note: This currently works only in combination with the SimpleClick or StateAnimation QuickScripts (reason = there must be a known activator).
QuickScript Settings
<object name>: quickscript: sdl: type: intactenabler
Settings Explained
Replace <object name> with the name of your object. The QuickScript will create a reference to an SDL variable <object name>Func. The "Func" suffix is added automatically!
STATEDESC <your age name> { VERSION 1 VAR BOOL <object name>Func[1] DEFAULT=0 DEFAULTOPTION=VAULT }
Setting the SDL Value to 1 makes the object clickable.