User Tools

Site Tools


hpl3:community:scripting:script_functions

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:community:scripting:script_functions [2015/10/27 11:39]
romulator Added Main heading and more to the A.I. helper. A.I. is done, Audio is next.
hpl3:community:scripting:script_functions [2015/10/29 07:26] (current)
romulator
Line 1: Line 1:
 ====== Engine Scripts ====== ====== Engine Scripts ======
  
-This page is here as a reference documentation available online covering ​the main script ​functions ​within HPL3The Basic Code section contains scripts that are available by default and found within the **hps_api.hps** file located ​in the SOMA game directory. Under "​Helper Files" you will find the functions ​referenced in the specific helper files which require a script import ​from the script folder.+<​note>​This page is no longer being maintained, ​as all the Engine ​functions ​which this page was aiming to document have since been createdIf you wish to view them, they can be found in HPL3 Documentation/​game/​Scripting/​function_reference by using the sidebar, or you can use [[hpl3:game:​scripting:​function_reference:​hps_api|this link]] to access ​the hps_api ​functions ​and view them from there
  
-**Note: ​This is a work-in-progress ​page. In time, it will contain much more, including all built-in functionshelper files and possibly more.**+This page will eventually be removed. (10-29-2015, Romulator)</​note>​  
 + 
 +This page is here as a reference documentation available online covering the main script functions within HPL3The Basic Code section contains scripts that are available by default and found within the **hps_api.hps** file located ​in the SOMA game directory. Under "​Helper Files" you will find the functions ​referenced in the specific ​helper files which require a script import from the script folder.
  
 +{{:​hpl3:​community:​scripting:​wip-icon.png?​nolink&​}}**Note:​ This is a work-in-progress page. In time, it will contain much more, including all built-in functions, helper files and possibly more.**
 ===== Basic Code ===== ===== Basic Code =====
  
Line 11: Line 14:
 ==== Main ==== ==== Main ====
  
-<code =c++> +<code =c++>#​include <​helper.hps>​
-#include <​helper.hps>​+
 </​code>​ </​code>​
  
 Used to include scripts and referencing from various helper files created outside of the Base Scripts. (Eventually) All the helper files as found in SOMA/​script/​helpers/​ will be included below the main scripts. Used to include scripts and referencing from various helper files created outside of the Base Scripts. (Eventually) All the helper files as found in SOMA/​script/​helpers/​ will be included below the main scripts.
 +
 <code =c++> <code =c++>
 class cScrMap : iScrMap { } class cScrMap : iScrMap { }
Line 22: Line 25:
 A declaration of a class where the map (cScrMap) is able to access functions and reference material from scripts (iScrMap). Your code for your map should go within the braces of this declaration. A declaration of a class where the map (cScrMap) is able to access functions and reference material from scripts (iScrMap). Your code for your map should go within the braces of this declaration.
  
-<code =c++> +<code =c++>​void Setup(){ }
-void Setup(){ }+
 </​code>​ </​code>​
  
 Used when the map is being loaded/​prepared/​set up for the player. Called before OnStart();. Useful for setting up variables in the level. Used when the map is being loaded/​prepared/​set up for the player. Called before OnStart();. Useful for setting up variables in the level.
-<code =c++> + 
-void OnStart(){ }+<code =c++>​void OnStart(){ }
 </​code>​ </​code>​
  
 Called when the player first enters the map, and only on this first occasion. Useful for setting up callbacks. Called when the player first enters the map, and only on this first occasion. Useful for setting up callbacks.
-<code =c++> + 
-void OnEnter(){ }+<code =c++>​void OnEnter(){ }
 </​code>​ </​code>​
  
 Called when the player enters and re-enters the map. Useful for setting up variables and "​hub"​ levels ("​hub"​ meaning, levels that branch off into others). Called when the player enters and re-enters the map. Useful for setting up variables and "​hub"​ levels ("​hub"​ meaning, levels that branch off into others).
-<code =c++> + 
-void OnLeave(){ }+<code =c++>​void OnLeave(){ }
 </​code>​ </​code>​
  
 Called when the player exits the level. Useful for ending certain events which occurred in the previous level (Using Music_Stop() for example). Called when the player exits the level. Useful for ending certain events which occurred in the previous level (Using Music_Stop() for example).
-<code =c++> + 
-void OnAction(){ }+<code =c++>​void OnAction(){ }
 </​code>​ </​code>​
  
 Called when an action is completed. Often used by Frictional Games to debug and test certain events. Called when an action is completed. Often used by Frictional Games to debug and test certain events.
  
