ACS built-in functions: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
(→‎Things: Made link)
No edit summary
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
These ACS functions are imported from ZDoom.
These are predefined ACS functions with no [[parameterized linedef specials|parameterized linedef special]] equivalents, accessible only through ACS scripts.
 
NOTE: most of these functions are meant to be compatible with those from ZDoom. For any ones not yet documented on this wiki, you can check the ZDoom wiki. A few of them may be incompletely implemented in Eternity. Don't hesitate to update the wiki in case of any mistakes.  
==Special TID info==
==Special TID info==
For functions affecting things, some TIDs (thing tags) carry special meaning. TID 0 means the activator, and TIDs -1 ... -4 mean each of the four players in the game -- this in an Eternity extension
For functions affecting things, some TIDs (thing tags) carry special meaning. TID 0 means the activator, and TIDs -1 ... -4 mean each of the four players in the game -- this is an Eternity extension
==Sound and music==
==Data type info==
*void ActivatorSound(str sound, int volume)
You may see specifiers such as ''void'', ''str'', ''int'' and others in ACS function signatures. They act as a guide on what kinds of values are expected, but in ACS there really are only two types: '''str''' and '''int''' (and '''str''' internally is merely a string ID number). Most importantly:  
:Starts a sound from script's activator, at the given volume. If there's no activating thing, the sound will be ambient.
*''void'' means that a function should be used as a procedure (command) without returning anything,
*void AmbientSound(str sound, int volume)
*''fixed'' means you can use the decimal point notation: 1.0 is equivalent to 65536, 1.5 to 98304 etc. In ACS, such values are still of '''int''' type, but whether you use the decimal point or not is quite relevant. A value such as 128.0 is ''not'' the same as 128: it's actually equal to 8388608 (no decimal point).
:Starts an ambient sound.
==Function list==
*void LocalAmbientSound(str sound, str volume)
===Sound and music===
:Starts an ambient sound that can only be heard by the activator, normally a player.
*[[ActivatorSound]]
*void PlaySound (int tid, str sound [, int channel [, fixed volume [, bool looping [, fixed attenuation]]]])
*[[AmbientSound]]
*void PlayActorSound (int tid, int sound, int channel, fixed volume, bool looping, fixed attenuation)
*[[LocalAmbientSound]]
*[[PlayActorSound]]
*[[PlaySound]]
*void SectorSound(str sound, int volume);
*void SectorSound(str sound, int volume);
*void SetMusic (str song [, int order [, int unused]])
*void SetMusic (str song [, int order [, int unused]])
*void LocalSetMusic (str song [, int order [, int unused]])
*void LocalSetMusic (str song [, int order [, int unused]])
*void SoundSequence (str sndseq);
*void SoundSequence (str sndseq);
*void SoundSequenceOnActor (int tid, str sndseq);
*[[SoundSequenceOnActor]]
*void StopSound (int tid, int channel);
*void StopSound (int tid, int channel);
*void ThingSound (int tid, str sound, int volume);
*void ThingSound (int tid, str sound, int volume);


