<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://eternity.youfailit.net/index.php?action=history&amp;feed=atom&amp;title=ACS_constants</id>
	<title>ACS constants - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://eternity.youfailit.net/index.php?action=history&amp;feed=atom&amp;title=ACS_constants"/>
	<link rel="alternate" type="text/html" href="https://eternity.youfailit.net/index.php?title=ACS_constants&amp;action=history"/>
	<updated>2026-06-13T15:25:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://eternity.youfailit.net/index.php?title=ACS_constants&amp;diff=4008&amp;oldid=prev</id>
		<title>Printz: Created page with &quot;&#039;&#039;This page contains text copied from the ZDoom wiki.&#039;&#039;  Constants are values that are always the same when executed. An example of a constant would be 1, &quot;Hello&quot;, etc. Consta...&quot;</title>
		<link rel="alternate" type="text/html" href="https://eternity.youfailit.net/index.php?title=ACS_constants&amp;diff=4008&amp;oldid=prev"/>
		<updated>2017-04-08T11:01:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;This page contains text copied from the ZDoom wiki.&amp;#039;&amp;#039;  Constants are values that are always the same when executed. An example of a constant would be 1, &amp;quot;Hello&amp;quot;, etc. Consta...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;This page contains text copied from the ZDoom wiki.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Constants are values that are always the same when executed. An example of a constant would be 1, &amp;quot;Hello&amp;quot;, etc. Constants can also be #define&amp;#039;d.&lt;br /&gt;
&lt;br /&gt;
The syntax of defining a constant is as follows&lt;br /&gt;
 #define NAME VALUE&lt;br /&gt;
&lt;br /&gt;
==Numbers==&lt;br /&gt;
These constants can be used as values and also as script numbers.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
 #define SNUM	1&lt;br /&gt;
 #define VAL	3131&lt;br /&gt;
 &lt;br /&gt;
 script SNUM (void)&lt;br /&gt;
 {&lt;br /&gt;
     int x = VAL;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here SNUM would be replaced with &amp;#039;&amp;#039;&amp;#039;1&amp;#039;&amp;#039;&amp;#039; and VAL would be replaced with &amp;#039;&amp;#039;&amp;#039;3131&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
This is useful for a constant that is used a lot.  If something like the spawn numbers were to be changed, you&amp;#039;d only need to change the constant for the defined spawn numbers.&lt;br /&gt;
&lt;br /&gt;
==Use of operators==&lt;br /&gt;
Constants can be used to define other constants.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
 #define WEAPON_FIST	0&lt;br /&gt;
 #define WEAPON_CHAINSAW	WEAPON_FIST + 1&lt;br /&gt;
 &lt;br /&gt;
 script &amp;quot;Test&amp;quot; Enter&lt;br /&gt;
 {&lt;br /&gt;
     print(i:WEAPON_FIST);&lt;br /&gt;
     print(i:WEAPON_CHAINSAW);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This prints the values &amp;#039;&amp;#039;&amp;#039;0&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;1&amp;#039;&amp;#039;&amp;#039; as messages.&lt;br /&gt;
&lt;br /&gt;
You can also make more complex operations.&lt;br /&gt;
 #define HUD_WIDTH      1024&lt;br /&gt;
 #define HUD_HEIGHT     768&lt;br /&gt;
 #define HUD_FWIDTH     HUD_WIDTH * 1.0&lt;br /&gt;
 #define HUD_FCENTERX   HUD_FWIDTH / 2&lt;br /&gt;
 #define HUD_FHEIGHT    HUD_HEIGHT * 1.0&lt;br /&gt;
 #define HUD_FCENTERY   HUD_FHEIGHT / 2&lt;br /&gt;
 &lt;br /&gt;
 script &amp;quot;Test2&amp;quot; Enter&lt;br /&gt;
 {&lt;br /&gt;
     print(f:HUD_FWIDTH);&lt;br /&gt;
     print(i:HUD_HEIGHT);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This logs the values &amp;#039;&amp;#039;&amp;#039;1024.0&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;768&amp;#039;&amp;#039;&amp;#039; to the console.&lt;br /&gt;
&lt;br /&gt;
==String Constants==&lt;br /&gt;
You can define string constants as well.&lt;br /&gt;
&lt;br /&gt;
First example:&lt;br /&gt;
 script 1 Open&lt;br /&gt;
 {&lt;br /&gt;
     print(s:&amp;quot;err&amp;quot;);&lt;br /&gt;
     print(s:&amp;quot;err&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Second example:&lt;br /&gt;
 #define STR_err &amp;quot;err&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 script 1 Open&lt;br /&gt;
 {&lt;br /&gt;
     print(s:STR_err);&lt;br /&gt;
     print(s:STR_err);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Both examples produce identical output.&lt;br /&gt;
&lt;br /&gt;
==Library Constants==&lt;br /&gt;
You can also place constants in your [[ACS libraries|Libraries]]. This can be especially useful when, say, applying a [[TID]] to the player, or numbers you may want handy for [[ACS functions|custom functions]].&lt;br /&gt;
&lt;br /&gt;
The syntax is much the same as a normal constant, with one change.&lt;br /&gt;
 #libdefine NAME VALUE&lt;br /&gt;
&lt;br /&gt;
Here is an example of some other useful constants. These constants provide quick shortcuts to cardinal directions for [[Polyobject|PolyObjects]] and [[SetActorAngle]].&lt;br /&gt;
&lt;br /&gt;
 #libdefine POLY_NORTH       64&lt;br /&gt;
 #libdefine POLY_SOUTH       192&lt;br /&gt;
 #libdefine POLY_WEST        128&lt;br /&gt;
 #libdefine POLY_EAST        0&lt;br /&gt;
 &lt;br /&gt;
 #libdefine ACTOR_FACE_NORTH 0.25&lt;br /&gt;
 #libdefine ACTOR_FACE_WEST  0.5&lt;br /&gt;
 #libdefine ACTOR_FACE_EAST  1.0&lt;br /&gt;
 #libdefine ACTOR_FACE_SOUTH 0.75&lt;br /&gt;
&lt;br /&gt;
[[category:ACS]]&lt;br /&gt;
[[category:Editing reference]]&lt;/div&gt;</summary>
		<author><name>Printz</name></author>
	</entry>
</feed>