Changes

Jump to navigation Jump to search
45 bytes added ,  15:12, 25 October 2018
m
Text replacement - "<source lang=" to "<syntaxhighlight lang="
'''Defines''', in [[AGIWiki/AGI|AGI]] [[AGIWiki/Logic|logic]], allow you to provide a proper name for the [[AGIWiki/Variable|variables]], [[AGIWiki/Flag|flags]], [[AGIWiki/Animated object|objects]] and other data in the game. This significantly improves the readability of the code.
To create a define name, use the <source syntaxhighlight lang="cpp">#define</source> command. The name of the define is given, followed by the define value:<source syntaxhighlight lang="cpp">
#define ego o0
#define roomDescription "This is a large hall with tall pillars down each side."
Then the define name can be used in place of the define value:
<source syntaxhighlight lang="cpp">
draw(ego);
print(roomDescription);
Below is a typical [[AGIWiki/New room section|new room section]] of a logic file, without defines:
<source syntaxhighlight lang="cpp">
if (f5)
{
</source>
The same code, using defines, might appear like the following:
<source syntaxhighlight lang="cpp">
#define new_room f5
#define room_no v0
TrustedUser
2,000

edits

Navigation menu