-Other callbacks which can be used to perform certain actions [[hpl3:​game:​scripting#​base_classes|can be found here]]. ​+Other callbacks which can be used to perform certain actions [[:hpl3:​game:​scripting|can be found here]].
  
 +==== Billboard ====
 +
 +<code =c++>​void Billboard_SetVisible(const tString &in asBillboardName, ​ bool abVisible);
 +</​code>​
 +
 +Sets whether a billboard should be rendered or not.
 +
 +//​asBillboardName//​ - name of the billboard. Wildcards %%*%% supported.\\
 +//​abVisible//​ - true = visible, false = invisible.
 +==== Body ====
 +
 +<code =c++>​void Body_AddForce(const tString &in asBodyName, ​ const cVector3f &in avForce, ​ bool abLocalSpace);​
 +</​code>​
 +
 +Adds push force to a body.
 +
 +//​asBodyName//​ - the name of the body.\\
 +//avForce// - the push force to apply.\\
 +//​abLocalSpace//​ - true = local force, false = global force.
 +==== Button ====
 +
 +<code =c++>​void Button_SetSwitchedOn(const tString&​ in asName, ​ bool abState, ​ bool abEffects);
 +</​code>​
 +
 +Switches a button on or off.
 +
 +//asName// - name of the button.\\
 +//abState// - true = on, false = off.\\
 +//​abEffects//​ - whether the change should use effects associated with it. If false, the player will not be apparent to the change.
 +==== EnergySource ====
 +
 +<code =c++>​void EnergySource_SetEnergy(const tString &in asName, ​ float afX);
 +</​code>​
 +
 +Sets the energy level of an energy source.
 +
 +//asName// - name of the energy source.\\
 +//afX// - the energy amount.
 ==== Entity ==== ==== Entity ====
  
Line 68: Line 108:
 Set whether an entity is active (visible and functioning) or not. Set whether an entity is active (visible and functioning) or not.
  
-//asName //- the name of the entity (wildcards * are supported).\\+//asName //- the name of the entity (wildcards ​%%*%% are supported).\\
 //abActive //- if active or not. //abActive //- if active or not.
 <code =c++> <code =c++>
Line 76: Line 116:
 Check if an entity is active (visible and functioning) or not. Check if an entity is active (visible and functioning) or not.
  
-//asName// - the name of the entity (wildcards * are supported).+//asName// - the name of the entity (wildcards ​%%*%% are supported).
 <code =c++>​void Entity_SetInteractionDisabled(const tString &in asEntityName, ​ bool abX); <code =c++>​void Entity_SetInteractionDisabled(const tString &in asEntityName, ​ bool abX);
 </​code>​ </​code>​
Line 82: Line 122:
 Sets whether an entity can be interacted with by the player or not. Sets whether an entity can be interacted with by the player or not.
  
-//​asEntityName//​ - the name of the entity (wildcards * are supported).\\+//​asEntityName//​ - the name of the entity (wildcards ​%%*%% are supported).\\
 //abX// - true = interaction disabled | false = interaction enabled. //abX// - true = interaction disabled | false = interaction enabled.
 <code =c++>​void Entity_SetMaxInteractionDistance(const tString &in asEntityName, ​ float afDistance);​ <code =c++>​void Entity_SetMaxInteractionDistance(const tString &in asEntityName, ​ float afDistance);​
Line 89: Line 129:
 Override the default max distance an entity can be interacted with. Override the default max distance an entity can be interacted with.
  
-//​asEntityName//​ - the name of the entity (wildcards * are supported).\\+//​asEntityName//​ - the name of the entity (wildcards ​%%*%% are supported).\\
 //​afDistance//​ - the distance (in meters) the entity can be interacted with from. //​afDistance//​ - the distance (in meters) the entity can be interacted with from.
 <code =c++> <code =c++>
Line 103: Line 143:
 Forces the entity to sleep. This disables Update and PostUpdate. Has no effect if entity is already sleeping. Forces the entity to sleep. This disables Update and PostUpdate. Has no effect if entity is already sleeping.
  
-//asName// - the name of the entity (wildcards * are supported).+//asName// - the name of the entity (wildcards ​%%*%% are supported).
 <code =c++>​void Entity_WakeUp(const tString &in asName); <code =c++>​void Entity_WakeUp(const tString &in asName);
 </​code>​ </​code>​
Line 109: Line 149:
 Wakes a sleeping entity. This enabled Update and PostUpdate. Has no effect if entity is already awake. Wakes a sleeping entity. This enabled Update and PostUpdate. Has no effect if entity is already awake.
  
-//asName// - the name of the entity (wildcards * are supported).+//asName// - the name of the entity (wildcards ​%%*%% are supported).
 <code =c++> <code =c++>
 bool Entity_IsSleeping(const tString &in asName); bool Entity_IsSleeping(const tString &in asName);
Line 122: Line 162:
 Sets whether an entity should automatically sleep when it doesn'​t require updates. Sets whether an entity should automatically sleep when it doesn'​t require updates.
  
-//asName// - the name of the entity (wildcards * are supported).\\+//asName// - the name of the entity (wildcards ​%%*%% are supported).\\
 //abX// - enabled or disabled. //abX// - enabled or disabled.
 <code =c++> <code =c++>
Line 136: Line 176:
 Set whether an entity is an occluder. Set whether an entity is an occluder.
  
-//asName// - the name of the entity (wildcards ​(<​nowiki>​*</​nowiki>​) ​are supported).\\+//asName// - the name of the entity (wildcards ​%%*%% are supported).\\
 //​abOccluder//​ - enabled or disabled. //​abOccluder//​ - enabled or disabled.
 <code =c++> <code =c++>
Line 156: Line 196:
 Sets a value of an entity variable. Sets a value of an entity variable.
  
-//asName// - the name of the entity (wildcards * are supported).\\+//asName// - the name of the entity (wildcards ​%%*%% are supported).\\
 //​asVarName//​ - the name of the variable for the entity.\\ //​asVarName//​ - the name of the variable for the entity.\\
 //aX// - the value of the variable. //aX// - the value of the variable.
Line 167: Line 207:
 Increments a value of an entity variable. Increments a value of an entity variable.
  
-//asName// - the name of the entity (wildcards * are supported).\\+//asName// - the name of the entity (wildcards ​%%*%% are supported).\\
 //​asVarName//​ - the name of the variable for the entity.\\ //​asVarName//​ - the name of the variable for the entity.\\
 //aX// - the value to add. //aX// - the value to add.
Line 184: Line 224:
 //asName// - the name of the entity.\\ //asName// - the name of the entity.\\
 //​asVarName//​ - the name of the variable for the entity. //​asVarName//​ - the name of the variable for the entity.
- +<code =c++>
-<​code=c++>​+
 bool Entity_AddCollideCallback(const tString &in asParentName, ​ const tString &in asChildName, ​ const tString &in asFunction);​ bool Entity_AddCollideCallback(const tString &in asParentName, ​ const tString &in asChildName, ​ const tString &in asFunction);​
 </​code>​ </​code>​
  
-Adds a callback between two entities (objects, areas, player etc) when they collide with each other. Collisions include when "​uncolliding"​ as well. Wildcards * are supported in names.+Adds a callback between two entities (objects, areas, player etc) when they collide with each other. Collisions include when "​uncolliding"​ as well. Wildcards ​%%*%% are supported in names.
  
 //​asParentName//​ - the first entity (for player collisions, this is always the player)\\ //​asParentName//​ - the first entity (for player collisions, this is always the player)\\
Line 196: Line 235:
  
 Callback syntax:\\ Callback syntax:\\
-**FunctionName(const tString &in asParent, const tString &in asChild, int alState)**\\ +**FunctionName(const tString &in asParent, const tString &in asChild, int alState)** \\ 
-//alState// - 1 = colliding, -1 = uncolliding,​ 0 = both.\\+//alState// - 1 = colliding, -1 = uncolliding,​ 0 = both.
  
 **Returns** a boolean of whether the callback is repeated upon completetion. If true, callback can be called again. If false, callback is removed.\\ **Returns** a boolean of whether the callback is repeated upon completetion. If true, callback can be called again. If false, callback is removed.\\
 Abbreviation syntax for the callback function code snippet: **clbCollide** Abbreviation syntax for the callback function code snippet: **clbCollide**
- +<code =c++>
-<​code=c++>​+
 bool Entity_RemoveCollideCallback(const tString &in asParentName, ​ const tString &in asChildName);​ bool Entity_RemoveCollideCallback(const tString &in asParentName, ​ const tString &in asChildName);​
 </​code>​ </​code>​
  
-Removes a callback for entity collisions. Wildcards * supported in names.+Removes a callback for entity collisions. Wildcards ​%%*%% supported in names.
  
 //​asParentName//​ - the first entity (for player collisions, this is always player)\\ //​asParentName//​ - the first entity (for player collisions, this is always player)\\
 //​asChildName//​ - the second entity. //​asChildName//​ - the second entity.
- +<code =c++>
-<​code=c++>​+
 bool Entity_GetCollide(const tString &in asEntityA, ​ const tString &in asEntityB); bool Entity_GetCollide(const tString &in asEntityA, ​ const tString &in asEntityB);
 </​code>​ </​code>​
  
-Check whether two entities are already colliding. Wildcards * are NOT supported.+Check whether two entities are already colliding. Wildcards ​%%*%% are NOT supported.
  
 //​asEntityA//​ - the first entity.\\ //​asEntityA//​ - the first entity.\\
Line 222: Line 259:
 Returns true if colliding, else false. Returns true if colliding, else false.
  
-<​code=c++>​ +<code =c++>​void Entity_SetCollideCharacter(const tString &in asEntityName, ​ bool abActive);
-void Entity_SetCollideCharacter(const tString &in asEntityName, ​ bool abActive);+
 </​code>​ </​code>​
  
 Enable/​disable an entity'​s collision with a character for all bodies in the entity. Enable/​disable an entity'​s collision with a character for all bodies in the entity.
  
-//​asEntityName//​ - the name of the entity. Wildcards * are supported.\\+//​asEntityName//​ - the name of the entity. Wildcards ​%%*%% are supported.\\
 //​abActive//​ - true = collision on, false = collision off. //​abActive//​ - true = collision on, false = collision off.
- +<code =c++>​void Entity_SetCollide(const tString &in asEntityName, ​ bool abActive);
-<​code=c++>​ +
-void Entity_SetCollide(const tString &in asEntityName, ​ bool abActive);+
 </​code>​ </​code>​
  
 Enable/​disable an entity'​s collision for all bodies in the entity. Enable/​disable an entity'​s collision for all bodies in the entity.
  
-//​asEntityName//​ - the name of the entity. Wildcards * are supported.\\+//​asEntityName//​ - the name of the entity. Wildcards ​%%*%% are supported.\\
 //​abActive//​ - true = collision on, false = collision off. //​abActive//​ - true = collision on, false = collision off.
- +<code =c++>​void Entity_SetEffectsActive(const tString &in asEntityName, ​ bool abActive, ​ bool abFadeAndPlaySounds);​
-<​code=c++>​ +
-void Entity_SetEffectsActive(const tString &in asEntityName, ​ bool abActive, ​ bool abFadeAndPlaySounds);​+
 </​code>​ </​code>​
  
 Enables/​disables whether an entity uses effects. Enables/​disables whether an entity uses effects.
  
-//​asEntityName//​ - name of the entity/​prop. Wildcards * are supported.\\+//​asEntityName//​ - name of the entity/​prop. Wildcards ​%%*%% are supported.\\
 //​abActive//​ - true = activates effects, false = deactivates effects.\\ //​abActive//​ - true = activates effects, false = deactivates effects.\\
 //​abFadeAndPlaySounds//​ - if effects should fade in/out and play sounds. //​abFadeAndPlaySounds//​ - if effects should fade in/out and play sounds.
- +<code =c++>​void Entity_SetReflectionVisibility(const tString &in asEntityName, ​ bool abVisibleInReflection, ​ bool abVisibleInWorld);​
-<​code=c++>​ +
-void Entity_SetReflectionVisibility(const tString &in asEntityName, ​ bool abVisibleInReflection, ​ bool abVisibleInWorld);​+
 </​code>​ </​code>​
  
 Sets whether an entity is drawn in reflections or not, and/or in the real world or not. Sets whether an entity is drawn in reflections or not, and/or in the real world or not.
  
-//​asEntityName//​ - the name of the entity. Wildcards * are supported.\\+//​asEntityName//​ - the name of the entity. Wildcards ​%%*%% are supported.\\
 //​abVisibleInReflection//​ - whether the entity is drawn in reflections.\\ //​abVisibleInReflection//​ - whether the entity is drawn in reflections.\\
 //​abVisibleInWorld//​ - whether the entity is drawn in the real world. //​abVisibleInWorld//​ - whether the entity is drawn in the real world.
- +<code =c++>​void Entity_SetEffectBaseColor(const tString &in asEntityName,​ const cColor&​in aColor);
-<​code=c++>​ +
-void Entity_SetEffectBaseColor(const tString &in asEntityName,​ const cColor&​in aColor);+
 </​code>​ </​code>​
  
 Sets the base color for the entity'​s effects. Sets the base color for the entity'​s effects.
  
-//​asEntityName//​ - the name of the entity. Wildcards * are supported.\\+//​asEntityName//​ - the name of the entity. Wildcards ​%%*%% are supported.\\
 //aColor// - the color all effects will be multiplied with. //aColor// - the color all effects will be multiplied with.
- +<code =c++>​void Entity_FadeEffectBaseColor(const tString &in asEntityName,​ const cColor&​in aColor, ​ float afTime);
-<​code=c++>​ +
-void Entity_FadeEffectBaseColor(const tString &in asEntityName,​ const cColor&​in aColor, ​ float afTime);+
 </​code>​ </​code>​
  
 Fades the base color for the entity'​s effects. Fades the base color for the entity'​s effects.
  
-//​asEntityName//​ - the name of the entity. Wildcards * are supported.\\+//​asEntityName//​ - the name of the entity. Wildcards ​%%*%% are supported.\\
 //aColor// - the color all effects will be faded to.\\ //aColor// - the color all effects will be faded to.\\
 //afTime// - the time in seconds the fade takes to finish. //afTime// - the time in seconds the fade takes to finish.
- +<code =c++>​void Entity_SetColorMul(const tString &in asEntityName, ​ const cColor&​in aColor);
-<​code=c++>​ +
-void Entity_SetColorMul(const tString &in asEntityName, ​ const cColor&​in aColor);+
 </​code>​ </​code>​
  
 Sets the color multiplier of the entity. Sets the color multiplier of the entity.
  
-//​asEntityName//​ - the name of the entity. Wildcards * are supported.\\+//​asEntityName//​ - the name of the entity. Wildcards ​%%*%% are supported.\\
 //aColor// - the color to set the multiplier to. //aColor// - the color to set the multiplier to.
- +<code =c++>​void Entity_AddForce(const tString &in asEntityName, ​ const cVector3f &in avForce, ​ bool abLocalSpace, ​ bool abOnlyMainBody);​
-<​code=c++>​ +
-void Entity_AddForce(const tString &in asEntityName, ​ const cVector3f &in avForce, ​ bool abLocalSpace, ​ bool abOnlyMainBody);​+
 </​code>​ </​code>​
  
 Adds a push force to the entity. Adds a push force to the entity.
  
-//​asEntityName//​ - the name of the entity. Wildcards * are supported.\\+//​asEntityName//​ - the name of the entity. Wildcards ​%%*%% are supported.\\
 //avForce// - the force to add.\\ //avForce// - the force to add.\\
 //​abLocalSpace//​ - true = local force is added relative to the rotation of the entity, false = global force is added in a world space\\ //​abLocalSpace//​ - true = local force is added relative to the rotation of the entity, false = global force is added in a world space\\
 //​abOnlyMainBody//​ - true = force is added only to the main body of the entity, false = force is added to all bodies of the entity. //​abOnlyMainBody//​ - true = force is added only to the main body of the entity, false = force is added to all bodies of the entity.
- +<code =c++>​void Entity_AddForceFromEntity(const tString &in asEntityName, ​ const tString &in asForceEntityName, ​ float afForce, ​ bool abOnlyMainBody);​
-<​code=c++>​ +
-void Entity_AddForceFromEntity(const tString &in asEntityName, ​ const tString &in asForceEntityName, ​ float afForce, ​ bool abOnlyMainBody);​+
 </​code>​ </​code>​
  
 Adds a push force to the entity away from another entity. Adds a push force to the entity away from another entity.
  
-//​asEntityName//​ - the name of the entity. Wildcards * are supported.\\+//​asEntityName//​ - the name of the entity. Wildcards ​%%*%% are supported.\\
 //​asForceEntityName//​ - the name of the entity to push away from.\\ //​asForceEntityName//​ - the name of the entity to push away from.\\
 //afForce// - magnitude of the force. Negative values attract the entity to the force entity. //afForce// - magnitude of the force. Negative values attract the entity to the force entity.
 +==== FogArea ====
  
-{{:​hpl3:​community:​scripting:​wip-icon.png?​nolink|}} WORK IN PROGRESS {{:​hpl3:​community:​scripting:​wip-icon.png?​nolink|}}+<code =c++>​void FogArea_SetVisible(const tString &in asFogAreaName, ​ bool abActive);​ 
 +</​code>​
  
-==== Material ====+Sets whether a fog area is visible or not.
  
-<​code=c++>​ +//​asFogAreaName//​ - name of the fog area.\\ 
-void Material_Preload(const tString &​in ​asFile);+//​abActive//​ - true = active, false = inactive. 
 +==== Grab ==== 
 + 
 +<code =c++>​void ​Grab_SetForceMul(const tString&​ in asName, ​ float afForceMul);
 </​code>​ </​code>​
  
-Preloads ​material+Sets the force multiplier of grab prop.
  
-//asFile// - the .mat material file to preload.+//asName// - name of the grab prop.\\ 
 +//​afForceMul//​ - the new multiplier. 
 +==== IrradianceSet ====
  
-==== Prop ====+<​code ​=c++>void IrradianceSet_FadeIn(const tString &in asSet, ​ float afTime); 
 +</​code>​
  
-<​code=c++>​ +Fades in the specified set on all probes belonging to it. This also fades out the currently active set for these probes. 
-void Prop_SetHealth(const tString &​in ​asPropName, ​ float afHealth);+ 
 +//asSet// - the set to fade in.\\ 
 +//afTime// - how long it should take until the fade is done. 
 +==== Joint ==== 
 + 
 +<code =c++> 
 +bool Joint_IsBroken(const tString &​in ​asJointName);
 </​code>​ </​code>​
  
-Sets the health of a prop. Can be used to destroy objects. +Checks whether ​the specified joint is broken.
- +
-//​asPropName//​ - name of the prop. Wildcards * supported.\\ +
-//​afHealth//​ - the health to set.+
  
 +//​asJointName//​ - the name of the joint.
 ==== Lamp ==== ==== Lamp ====
  
-<​code=c++>​ +<code =c++>​void Lamp_SetLit(const tString&​ in asName, ​ bool abLit, ​ bool abEffects);
-void Lamp_SetLit(const tString&​ in asName, ​ bool abLit, ​ bool abEffects);+
 </​code>​ </​code>​
  
Line 343: Line 374:
 //abLit// - true = lamp is lit, false = lamp is unlit.\\ //abLit// - true = lamp is lit, false = lamp is unlit.\\
 //​abEffects//​ - whether the change should use effects associated with it. If false, the change will not be apparent to the player. //​abEffects//​ - whether the change should use effects associated with it. If false, the change will not be apparent to the player.
 +==== LensFlare ====
  
-==== SwingDoor ==== +<code =c++>​void ​LensFlare_SetVisible(const tString &​in ​asLensFlareName,  ​bool abVisible);
- +
-<​code=c++>​ +
-void SwingDoor_SetOpenAmount(const tString&​ in asName,  ​float afOpenAmount);+
 </​code>​ </​code>​
  
-Sets a swing door to a specific open state instantly.+Sets if lens flare should be rendered or not.
  
-//asName// - name of the prop. Wildcards * supported.\\ +//asLensFlareName// - name of lens flare. Wildcards ​%%*%% supported.\\ 
-//afOpenAmount// - closedcompletely open0.5f half state.+//abVisible// - true visiblefalse invisible. 
 +==== LevelDoor ====
  
-==== PhysicsSlideDoor ==== +<code =c++>void LevelDoor_SetLocked(const tString&​ in asName,  bool abState);
- +
-<​code=c++>​ +
-bool PhysicsSlideDoor_GetClosed(const tString&​ in asName);+
 </​code>​ </​code>​
  
-Returns true if the door is closed, else false. +Sets a LevelDoor ​to be locked ​or unlocked.
- +
-//asName// - name of the door. +
- +
-==== SlideDoor ==== +
- +
-<​code=c++>​ +
-void SlideDoor_SetClosed(const tString&​ in asName, ​ bool abClosed, ​ bool abInstant = false); +
-</​code>​ +
- +
-Sets the close state of SlideDoor. Simplified version of SlideDoor_SetOpenAmount. +
- +
-//asName// - name of the door.\\ +
-//​abClosed//​ - true = close, false = open.\\ +
-//​abInstant//​ (optional) - whether the door should slide to the correct state or just have the new position set instantly. +
- +
-==== Slide ==== +
- +
-<​code=c++>​ +
-void Slide_SetSlideAmount(const tString&​ in asName, ​ float afAmount);​ +
-</​code>​ +
- +
-Sets the slide amount of a Slide prop, 0 being its minimum position and 1 being its maximum. +
- +
-//asName// - name of the prop.\\ +
-//​afAmount//​ - the slide amount. +
- +
-==== Wheel ==== +
- +
-<​code=c++>​ +
-int Wheel_GetState(const tString&​ in asName); +
-</​code>​ +
- +
-Gets the state of a wheel. +
- +
-//asName// - name of the wheel. +
- +
-Returns -1 for minimum, 0 for middle, 1 for maximum state.+
  
 +//asName// - name of the level door.\\
 +//abState// - true = locked, false = unlocked.
 ==== Lever ==== ==== Lever ====
  
-<​code=c++>​ +<code =c++>int Lever_GetState(const tString&​ in asName);
-int Lever_GetState(const tString&​ in asName);+
 </​code>​ </​code>​
  
Line 412: Line 403:
 Returns -1 for minimum, 0 for middle, 1 for maximum state. Returns -1 for minimum, 0 for middle, 1 for maximum state.
  
-==== Button ​====+==== Light ====
  
-<​code=c++>​ +<code =c++>​void ​Light_FadeTo(const tString &​in ​asLightName,  ​const cColor &in acColor, ​ float afRadius,  ​float afTime);
-void Button_SetSwitchedOn(const tString&​ in asName,  ​bool abState,  ​bool abEffects);+
 </​code>​ </​code>​
  
-Switches a button on or off.+Fades one or more light objects to a specified color and radius.
  
-//asName// - name of the button.\\ +//asLightName// - name of the light(s). Wildcards %%*%% supported.\\ 
-//abState// - true = on, false = off.\\ +//acColor// - the color to fade to.\\ 
-//abEffects// - whether ​the change should use effects associated with it. If false, the player will not be apparent to the change.+//afRadius// - the radius to fade to. If lower than 0, the current radius is used.\\ 
 +//afTime// - how long it should take until the fade is done. 
 +==== Map ====
  
-==== MovingButton ==== +<code =c++> 
- +bool Map_GetParticleSystemArray(const tString &in asName,  ​array<​cParticleSystem@>​ &inout avOutParticles);
-<​code=c++>​ +
-void MovingButton_SetSwitchedOn(const tString&​ in asName,  ​bool abState, ​ bool abEffects);+
 </​code>​ </​code>​
  
-Switches ​MovingButton on or off.+Creates an array of particle systems with given name.
  
-//asName// - name of the button.\\ +//asName// - name of particle systemsWildcards %%*%% supported.\\ 
-//abState// - true = on, false = off.\\ +//avOutParticles// - reference to array that will be filled with particle systems. 
-//abEffects// - whether the change should use effects associated with it. If false, the player ​will not be apparent to the change.+==== Material ====
  
-==== LevelDoor ==== +<code =c++>​void ​Material_Preload(const tString &​in ​asFile);
- +
-<​code=c++>​ +
-void LevelDoor_SetLocked(const tString&​ in asName, ​ bool abState);+
 </​code>​ </​code>​
  
-Sets LevelDoor to be locked or unlocked. +Preloads ​material
- +
-//asName// - name of the level door.\\ +
-//abState// - true = locked, false = unlocked. +
- +
-==== MoveObject ==== +
- +
-<​code=c++>​ +
-void MoveObject_SetState(const tString&​ in asName, ​ float afState); +
-</​code>​ +
- +
-Sets the state of a move object. This makes it move to a certain position between its minimum and maximum position (or beyond if set to <0 or >1). +
- +
-//asName// - name of the move object.\\ +
-//afState// - the state to set the move object to at speeds defined in the entity file.+
  
 +//asFile// - the .mat material file to preload.
 ==== Meter ==== ==== Meter ====
  
-<​code=c++>​ +<code =c++>​void Meter_SetState(const tString&​ in asName, ​ float afState, ​ bool abFadeToState = true);
-void Meter_SetState(const tString&​ in asName, ​ float afState, ​ bool abFadeToState = true);+
 </​code>​ </​code>​
  
Line 467: Line 440:
  
 //asName// - name of meter object.\\ //asName// - name of meter object.\\
-//afState// - percentage of where the needle should be. 0-1 (minimum position - maximum position). +//afState// - percentage of where the needle should be. 0-1 (minimum position - maximum position). //​abFadeToState//​ - if true, then the needle will fade to the state instead of skipping to it. 
-//​abFadeToState//​ - if true, then the needle will fade to the state instead of skipping to it.+==== MoveObject ====
  
-==== Terminal ==== +<code =c++>​void ​MoveObject_SetState(const tString&​ in asName,  ​float afState);
- +
-<​code=c++>​ +
-void Terminal_SetAllowInteraction(const tString&​ in asName,  ​bool abX);+
 </​code>​ </​code>​
  
-Sets whether ​the terminal should allow interactions from the player.+Sets the state of a move object. This makes it move to a certain position between its minimum and maximum position (or beyond if set to <0 or >1).
  
-//asName// - name of the terminal. Wildcards * are supported.\\ +//asName// - name of the move object.\\ 
-//abX// - true allowed, false denied.+//afState// - the state to set the move object to at speeds defined in the entity file. 
 +==== MovingButton ====
  
-==== Grab ==== +<code =c++>​void ​MovingButton_SetSwitchedOn(const tString&​ in asName,  ​bool abState, ​ bool abEffects);
- +
-<​code=c++>​ +
-void Grab_SetForceMul(const tString&​ in asName,  ​float afForceMul);+
 </​code>​ </​code>​
  
-Sets the force multiplier of grab prop. +Switches ​MovingButton on or off.
- +
-//asName// - name of the grab prop.\\ +
-//​afForceMul//​ - the new multiplier. +
- +
-==== Readable ==== +
- +
-<​code=c++>​ +
-void Readable_SetCloseCallback(const tString &in asName, ​ const tString &in asCallback);​ +
-</​code>​ +
- +
-Sets the close callback of a readable prop. +
- +
-//asName// - name of the readable prop.\\ +
-//​asCallback//​ - name of the callback function. +
- +
-Callback syntax: +
-**void Function(const tString &in asEntity)** +
- +
-==== Tool ==== +
- +
-<​code=c++>​ +
-void Tool_SetAutoHideAfterPickup(const tString &in asName, ​ bool abX); +
-</​code>​ +
- +
-Sets if a tool should be hidden automatically after getting picked up and being displayed for a brief moment. +
- +
-//asName// - name of the tool.\\ +
-//abX// - true = hide automatically,​ false = do not hide. +
- +
-==== EnergySource ==== +
- +
-<​code=c++>​ +
-void EnergySource_SetEnergy(const tString &in asName, ​ float afX); +
-</​code>​ +
- +
-Sets the energy level of an energy source. +
- +
-//asName// - name of the energy source.\\ +
-//afX// - the energy amount.+
  
 +//asName// - name of the button.\\
 +//abState// - true = on, false = off.\\
 +//​abEffects//​ - whether the change should use effects associated with it. If false, the player will not be apparent to the change.
 ==== ParticleSystem ==== ==== ParticleSystem ====
  
-<​code=c++>​+<code =c++>
 cParticleSystem@ ParticleSystem_CreateAtEntity(const tString &in asPSName, ​ const tString &in asPSFile, ​ const tString &in asEntity, ​ bool abAttach); cParticleSystem@ ParticleSystem_CreateAtEntity(const tString &in asPSName, ​ const tString &in asPSFile, ​ const tString &in asEntity, ​ bool abAttach);
 </​code>​ </​code>​
Line 543: Line 475:
 Returns: The created particle system, or null if the function fails. Returns: The created particle system, or null if the function fails.
  
-==== Light ====+==== PhysicsSlideDoor ​====
  
-<​code=c++>​ +<code =c++> 
-void Light_FadeTo(const tString &​in ​asLightName, ​ const cColor &in acColor, ​ float afRadius, ​ float afTime);+bool PhysicsSlideDoor_GetClosed(const tString&​ in asName);
 </​code>​ </​code>​
  
-Fades one or more light objects to a specified color and radius.+Returns true if the door is closed, else false.
  
-//asLightName// - name of the light(s)Wildcards * supported.\\ +//asName// - name of the door
-//acColor// - the color to fade to.\\ +==== Prop ====
-//​afRadius//​ - the radius to fade to. If lower than 0, the current radius is used.\\ +
-//afTime// - how long it should take until the fade is done.+
  
-==== IrradianceSet ==== +<code =c++>​void ​Prop_SetHealth(const tString &​in ​asPropName,  float afHealth);
- +
-<​code=c++>​ +
-void IrradianceSet_FadeIn(const tString &​in ​asSet,  float afTime);+
 </​code>​ </​code>​
  
-Fades in the specified set on all probes belonging ​to it. This also fades out the currently active set for these probes.+Sets the health of a prop. Can be used to destroy objects.
  
-//asSet// - the set to fade in.\\ +//asPropName// - name of the prop. Wildcards %%*%% supported.\\ 
-//afTime// - how long it should take until the fade is done.+//afHealth// - the health to set. 
 +==== Readable ====
  
-==== Billboard ==== +<code =c++>​void ​Readable_SetCloseCallback(const tString &​in ​asName,  ​const tString &in asCallback);
- +
-<​code=c++>​ +
-void Billboard_SetVisible(const tString &​in ​asBillboardName,  ​bool abVisible);+
 </​code>​ </​code>​
  
-Sets whether ​billboard should be rendered or not.+Sets the close callback of readable prop.
  
-//asBillboardName// - name of the billboard. Wildcards * supported.\\ +//asName// - name of the readable prop.\\ 
-//abVisible// - true = visible, false = invisible.+//asCallback// - name of the callback function.
  
-==== LensFlare ​====+Callback syntax: **void Function(const tString &in asEntity)** 
 +==== Slide ====
  
-<​code=c++>​ +<code =c++>​void ​Slide_SetSlideAmount(const tString&​ in asName,  ​float afAmount);
-void LensFlare_SetVisible(const tString &​in ​asLensFlareName,  ​bool abVisible);+
 </​code>​ </​code>​
  
-Sets if lens flare should be rendered or not.+Sets the slide amount of Slide prop, 0 being its minimum position and 1 being its maximum.
  
-//asLensFlareName// - name of lens flare. Wildcards * supported.\\ +//asName// - name of the prop.\\ 
-//abVisible// - true visible, false invisible.+//afAmount// - the slide amount. 
 +==== SlideDoor ====
  
-==== FogArea ==== +<code =c++>​void ​SlideDoor_SetClosed(const tString&​ in asName,  bool abClosed, ​ bool abInstant = false);
- +
-<​code=c++>​ +
-void FogArea_SetVisible(const tString &​in ​asFogAreaName,  bool abActive);+
 </​code>​ </​code>​
  
-Sets whether ​fog area is visible or not.+Sets the close state of SlideDoor. Simplified version of SlideDoor_SetOpenAmount.
  
-//asFogAreaName// - name of the fog area.\\ +//asName// - name of the door.\\ 
-//abActive// - true = active, false = inactive.+//abClosed// - true = close, false = open.\\ 
 +//​abInstant//​ (optional) - whether the door should slide to the correct state or just have the new position set instantly. 
 +==== SwingDoor ====
  
-==== Map ==== +<code =c++>void SwingDoor_SetOpenAmount(const tString&​ in asName,  ​float afOpenAmount);
- +
-<​code=c++>​ +
-bool Map_GetParticleSystemArray(const tString &in asName,  ​array<​cParticleSystem@>​ &inout avOutParticles);+
 </​code>​ </​code>​
  
-Creates an array of particle systems with given name.+Sets swing door to a specific open state instantly.
  
-//asName// - name of particle systems. Wildcards * supported.\\ +//asName// - name of the prop. Wildcards ​%%*%% supported.\\ 
-//avOutParticles// - reference to array that will be filled with particle systems. +//afOpenAmount// - 0 = closed, 1 = completely open. 0.5f = half state
- +==== Terminal ​====
-==== Body ====+
  
-<​code=c++>​ +<code =c++>​void ​Terminal_SetAllowInteraction(const tString&​ in asName,  bool abX);
-void Body_AddForce(const tString &​in ​asBodyName, ​ const cVector3f &in avForce,  bool abLocalSpace);+
 </​code>​ </​code>​
  
-Adds push force to a body.+Sets whether the terminal should allow interactions from the player.
  
-//asBodyName// - the name of the body.\\ +//asName// - name of the terminalWildcards %%*%% are supported.\\ 
-//avForce// - the push force to apply.\\ +//abX// - true = allowed, false = denied. 
-//abLocalSpace// - true = local force, false = global force.+==== Tool ====
  
-==== Joint ====+<​code ​=c++>void Tool_SetAutoHideAfterPickup(const tString &in asName, ​ bool abX); 
 +</​code>​
  
-<​code=c++>​ +Sets if a tool should be hidden automatically after getting picked up and being displayed for a brief moment. 
-bool Joint_IsBroken(const tString &​in ​asJointName);+ 
 +//asName// - name of the tool.\\ 
 +//abX// - true = hide automatically,​ false = do not hide. 
 +==== Wheel ==== 
 + 
 +<code =c++>int Wheel_GetState(const tString&​ in asName);
 </​code>​ </​code>​
  
-Checks whether ​the specified joint is broken.+Gets the state of a wheel.
  
-//asJointName// - the name of the joint.+//asName// - name of the wheel. 
 + 
 +Returns -1 for minimum, 0 for middle, 1 for maximum state.
  
 ===== Helper Files ===== ===== Helper Files =====
Line 714: Line 642:
 </​code>​ </​code>​
  
-Sets if the barkmachine ​is active (this will only affect random sounds)+Plays a voice from the barkmachine ​tied to the entity.
  
 //​asEntityName//​ - name of the entity with the barkmachine.\\ //​asEntityName//​ - name of the entity with the barkmachine.\\
Line 729: Line 657:
 //​asEntityName//​ - name of the entity with the HeadTracker.\\ //​asEntityName//​ - name of the entity with the HeadTracker.\\
 //abX// - if headtracking is enabled or not //abX// - if headtracking is enabled or not
-<code =c++>​bool HeadTracker_IsActive(const tString&​in asEntityName);​+<code =c++> 
 +bool HeadTracker_IsActive(const tString&​in asEntityName);​
 </​code>​ </​code>​
  
Line 749: Line 678:
 //​asEntityName//​ - name of the entity with the HeadTracker.\\ //​asEntityName//​ - name of the entity with the HeadTracker.\\
 //​asTargetEntityName//​ - The target of the tracking. //​asTargetEntityName//​ - The target of the tracking.
-<code =c++>​NPC_SetVoiceName(const tString &in asNpcName, const tString &in asVoiceName);​+<code =c++>void NPC_SetVoiceName(const tString &in asNpcName, const tString &in asVoiceName);​
 </​code>​ </​code>​
  
Line 756: Line 685:
 //​asNpcName//​ - name of the NPC.\\ //​asNpcName//​ - name of the NPC.\\
 //​asVoiceName//​ - name of the voice as defined in the voicehandler file. //​asVoiceName//​ - name of the voice as defined in the voicehandler file.
-<code =c++>​bool NPC_IsTalking(const tString &in asNpcName);+<code =c++> 
 +bool NPC_IsTalking(const tString &in asNpcName);
 </​code>​ </​code>​
  
 Checks if the NPC is being talked to. Checks if the NPC is being talked to.
  
-//​asNpcName//​ - name of the NPC. +//​asNpcName//​ - name of the NPC.
 <code =c++>​void NPC_SetCanBeTalkedTo(const tString &in asNpcName, bool abX); <code =c++>​void NPC_SetCanBeTalkedTo(const tString &in asNpcName, bool abX);
 </​code>​ </​code>​
Line 767: Line 697:
 Sets if the NPC can be talked to (interacted with) Sets if the NPC can be talked to (interacted with)
  
-//​asNpcName//​ - name of the NPC. Wildcard (*) supported.\\+//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 //abX// - if can be talked to. //abX// - if can be talked to.
 <code =c++>​void NPC_SetMainAnimation(const tString &in asNpcName, const tString&​ in asAnim, bool abPlayTransition = true, const tString &in asCallbackFunc="",​ float afFadeTime=0.5,​ bool abGlobalSpace=false);​ <code =c++>​void NPC_SetMainAnimation(const tString &in asNpcName, const tString&​ in asAnim, bool abPlayTransition = true, const tString &in asCallbackFunc="",​ float afFadeTime=0.5,​ bool abGlobalSpace=false);​
Line 774: Line 704:
 Sets if the NPC can be talked to (interacted with) Sets if the NPC can be talked to (interacted with)
  
-//​asNpcName//​ - name of the NPC. Wildcard (*) supported.\\+//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 //asAnim// - The name of the animation.\\ //asAnim// - The name of the animation.\\
 //​abPlayTransition//​ - If a transition animation should be played.\\ //​abPlayTransition//​ - If a transition animation should be played.\\
Line 786: Line 716:
 Plays an extra animation for the NPC. Will return to main animation (see NPC_SetMainAnimation) when done. Plays an extra animation for the NPC. Will return to main animation (see NPC_SetMainAnimation) when done.
  
-//​asNpcName//​ - name of the NPC. Wildcard (*) supported.\\+//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 //asAnim// - The name of the animation.\\ //asAnim// - The name of the animation.\\
 //​afFadeTime//​ - The time it takes to fade in the animation.\\ //​afFadeTime//​ - The time it takes to fade in the animation.\\
Line 796: Line 726:
 Stops all animations for the NPC. Stops all animations for the NPC.
  
-//​asNpcName//​ - name of the NPC. Wildcard (*) supported.\\+//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 //​afFadeTime//​ - The time it takes to fade out. //​afFadeTime//​ - The time it takes to fade out.
 <code =c++>​void NPC_PlayEmotion(const tString &in asNpcName, const tString&​ in asEmotion, float afDuration, float afWeight = 1.0f, float afFadeTime = 0.25f); <code =c++>​void NPC_PlayEmotion(const tString &in asNpcName, const tString&​ in asEmotion, float afDuration, float afWeight = 1.0f, float afFadeTime = 0.25f);
Line 803: Line 733:
 Stops all animations for the NPC. Stops all animations for the NPC.
  
-//​asNpcName//​ - name of the NPC. Wildcard (*) supported.\\+//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 //​asEmotion//​ - name of the emotion, "​Smile/​Sad/​Happy/​Surprised/​Wink/​Wondering/​Angry/​Worried/​Scared"​\\ //​asEmotion//​ - name of the emotion, "​Smile/​Sad/​Happy/​Surprised/​Wink/​Wondering/​Angry/​Worried/​Scared"​\\
 //​afDuration//​ - how long the emotion should be active\\ //​afDuration//​ - how long the emotion should be active\\
Line 813: Line 743:
 Moves the NPC to a path node. Moves the NPC to a path node.
  
-//​asNpcName//​ - name of the NPC. Wildcard (*) supported.\\+//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 //​asNodeName//​ - The name of the path node.\\ //​asNodeName//​ - The name of the path node.\\
 //​asCallbackFunc//​ - The name of callback called when end is reach.\\ //​asCallbackFunc//​ - The name of callback called when end is reach.\\
Line 829: Line 759:
 Adds an entity that the critter should try to avoid the same way it does with the player. Adds an entity that the critter should try to avoid the same way it does with the player.
  
-//​asCritter//​ - name of the Critter. Wildcard (*) supported.\\+//​asCritter//​ - name of the Critter. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 //​asEscapeEntity//​ - The name of the entity to escape from. //​asEscapeEntity//​ - The name of the entity to escape from.
 +
hpl3/community/scripting/script_functions.1445945962.txt.gz · Last modified: 2015/10/27 11:39 by romulator