This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
functions:zdoom [2016/08/10 13:04] – [RestoreActivator] korshun | functions:zdoom [2016/09/13 17:05] – [ChangeActorFlag] korshun | ||
---|---|---|---|
Line 5: | Line 5: | ||
'' | '' | ||
- | ===== Engine information ===== | ||
- | |||
- | ==== IsZandronum ==== | ||
- | '' | ||
- | |||
- | Returns true if the mod is being played in Zandronum. | ||
- | |||
- | **Example** | ||
- | |||
- | if (IsZandronum()) | ||
- | // Use workarounds | ||
- | else | ||
- | // Use ZDoom 2.7.1 features | ||
- | | ||
===== CVar functions ===== | ===== CVar functions ===== | ||
Line 34: | Line 20: | ||
Returns the value of the given integer CVar divided by 100. If the integer value of the CVar could not be retrieved, returns 0. This is useful for CVars that are percentages. | Returns the value of the given integer CVar divided by 100. If the integer value of the CVar could not be retrieved, returns 0. This is useful for CVars that are percentages. | ||
+ | ===== Internationalization ===== | ||
+ | |||
+ | ==== lang ==== | ||
+ | '' | ||
+ | |||
+ | Returns a translated string from [[zdoom> | ||
+ | |||
+ | ===== Functions for mappers ===== | ||
+ | |||
+ | ==== SyncSpeed ==== | ||
+ | '' | ||
+ | |||
+ | [[zdoom> | ||
+ | |||
+ | FIXME Needs proper documentation FIXME | ||
===== Video settings information ===== | ===== Video settings information ===== | ||
Line 43: | Line 44: | ||
Returns the aspect ratio of the current resolution as a fixed-point number. | Returns the aspect ratio of the current resolution as a fixed-point number. | ||
- | |||
- | ==== IsOpenGL ==== | ||
- | '' | ||
- | |||
- | Returns true if the OpenGL renderer is being used at the moment, false if software. | ||
- | |||
- | When used serverside, this function always returns true and emits a ProgramError. | ||
- | |||
- | <note important> | ||
- | * '' | ||
- | * A config from GZDoom or Zandronum used in ZDoom and having '' | ||
- | </ | ||
==== ScreenHeight ==== | ==== ScreenHeight ==== | ||
Line 79: | Line 68: | ||
'' | '' | ||
- | Clears the HudMessage with the given id. A shorthand for '' | + | Clears the HudMessage with the given id for the activator. A shorthand for '' |
+ | |||
+ | ==== ClearHudMessageBold ==== | ||
+ | '' | ||
+ | |||
+ | Clears the HudMessage with the given id for all players (serverside) or the client (clientside). A shorthand for '' | ||
===== Inventory functions ===== | ===== Inventory functions ===== | ||
Line 134: | Line 128: | ||
Same as ToggleInventory, | Same as ToggleInventory, | ||
- | ===== Player information functions | + | ===== Actor property shorthands |
- | ==== PlayerName ==== | + | Not only are these shorter than '' |
- | '' | + | |
- | Returns | + | There are shorthands for the following properties: |
+ | * Health | ||
+ | * SpawnHealth | ||
+ | * Speed | ||
- | ==== PlayerIsConnected | + | ==== GetActor< |
- | '' | + | '' |
- | Returns | + | Returns the < |
- | ==== BotCount | + | ==== SetActor< |
- | '' | + | '' |
- | Returns | + | Sets the < |
- | ==== ClientCount ==== | + | < |
- | '' | + | while (true) |
+ | { | ||
+ | SetActorSpeed(tid, | ||
+ | Delay(1); | ||
+ | } | ||
+ | </ | ||
- | Returns the amount of clients connected to the server (including bots). | + | without wasting any bandwidth. |
- | ==== SpectatorCount | + | ===== Actor functions ===== |
- | '' | + | |
- | Returns the amount of spectators connected to the server. | + | ==== ChangeFlag ==== |
+ | '' | ||
- | ==== PickRandomPlayer ==== | + | Adds or removes a flag from the activator. This is a Zandronum replacement for [[zdoom> |
- | '' | + | |
- | Returns the player number of a random player out of those who are in game. | + | **Example** |
+ | < | ||
+ | ChangeFlag(" | ||
+ | </ | ||
- | ==== PickRandomSpectator | + | < |
- | '' | + | ==== ChangeActorFlag |
+ | '' | ||
- | Returns | + | Adds or removes a flag from the specified actor. This is a Zandronum replacement for [[zdoom> |
- | ==== PickRandomBot ==== | + | **Example** |
- | '' | + | |
- | Returns the player number of a random ZDoom bot. | + | < |
+ | ChangeActorFlag(tid, | ||
+ | </ | ||
- | ===== Actor utility functions ===== | + | < |
==== ActorPlayerNumber ==== | ==== ActorPlayerNumber ==== | ||
Line 207: | Line 212: | ||
Returns true if the given actor is alive. | Returns true if the given actor is alive. | ||
+ | |||
+ | |||
+ | ==== HasRoom ==== | ||
+ | '' | ||
+ | |||
+ | Returns true if an actor of the given class has enough room to occupy the specified point. | ||
+ | |||
+ | ==== LookAtPoint ==== | ||
+ | '' | ||
+ | |||
+ | Rotates the actor so that it looks at the specified point, taking the actor' | ||
+ | |||
+ | ==== LookAt ==== | ||
+ | '' | ||
+ | |||
+ | Rotates the " | ||
Line 232: | Line 253: | ||
Returns the current speed of actor, ignoring the Z dimension. | Returns the current speed of actor, ignoring the Z dimension. | ||
- | |||
- | ===== Actor utility functions ===== | ||
- | |||
- | ==== HasRoom ==== | ||
- | '' | ||
- | |||
- | Returns true if an actor of the given class has enough room to occupy the specified point. | ||
- | |||
- | ==== LookAtPoint ==== | ||
- | '' | ||
- | |||
- | Rotates the actor so that it looks at the specified point, taking the actor' | ||
- | |||
- | ==== LookAt ==== | ||
- | '' | ||
- | |||
- | Rotates the " | ||
===== Activator swapping ===== | ===== Activator swapping ===== | ||
Line 293: | Line 297: | ||
</ | </ | ||
- | ===== Internationalization ===== | + | <note tip>The example function is already in ACSUtils: '' |
- | ==== lang ==== | + | ===== Player information functions ===== |
- | '' | + | |
- | Returns a translated string from [[zdoom> | + | ==== PlayerName ==== |
+ | '' | ||
+ | Returns the name of the specified player. A shorthand for '' | ||
- | ===== Multiplayer functions ===== | + | ==== PlayerIsConnected |
+ | '' | ||
- | ==== IsServer ==== | + | Returns true if the specified player is connected to the server. |
- | '' | + | |
- | Returns true if the script is running on a server or in a non-network game. Use this function to check whether **server** logic needs to be run. | + | ==== BotCount ==== |
+ | '' | ||
- | ==== IsClient ==== | + | Returns the amount of ZDoom bots present on the server. |
- | '' | + | |
- | Returns true if the script is running on a client or in a non-network game. Use this function to check whether **client** logic needs to be run. | + | ==== ClientCount ==== |
+ | '' | ||
- | <note tip>A player is considered **both a server | + | Returns the amount of clients connected to the server (including |
- | **Example** | + | ==== SpectatorCount ==== |
+ | '' | ||
- | < | + | Returns the amount of spectators connected to the server. |
- | // This code will work both in true multiplayer and in singleplayer. | + | |
- | if (IsServer()) | + | |
- | DoServersideStuff(); | + | |
- | + | ||
- | if (IsClient()) | + | |
- | DoClientsideStuff(); | + | |
- | </ | + | |
- | ===== Actor property shorthands ===== | + | ==== PickRandomPlayer |
+ | '' | ||
- | Not only are these shorter than '' | + | Returns the player number of a random player out of those who are in game. |
- | There are shorthands for the following properties: | + | ==== PickRandomSpectator ==== |
- | * Health | + | '' |
- | * SpawnHealth | + | |
- | * Speed | + | |
- | ==== GetActor< | + | Returns the player number of a random spectator. |
- | '' | + | |
- | Returns the < | + | ==== PickRandomBot ==== |
+ | '' | ||
- | ==== SetActor< | + | Returns the player number of a random ZDoom bot. |
- | '' | + | |
- | Sets the < | ||
- | < | ||
- | while (true) | ||
- | { | ||
- | SetActorSpeed(tid, | ||
- | Delay(1); | ||
- | } | ||
- | </ | ||
- | |||
- | without wasting any bandwidth. | ||