==Sectors==
===Sectors===
*void ChangeCeiling(int tag, str flatname)
*void ChangeCeiling(int tag, str flatname)
:Changes the ceiling texture of tagged sectors to flatname.
:Changes the ceiling texture of tagged sectors to flatname.
Line 29: Line 33:
:Gets sector floor height. Currently x and y are reserved for the time Eternity gets working slope physics.
:Gets sector floor height. Currently x and y are reserved for the time Eternity gets working slope physics.
*int GetSectorLightLevel (int tag)
*int GetSectorLightLevel (int tag)
==Things==
===Things===
*[[CheckActorClass]]
*[[CheckActorProperty]]
*bool CheckFlag(int tid, str flag)
:Returns true if the first thing with the given tid has the given flag enabled.
*[[CheckProximity]]
*bool CheckSight(int source, int dest, int flags)
*bool CheckSight(int source, int dest, int flags)
:Returns true if there's a line of sight between at least one thing tagged as source and one thing tagged as dest. Currently flags is reserved and must be 0.
:Returns true if there's a line of sight between at least one thing tagged as source and one thing tagged as dest. Currently flags is reserved and must be 0.
*bool CheckFlag(int tid, str flag)
:Returns true if the first thing with the given tid has the given flag enabled.
*bool CheckActorClass(int tid, str class)
:Returns true if the first thing with the given tid is of the given class.
*[[CheckActorProperty]]
*int ClassifyActor(int tid)
*int ClassifyActor(int tid)
:Checks the kind of thing tagged tid. It returns a set of flags, possibly combined:
:Checks the kind of thing tagged tid. It returns a set of flags, possibly combined:
Line 49: Line 53:
:*ACTOR_WORLD (1): TID is 0 but activator isn't a thing
:*ACTOR_WORLD (1): TID is 0 but activator isn't a thing
*[[GetActorProperty]]
*[[GetActorProperty]]
*[[GetActorVelX]]
*[[GetActorVelY]]
*[[GetActorVelZ]]
*[[IsTIDUsed]]
*[[IsTIDUsed]]
*void SectorDamage (int tag, int amount, str type, str protection_item, int flags)
*void SectorDamage (int tag, int amount, str type, str protection_item, int flags)
*int SetActivator (int tid[, pointer_selector])
*[[SetActivator]]
*bool SetActivatorToTarget (int tid)
*[[SetActivatorToTarget]]
*void SetActorAngle (int tid, fixed angle)
*void SetActorAngle (int tid, fixed angle)
*bool SetActorVelocity (int tid, fixed velx, fixed vely, fixed velz, bool add, bool setbob)
*[[SetActorVelocity]]
*void SetActorPitch (int tid, int pitch)
*void SetActorPitch (int tid, int pitch)
*bool SetActorPosition (int tid, fixed x, fixed y, fixed z, bool fog)
*bool SetActorPosition (int tid, fixed x, fixed y, fixed z, bool fog)
Line 62: Line 69:
*int Spawn (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
*int Spawn (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
*int SpawnForced (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
*int SpawnForced (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
*void SpawnProjectile (int tid, string type, int angle, int speed, int vspeed, int gravity, int newtid);
*[[SpawnProjectile]]
*int SpawnSpot (str classname, int spottid [, int tid [, int angle]])
*int SpawnSpot (str classname, int spottid [, int tid [, int angle]])
*int SpawnSpotForced (str classname, int spottid [, int tid [, int angle]])
*int SpawnSpotFacing (str classname, int spottid [, int tid])
*int SpawnSpotFacing (str classname, int spottid [, int tid])
*int SpawnSpotFacingForced (str classname, int spottid [, int tid])
*[[SpawnSpotFacingForced]]
*[[SpawnSpotForced]]
*int ThingCount (int type, int tid)
*int ThingCount (int type, int tid)
*int ThingCountName (str classname, int tid)
*int ThingCountName (str classname, int tid)
Line 75: Line 82:
*int UniqueTID ([int tid[, int limit]])
*int UniqueTID ([int tid[, int limit]])


==Linedefs and sidedefs==
===Linedefs and sidedefs===
*[[GetLineRowOffset]]
*[[GetLineX]]
*[[GetLineX]]
*[[GetLineY]]
*[[GetLineY]]
Line 83: Line 91:
*void SetLineTexture(int lineid, int line_side, int sidedef_texture, str texturename);
*void SetLineTexture(int lineid, int line_side, int sidedef_texture, str texturename);


==Sky==
===Sky===
*void SetSkyScrollSpeed (int sky, fixed skyspeed);
*[[SetSkyScrollSpeed]]


==Scripts==
===Scripts===
*bool ACS_NamedExecuteAlways(str script, int map, int arg1, int arg2, int arg3)
*bool ACS_NamedExecuteAlways(str script, int map, int arg1, int arg2, int arg3)
:*Executes a named script, starting a new instance if one already exists. Returns true if successfully started.
:*Executes a named script, starting a new instance if one already exists. Returns true if successfully started.
Line 95: Line 103:
*bool ACS_NamedTerminate (string script, int map)
*bool ACS_NamedTerminate (string script, int map)


==Console==
===Console===
*int GetCVar (str cvar)
*int GetCVar (str cvar)
*string GetCVarString (str cvar)
*string GetCVarString (str cvar)
*int GetPlayerInput (int player, int input)
*int GetPlayerInput (int player, int input)
==Polyobjects==
===Polyobjects===
*fixed GetPolyobjX (int po)
*[[GetPolyobjX]]
*fixed GetPolyobjY (int po)
*[[GetPolyobjY]]
==Quake==
 
*void Radius_Quake2 (int tid, int intensity, int duration, int damrad, int tremrad, str sound)
===Quake===
==Math==
*[[Radius_Quake2]]
 
===Math===
*int Random (int min, int max)
*int Random (int min, int max)
*int Sqrt (int number)
*int Sqrt (int number)
*fixed FixedSqrt (fixed number)
*fixed FixedSqrt (fixed number)
*[[VectorAngle]]
*int VectorLength (int x, int y)
*int VectorLength (int x, int y)


==Strings==
===Strings===
*str StrLeft (str string, int length)
*str StrLeft (str string, int length)
*str StrMid (str string, int start, int length)
*str StrMid (str string, int start, int length)
*str StrRight (str string, int length)
*str StrRight (str string, int length)


==Level state==
===Level state===
*[[SetAirControl]]
*[[SetAirControl]]
*[[SetAirFriction]]
*[[SetAirFriction]]
==See also==
*[[Parameterized linedef specials]]


[[Category:ACS]]
[[Category:ACS]]
[[Category:Editing reference]]
[[Category:Editing reference]]

Revision as of 01:46, 24 July 2019

These are predefined ACS functions with no parameterized linedef special equivalents, accessible only through ACS scripts.

NOTE: most of these functions are meant to be compatible with those from ZDoom. For any ones not yet documented on this wiki, you can check the ZDoom wiki. A few of them may be incompletely implemented in Eternity. Don't hesitate to update the wiki in case of any mistakes.

Special TID info

For functions affecting things, some TIDs (thing tags) carry special meaning. TID 0 means the activator, and TIDs -1 ... -4 mean each of the four players in the game -- this is an Eternity extension

Data type info

You may see specifiers such as void, str, int and others in ACS function signatures. They act as a guide on what kinds of values are expected, but in ACS there really are only two types: str and int (and str internally is merely a string ID number). Most importantly:

  • void means that a function should be used as a procedure (command) without returning anything,
  • fixed means you can use the decimal point notation: 1.0 is equivalent to 65536, 1.5 to 98304 etc. In ACS, such values are still of int type, but whether you use the decimal point or not is quite relevant. A value such as 128.0 is not the same as 128: it's actually equal to 8388608 (no decimal point).

Function list

Sound and music

Sectors

  • void ChangeCeiling(int tag, str flatname)
Changes the ceiling texture of tagged sectors to flatname.
  • void ChangeFloor(int tag, str flatname)
Changes the floor texture of tagged sectors to flatname.
  • fixed GetSectorCeilingZ (int tag, int x, int y)
Gets sector ceiling height. Currently x and y are reserved for the time Eternity gets working slope physics.
  • fixed GetSectorFloorZ (int tag, int x, int y)
Gets sector floor height. Currently x and y are reserved for the time Eternity gets working slope physics.
  • int GetSectorLightLevel (int tag)

Things

Returns true if the first thing with the given tid has the given flag enabled.
Returns true if there's a line of sight between at least one thing tagged as source and one thing tagged as dest. Currently flags is reserved and must be 0.
  • int ClassifyActor(int tid)
Checks the kind of thing tagged tid. It returns a set of flags, possibly combined:
  • ACTOR_PLAYER (2): it's player-controlled
  • ACTOR_VOODOODOLL (8): it's a duplicate player start, not controlled by the player but still linked to it. Used in Boom maps for advanced mapping tricks
  • ACTOR_MONSTER (16): it's a monster (has COUNTKILL or KILLABLE thing type flag set)
  • ACTOR_MISSILE (128): it's a projectile in flight (has MISSILE thing type flag set)
  • ACTOR_GENERIC (256): neither a monster, nor a projectile
  • ACTOR_ALIVE (32): has positive health
  • ACTOR_DEAD (64): has health <= 0
  • ACTOR_NONE (0): no thing found with this TID
  • ACTOR_WORLD (1): TID is 0 but activator isn't a thing
  • GetActorProperty
  • GetActorVelX
  • GetActorVelY
  • GetActorVelZ
  • IsTIDUsed
  • void SectorDamage (int tag, int amount, str type, str protection_item, int flags)
  • SetActivator
  • SetActivatorToTarget
  • void SetActorAngle (int tid, fixed angle)
  • SetActorVelocity
  • void SetActorPitch (int tid, int pitch)
  • bool SetActorPosition (int tid, fixed x, fixed y, fixed z, bool fog)
  • void SetThingSpecial (int tid, int special [, int arg0 [, int arg1 [, int arg2 [, int arg3 [, int arg4]]]]])
  • int SetActorState(int tid, str statename[, bool exact]);
  • SetActorProperty
  • int Spawn (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
  • int SpawnForced (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
  • SpawnProjectile
  • int SpawnSpot (str classname, int spottid [, int tid [, int angle]])
  • int SpawnSpotFacing (str classname, int spottid [, int tid])
  • SpawnSpotFacingForced
  • SpawnSpotForced
  • int ThingCount (int type, int tid)
  • int ThingCountName (str classname, int tid)
  • int ThingCountSector (int type, int tid, int tag)
  • int ThingCountNameSector (str classname, int tid, int tag)
  • int Thing_Damage2 (int tid, int amount, str type);
  • void Thing_Projectile2 (int tid, int type, int angle, int speed, int vspeed, int gravity, int newtid)
  • int UniqueTID ([int tid[, int limit]])

Linedefs and sidedefs

  • GetLineRowOffset
  • GetLineX
  • GetLineY
  • LineSide
  • void ReplaceTextures (str oldtexturename, str newtexturename [, int flags])
  • void SetLineSpecial (int lineid, int special [, int arg0 [, int arg1 [, int arg2 [, int arg3 [, int arg4]]]]])
  • void SetLineTexture(int lineid, int line_side, int sidedef_texture, str texturename);

Sky

Scripts

  • bool ACS_NamedExecuteAlways(str script, int map, int arg1, int arg2, int arg3)
  • Executes a named script, starting a new instance if one already exists. Returns true if successfully started.
  • bool ACS_NamedExecute(str script, int map, int arg1, int arg2, int arg3)
  • Executes a named script. Returns true if successfully started.
  • int ACS_NamedExecuteWithResult (string script, int s_arg1, int s_arg2, int s_arg3, int s_arg4)
  • bool ACS_NamedSuspend (string script, int map)
  • bool ACS_NamedTerminate (string script, int map)

Console

  • int GetCVar (str cvar)
  • string GetCVarString (str cvar)
  • int GetPlayerInput (int player, int input)

Polyobjects

Quake

Math

  • int Random (int min, int max)
  • int Sqrt (int number)
  • fixed FixedSqrt (fixed number)
  • VectorAngle
  • int VectorLength (int x, int y)

Strings

  • str StrLeft (str string, int length)
  • str StrMid (str string, int start, int length)
  • str StrRight (str string, int length)

Level state

See also