AGS tidbits & snippets: Difference between revisions

From Adventure Game Studio | Wiki
Jump to navigation Jump to search
 
(22 intermediate revisions by 7 users not shown)
Line 2: Line 2:


I have sorted through my notes and thought I'd post what I've found, maybe some of you will find this useful at one point or another.
I have sorted through my notes and thought I'd post what I've found, maybe some of you will find this useful at one point or another.
'''Please don't add anything to this page, add to the [[:Category:Tidbits and Snippets|Tidbits and Snippets category]] instead.'''
Enjoy,
:strazer


==General==
==General==


'''CJ''': "There's no hard limit, but a '''sprite cannot be taller than the screen''' resolution."
'''CJ''': There's no hard limit, but a '''sprite cannot be taller than the screen''' resolution.
----
----
'''CJ''': "(...) if you put a room file called '_blank.crm' in your game folder, it will be used as the '''template for New Room'''"
'''CJ''': If you put a room file called "_blank.crm" in your game folder, it will be used as the '''template for new rooms'''. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=18963.msg231484#msg231484]
([http://www.bigbluecup.com/yabb/index.php?topic=18963.msg231484#msg231484 Thread])
----
----
'''CJ''': "Yep, adding a '''blank dialog option will make it unclickable''' (...)"
'''CJ''': Adding a '''blank dialog option will make it unclickable'''. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=18958.msg231475#msg231475]
([http://www.bigbluecup.com/yabb/index.php?topic=18958.msg231475#msg231475 Thread])
:''So you can use that as default dialog option that gets run when all others have been turned off.''
:''So you can use that as default dialog option that gets run when all others have been turned off.''
----
----
'''CJ''': "No, most of the '''data (i.e. rooms and sprites) is only loaded when needed'''."
'''CJ''': Most of the '''data (i.e. rooms and sprites) is only loaded when needed'''. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=18541.msg225790#msg225790]
([http://www.bigbluecup.com/yabb/index.php?topic=18541.msg225790#msg225790 Thread])
----
----
'''bonordberg''': "(...) AGS only allows '''35 or so characters and objects on the screen at the same time'''."
'''bonordberg''': AGS only allows 35 or so '''characters and objects on the screen at the same time'''. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=15513.msg190266#msg190266]
([http://www.bigbluecup.com/yabb/index.php?topic=15513.msg190266#msg190266 Thread])
:''AGS v2.62 '''increased the limit to 50'''.''
:''AGS v2.62 '''increased the limit to 50'''.''
----
----
'''CJ''': "(...) you could '''double-click the "Edit this .AGSGame" file''' to open the game in the editor.
'''CJ''': You could '''double-click the "Edit this .AGSGame" file''' to open the game in the editor.<br>
You can create this association manually if you like, just set up .AGSGame files so that their association is:
You can create this association manually if you like, just set up .AGSGame files so that their association is: [http://www.adventuregamestudio.co.uk/forums/index.php?topic=12051.msg166879#msg166879]


<pre>c:\path\to\ags\agsedit.exe -shelllaunch "%1"</pre>
c:\path\to\ags\agsedit.exe -shelllaunch "%1"
 
([http://www.bigbluecup.com/yabb/index.php?topic=12051.msg166879#msg166879 Thread])
----
----
'''CJ''': "You cannot load a '''game saved at a different resolution'''."
'''CJ''': You '''cannot load a game saved at a different resolution'''.
:''So start playing your low-res game in hi-res if you intend to switch to bigger-sized windowed mode later.''
:''So start playing your low-res game in hi-res if you intend to switch to bigger-sized windowed mode later.''
----
----
'''CJ''': "The AGS editor can '''only automatically use 16-colour icons'''."
<strike>'''CJ''': The AGS editor can '''only automatically use 16-colour icons'''. ([http://www.bigbluecup.com/tracker.php?action=detail&id=153 Tracker])</strike>
([http://www.bigbluecup.com/tracker.php?action=detail&id=153 Tracker])
:''As of AGS v2.72 hi-color icons can be used when running Windows 2000/XP.''
----
----
'''CJ''': "'''Labels and text boxes have a maximum length of 200 [characters],''' just like the max string length."
'''CJ''': '''Labels and text boxes have a maximum length of 200 characters,''' just like the max string length. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=13914.msg168605#msg168605]
([http://www.bigbluecup.com/yabb/index.php?topic=13914.msg168605#msg168605 Thread])
----
----
'''CJ''': "'''Tiled sprite import''' now goes from left to right in rows (...)"
'''CJ''': '''Tiled sprite import''' now goes from left to right in rows.
----
----
'''Scorpiorus''': "You can have about '''150 lines of text [in a listbox].'''"
'''Scorpiorus''': You can have about '''150 lines of text in a listbox.'''
----
----
'''CJ''': "'''You can have up to 1000 rooms''', but any numbered &gt;300 will not have their state saved when the player leaves the room.
'''CJ''': '''You can have up to 1000 rooms''', but any numbered >300 will not have their state saved when the player leaves the room. This basically means that room script variables, object positions, etc will all be reset to their default values when you leave the room. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=13914.msg168605#msg168605]
This basically means that room script variables, object positions, etc will all be reset to their default values when you leave the room."
([http://www.bigbluecup.com/yabb/index.php?topic=13914.msg168605#msg168605 Thread])
----
----
'''CJ''': "'''Beta versions of the engine are larger''', because they don't have all the debug code stripped out, and aren't compressed."
'''CJ''': '''Beta versions of the engine are larger''', because they don't have all the debug code stripped out, and aren't compressed. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=12051.msg150828#msg150828]
([http://www.bigbluecup.com/yabb/index.php?topic=12051.msg150828#msg150828 Thread])
----
----
'''CJ''': "(...) '''#define is replaced with its definition''' at compile-time (...)"
'''CJ''': '''#define is replaced with its definition''' at compile-time. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=13234.msg158627#msg158627]
([http://www.bigbluecup.com/yabb/index.php?topic=13234.msg158627#msg158627 Thread])
----
----
'''CJ''': "'''AGS v2.3 and later request 85 Hz''' from DirectX."
'''CJ''': '''AGS v2.3 and later request 85 Hz''' from DirectX.
----
----
'''Erica McLane''': "'''Games compiled for DOS have 60 Hz''' (...)"
'''Erica McLane''': '''Games compiled for DOS have 60 Hz'''.
----
----
'''CJ''': "[When '''creating a translation source''', AGS] only scans backwards 10 characters to check for the 'GetxxxProperty' (...)"
'''CJ''': When '''creating a translation source''', AGS only scans backwards 10 characters to check for the 'GetxxxProperty'. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=13043.msg156462#msg156462]
([http://www.bigbluecup.com/yabb/index.php?topic=13043.msg156462#msg156462 Thread])
----
----
'''CJ''': "[Regarding '''fatal exceptions''' ] (...) eip +5997 means the MP3 player and eip +379 means a problem drawing the GUI (...)"
'''CJ''': '''Fatal exceptions''' eip +5997 mean the MP3 player and eip +379 mean a problem drawing the GUI. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=12798.msg153456#msg153456]
([http://www.bigbluecup.com/yabb/index.php?topic=12798.msg153456#msg153456 Thread])
----
----
'''Esseb''': "(...) 320*200 which is what the game engine reverts to '''if no config file is present'''."
'''Esseb''': 320*200 is what the game engine reverts to '''if no config file is present'''. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=12787.msg153098#msg153098]
([http://www.bigbluecup.com/yabb/index.php?topic=12787.msg153098#msg153098 Thread])
----
----
'''CJ''': "(...) to ensure [the pathfinder] always works, your '''walkable areas should always be at least 3 pixels wide'''."
'''CJ''': To ensure [the pathfinder] always works, your '''walkable areas should always be at least 3 pixels wide'''.
:''I suppose the same applies to non-walkable areas.''
:''I suppose the same applies to non-walkable areas.''
----
----
<del>
<del>'''Gilbot''': '''Sprites are always stored in the basic executable''', the splitted resources only contain room data.</del>
'''Gilbot''': "'''Sprite datas are always stored in the basic executable''', the splitted resources only contain room data."
</del>
:''As of AGS v2.7, sprite data is stored in the first splitted resource file.''
:''As of AGS v2.7, sprite data is stored in the first splitted resource file.''
----
----
<del>
<del>
'''CJ''': "'''The inventory window currently keeps track of the order that items are added to it''', until (...) the player character is changed, at which point the items switch back to the default order."
'''CJ''': '''The inventory window currently keeps track of the order that items are added to it''', until the player character is changed, at which point the items switch back to the default order. [http://www.adventuregamestudio.co.uk/forums/index.php?topic=12870.msg153895#msg153895]
([http://www.bigbluecup.com/yabb/index.php?topic=12870.msg153895#msg153895 Thread])
</del>
</del>
:''As of AGS v2.7, the inventory item order for each character is remembered.''
:''As of AGS v2.7, the inventory item order for each character is remembered.''
----
----
'''CJ''': "The '''dialog options are drawn in the player character's talking colour'''. The highlighted option colour uses the GUI foreground colour if you are using a GUI TextWindow, otherwise it is hardcoded to yellow."
'''CJ''': The '''dialog options are drawn in the player character's talking colour'''. The highlighted option colour uses the GUI foreground colour if you are using a GUI TextWindow, otherwise it is hardcoded to yellow. ([http://www.bigbluecup.com/tracker.php?action=detail&id=172 Tracker])
([http://www.bigbluecup.com/tracker.php?action=detail&id=172 Tracker])
----
----
'''CJ''': "(...) '''Character.UnlockView doesn't change the loop number back''', so he will go to facing in whichever direction the loop that was playing in the animation was."
'''CJ''': '''Character.UnlockView doesn't change the loop number back''', so he will go to facing in whichever direction the loop that was playing in the animation was.
----
----
'''CJ''': "'''Character.FaceLocation''' will only allow [a character] to face directions which he can actually walk in."
'''CJ''': '''Character.FaceLocation''' will only allow a character to face directions which he can actually walk in.
----
----
'''inFERNo''': "...'''every interaction in the [interaction editor] list is executed first''', the run script always when all others are done."
'''inFERNo''': '''Every interaction in the interaction editor list is executed first''', the run script always when all others are done.
----
----
'''CJ''': "The '''maximum room height''' is 1400 pixels (at 320x200 resolution - you could have a 2800-tall 640x400 room)."
'''CJ''': The '''maximum room height''' is 1400 pixels (at 320x200 resolution - you could have a 2800-tall 640x400 room).
:''I asked CJ for clarification:''
:''I asked CJ for clarification:''
'''CJ''': "The pathfinder uses an 1400-sized array for storing potential routes, and there's one row for each line."
'''CJ''': The pathfinder uses an 1400-sized array for storing potential routes, and there's one row for each line.
:''That means in 320x200 and 320x240 the maximum room background height is 1400 pixels, in 640x400, 640x480 and 800x600 it's 2800 pixels. In theory, there's no width limit.''
:''That means in 320x200 and 320x240 the maximum room background height is 1400 pixels, in 640x400, 640x480 and 800x600 it's 2800 pixels. In theory, there's no width limit.''
----
----
'''CJ''': "(...) '''objects are placed with 320x240-res co-ordinates''', so at 640x480 you can only place them on even pixels."
'''CJ''': '''Objects are placed with 320x240-res co-ordinates''', so at 640x480 you can only place them on even pixels.
:''Keep this in mind when designing your backgrounds/objects!''
:''Keep this in mind when designing your backgrounds/objects!''


==Scripting==
==Scripting==


'''CJ''': "'''Keys that aren't listed in the ASCII Code Table have no guarantees about their keycode numbers''' and may well overlap keys that are listed."
'''CJ''': '''Keys that aren't listed in the ASCII Code Table have no guarantees about their keycode numbers''' and may well overlap keys that are listed. [http://www.bigbluecup.com/yabb/index.php?topic=21763.msg265903#msg265903]
([http://www.bigbluecup.com/yabb/index.php?topic=21763.msg265903#msg265903 Thread])
----
----
'''CJ''': "I'd just like to clarify that there is '''no point in using a short rather than an int as a local variable'''.  
'''CJ''': I'd just like to clarify that there is '''no point in using a short rather than an int as a local variable'''. In fact, ints are faster because the CPU is better at reading/writing 32-bit chunks of memory than it is at 16-bit chunks. [http://www.bigbluecup.com/yabb/index.php?topic=21214.msg259479#msg259479]
In fact, ints are faster because the CPU is better at reading/writing 32-bit chunks of memory than it is at 16-bit chunks."
([http://www.bigbluecup.com/yabb/index.php?topic=21214.msg259479#msg259479 Thread])
----
----
'''CJ''': "There is '''no fixed limit on the size of global arrays''', but as scotch says they use up memory so don't go silly with creating massive ones unless you really need to."
'''CJ''': There is '''no fixed limit on the size of global arrays''', but as scotch says they use up memory so don't go silly with creating massive ones unless you really need to. [http://www.bigbluecup.com/yabb/index.php?topic=21191.msg258882#msg258882]
([http://www.bigbluecup.com/yabb/index.php?topic=21191.msg258882#msg258882 Thread])
----
----
'''CJ''': "The workaround for '''displaying player-entered strings''', in case anyone wants to know, is simply to do this:
'''CJ''': The workaround for '''displaying player-entered strings''', in case anyone wants to know, is simply to do this:
<pre>Display("%s", playerString);</pre>
Display("%s", playerString);
since that way, the player string will not be parsed for special tokens."
since that way, the player string will not be parsed for special tokens. [http://www.bigbluecup.com/yabb/index.php?topic=12051.msg157449#msg157449]
([http://www.bigbluecup.com/yabb/index.php?topic=12051.msg157449#msg157449 Thread])
----
----
'''CJ''': "(...) you have to '''place the export after the variable's declaration''' (...)"
'''CJ''': You have to '''place the export after the variable's declaration'''. [http://www.bigbluecup.com/yabb/index.php?topic=18972.msg231473#msg231473]
([http://www.bigbluecup.com/yabb/index.php?topic=18972.msg231473#msg231473 Thread])
:''So you don't necessarily have to put the exports at the '''end''' of scripts.''
:''So you don't necessarily have to put the exports at the '''end''' of scripts.''
----
----
'''CJ''': "Yes, the script engine has a '''limit of 9 parameters in a function call'''."
'''CJ''': You should be able to have '''up to 15 parameters to a function'''. [http://www.bigbluecup.com/yabb/index.php?topic=27727.msg352543#msg352543]
----
----
'''CJ''': "Note that '''optional parameters only work with int and enum''' parameters, you can't do it with strings or floats."
'''CJ''': Note that '''optional parameters only work with int and enum''' parameters, you can't do it with strings or floats.
----
----
'''CJ''': "It's
'''CJ''': Basically, to be consistent with Java/C#, '''the protection level always goes first''': [http://www.bigbluecup.com/yabb/index.php?topic=19369.msg226163#msg226163]
<pre>protected import static function get_slots();</pre>
protected import static function get_slots();
Basically, to be consistent with Java/C#, '''the protection level always goes first'''."
([http://www.bigbluecup.com/yabb/index.php?topic=19369.msg226163#msg226163 Thread])
----
----
'''CJ''': "You'll get [an error] if you define over '''4 KB's worth of variables inside a function'''."
'''CJ''': You'll get an error if you define over '''4 KB's worth of variables inside a function'''. [http://www.bigbluecup.com/yabb/index.php?topic=17550.msg215027#msg215027]
([http://www.bigbluecup.com/yabb/index.php?topic=17550.msg215027#msg215027 Thread])
----
----
'''CJ''': "(...) it's not until a room is loaded that the '''current viewport size''' is known."
'''CJ''': It's not until a room is loaded that the '''current viewport size''' is known. [http://www.bigbluecup.com/yabb/index.php?topic=12051.msg170758#msg170758]
([http://www.bigbluecup.com/yabb/index.php?topic=12051.msg170758#msg170758 Thread])
([http://www.bigbluecup.com/tracker.php?action=detail&id=470 Tracker])
([http://www.bigbluecup.com/tracker.php?action=detail&id=470 Tracker])
:''So better not use system.viewport_width or system.viewport_height in game_start.''
:''So better not rely on system.viewport_width or system.viewport_height in game_start.''
----
----
'''(Unknown)''': "You can use :''return;'' to '''abort the rest of the script'''."
'''(Unknown)''': You can use :''return;'' to '''abort the rest of the script'''.
----
----
'''CJ''': "'''Local room scripts have their data segment saved''' when the room is destroyed, so all variables retain their values."
'''CJ''': '''Local room scripts have their data segment saved''' when the room is destroyed, so all variables retain their values.
:''Useful to store the condition of light switches, for example.''
:''Useful to store the condition of light switches, for example.''
----
----
'''CJ''': "'''RunInventoryInteraction (...) doesn't get run immediately''' - instead, it gets run when the calling script finishes."
'''CJ''': '''RunInventoryInteraction doesn't get run immediately''' - instead, it gets run when the calling script finishes.
:''Applies only if the interaction runs a script. Interaction editor commands are executed immediately.''
:''Applies only if the interaction runs a script. Interaction editor commands are executed immediately.''
----
----
'''CJ''': "The '''number of game loops [speech text] stays for''' is:
'''CJ''': The '''number of game loops [speech text] stays for''' is: [http://www.bigbluecup.com/yabb/index.php?topic=14364.msg174988#msg174988]
<pre>int gameloops = ((StrLen(text) / game.text_speed) + 1) * GetGameSpeed();</pre>
int gameloops = ((StrLen(text) / game.text_speed) + 1) * GetGameSpeed();
([http://www.bigbluecup.com/yabb/index.php?topic=14364.msg174988#msg174988 Thread])
----
----
'''CJ''': "'''Functions cannot return structs or arrays''' - they can only return primitive types."
'''CJ''': '''Functions cannot return structs or arrays''' - they can only return primitive types. [http://www.bigbluecup.com/yabb/index.php?topic=13458.msg162111#msg162111]
([http://www.bigbluecup.com/yabb/index.php?topic=13458.msg162111#msg162111 Thread])
----
----
'''Gilbot''': "'''A [char] is a one byte integer''', so you can use = and = = directly."
'''Gilbot''': '''A [char] is a one byte integer''', so you can use = and = = directly. [http://www.bigbluecup.com/yabb/index.php?topic=13300.msg160466#msg160466]
([http://www.bigbluecup.com/yabb/index.php?topic=13300.msg160466#msg160466 Thread])
:''Meaning, unlike strings, you can do''
:''Meaning, unlike strings, you can do''
<pre>
char tmpchar = 'A';
char tmpchar = 'A';
tmpchar += 2; // will make tmpchar into 'C'
tmpchar += 2; // will make tmpchar into 'C'
</pre>
----
----
'''RickJ''': "A '''variable declaration in the header''' will cause a :''seperate'' [static] variable (...) for each room."
'''RickJ''': A '''variable declaration in the header''' will cause a ''seperate'' [static] variable for each room.
:''Could be used instead of room properties if you need to change them at run-time.''
:''Could be used instead of room properties if you need to change them at run-time.''
----
----
'''SSH''': "'''Strings in structs''' have to be declared as :''char desc [256];''"
'''SSH''': '''Strings in structs''' have to be declared as ''char desc [256];'' [http://www.bigbluecup.com/yabb/index.php?topic=12418.msg147974#msg147974]
([http://www.bigbluecup.com/yabb/index.php?topic=12418.msg147974#msg147974 Thread])
:''I think it's 200, the AGS maximum string length:''
:''I think it's 200, the AGS maximum string length:''
:<pre>
struct myStruct {
struct myStruct {
  char mystring [200];
  char mystring [200];
};
};
:<del>''Since you can't make arrays from string variables, you can make it from such a struct instead.''</del> (''AGS v2.71's new String type works as an array.'')
</pre>
:''Since you can't make arrays from string variables, you can make it from such a struct instead.''
----
----
'''Scorpiorus''':
'''Scorpiorus''':
<pre>cJack.Say("The new code is %04d", GetGlobalInt(99));</pre>
cJack.Say("The new code is %04d", GetGlobalInt(99));
(...) will '''add leading zeros''' (up to 4) if necessary."
will '''add leading zeros''' (up to 4) if necessary.
:''Here are more format flags:''
:''Here are more format flags:''
<pre>
// (number) = Create a field (number) characters wide:
Display("Here comes %4d a test", 22); //=&gt; Here comes &nbsp;&nbsp;22 a test


// - = Left justify:
// (number) = Create a field (number) characters wide:
Display("Here comes %-4d a test", 22); //=&gt; Here comes 22&nbsp;&nbsp; a test
Display("Here comes %4d a test", 22); //=> Here comes &nbsp;&nbsp;22 a test
 
// - = Left justify:
Display("Here comes %-4d a test", 22); //=> Here comes 22&nbsp;&nbsp; a test


// 0 = Field is padded with 0's instead of blanks:
// 0 = Field is padded with 0's instead of blanks:
Display("Here comes %04d a test", 22); //=&gt; Here comes 0022 a test
Display("Here comes %04d a test", 22); //=> Here comes 0022 a test


// + = Sign of number always shown:
// + = Sign of number always shown:
Display("Here comes %+d a test", 22); //=&gt; Here comes +22 a test
Display("Here comes %+d a test", 22); //=> Here comes +22 a test


// (blank) = Positive values begin with a blank:
// (blank) = Positive values begin with a blank:
Display("Here comes % d a test", 22); //=&gt; Here comes &nbsp;22 a test
Display("Here comes % d a test", 22); //=> Here comes &nbsp;22 a test
</pre>
----
----
'''RickJ''': "The character's '''global inventory variables are integers''' and can be used to keep track of how many items the character has."
'''RickJ''': The character's '''global inventory variables are integers''' and can be used to keep track of how many items the character has.


==Characters, objects & hotspots==
==Characters, objects & hotspots==


<del>
<del>
'''Scorpiorus''': "(...) the exact '''[MoveCharacterToObject]''' offsets (...) are +5 and +6 from the object's x and y respectively (...)"
'''Scorpiorus''': The exact '''MoveCharacterToObject offsets''' are +5 and +6 from the object's x and y respectively." [http://www.bigbluecup.com/yabb/index.php?topic=14323.msg174331#msg174331]
([http://www.bigbluecup.com/yabb/index.php?topic=14323.msg174331#msg174331 Thread])
</del>
</del>
:''This function is obsolete as of AGS v2.7''
:''This function is obsolete as of AGS v2.7''
----
----
'''CJ''': "A character with a '''move speed of 0 instantly warps''' to their destination."
'''CJ''': A character with a '''move speed of 0 instantly warps''' to their destination. [http://www.bigbluecup.com/yabb/index.php?topic=14364.msg185447#msg185447]
([http://www.bigbluecup.com/yabb/index.php?topic=14364.msg185447#msg185447 Thread])
----
----
'''Spyros''': "The '''default [idle view delay]''' is 20 sec."
'''Spyros''': The '''default idle view delay''' is 20 sec.
:''It's hidden in the manual.''
:''It's hidden in the manual.''
----
----
'''Cornjob''': "(...) '''Character.LoseInventory''' only decreases the quantity by 1."
'''Cornjob''': '''Character.LoseInventory''' only decreases the quantity by 1.
(<del>[http://p098.ezboard.com/fdosuserforumsfrm6.showMessage?topicID=220.topic ezboard-Thread]</del>)
(<del>[http://p098.ezboard.com/fdosuserforumsfrm6.showMessage?topicID=220.topic ezboard-Thread]</del>)
:'' Similarly, Character.AddInventory increases the quantity by one each time it's used.
:'' Similarly, Character.AddInventory increases the quantity by one each time it's used.
So better use''
So better use''
<pre>if (player.InventoryQuantity[iCoin.ID]) { // if player has one OR MORE of inv item iCoin</pre>
if (player.InventoryQuantity[iCoin.ID]) { // if player has one OR MORE of inv item iCoin
:''instead of''
:''instead of''
<pre>if (player.InventoryQuantity[iCoin.ID] == 1) { // if player has EXACTLY one inv item iCoin</pre>
if (player.InventoryQuantity[iCoin.ID] == 1) { // if player has EXACTLY one inv item iCoin
----
----
'''CJ''': "There is an undocumented Character.on variable, which is normally 1, but you can set it to 0 to '''make the character invisible'''."
'''CJ''': There is an undocumented Character.on variable, which is normally 1, but you can set it to 0 to '''make the character invisible'''.
:''Note that Character.Walk and the like don't work with characters turned off this way.''
:''Note that Character.Walk and the like don't work with characters turned off this way.''
----
----
'''Scorpiorus''': "'''If the hide player option is ticked''' [the Character.on variable] holds 0."
'''Scorpiorus''': '''If the hide player option is ticked''' the Character.on variable holds 0. [http://www.bigbluecup.com/yabb/index.php?topic=14295.msg173897#msg173897]
([http://www.bigbluecup.com/yabb/index.php?topic=14295.msg173897#msg173897 Thread])
----
----
'''CJ''': "Directly modifying Character.room won't prompt a room change, it'll just '''make the player character disappear'''."
'''CJ''': Directly modifying Character.room won't prompt a room change, it'll just '''make the player character disappear'''.


==Multimedia==
==Multimedia==


'''CJ''': "'''If you don't want to bundle the flic's''', just put them in your Compiled folder rather than your game folder, and they won't get built into the EXE."
'''CJ''': '''If you don't want to bundle the flic's''', just put them in your Compiled folder rather than your game folder, and they won't get built into the EXE. [http://www.bigbluecup.com/yabb/index.php?topic=20631.msg251734#msg251734]
([http://www.bigbluecup.com/yabb/index.php?topic=20631.msg251734#msg251734 Thread])
----
----
'''Scorpiorus''': "(...) the '''PlayMP3File(filename) function requires the mp3 file to be in the game\compiled folder''' rather than game folder."
'''Scorpiorus''': The '''PlayMP3File(filename) function requires the mp3 file to be in the game\compiled folder''' rather than game folder.
:''I think this is in the manual. However, I find it worth repeating.''
:''I think this is in the manual. However, I find it worth repeating.''
----
----
'''CJ''': "The ''''Play music on room load'''' only accepts music numbers from 1-120.
'''CJ''': The ''''Play music on room load'''' textbox only accepts music numbers from 1-120.
To play a higher numbered music, you need to use PlayMusic."
To play a higher numbered music, you need to use PlayMusic.
----
----
'''CJ''': "'''Music 0 is automatically played at game startup.'''"
'''CJ''': '''Music 0 is automatically played at game startup.'''
:''Works with compiled games, too.'' :)
:''Works with compiled games, too.'' :)
----
----
'''(Unknown)''': "If you import 24-bit pictures in AGS, it will '''automatically convert to [16-bit]'''."
'''(Unknown)''': If you import 24-bit pictures in AGS, it will '''automatically convert to [16-bit]'''.
:''Just import 24-bit pictures into your high-color game.''
:''Just import 24-bit pictures into your high-color game.''
----
----
'''Windows default sound volume''': All sliders to 50%
'''Windows default sound volume''': All sliders to 50%
----
----
'''CJ''': "(...) AGS doesn't actually use [Media Player] itself [to '''play avi videos'''], but it uses the same [DirectShow] that MP does."
'''CJ''': AGS doesn't actually use Media Player itself to '''play avi videos''', it just uses the same DirectShow that Media Player does.
----
----
'''Scorpiorus''': "(...) [if music disabled or no sound card] '''GetMP3PosMills()''' always returns 0 (...)"
'''Scorpiorus''': If music has been disabled or there's no sound card, '''GetMP3PosMills()''' always returns 0.


==Miscellaneous==
==Miscellaneous==


'''CJ''': "You can '''disable the abort key''' by doing: game.abort_key = -1;"
'''CJ''': You can '''disable the abort key''' by doing: ''game.abort_key = -1;'' [http://www.bigbluecup.com/yabb/index.php?topic=18139.msg220807#msg220807]
([http://www.bigbluecup.com/yabb/index.php?topic=18139.msg220807#msg220807 Thread])
:''Please don't. If your game locks up, the user won't be able to abort.''
:''Please don't. If your game locks up, the user won't be able to abort.''
----
----
In dialog scripts, the ''''...' will pause for 1 second''' (regardless of game speed setting).
In dialog scripts, the ''''...' will pause for 1 second''' (regardless of game speed setting).
----
----
'''CJ''': "(...) [calling "game.exe --setup"] is '''all that the winsetup.exe program does'''."
'''CJ''': Calling "game.exe --setup" is '''all that the winsetup.exe program does'''.
----
----
'''CJ''': "You can '''rename winsetup.exe to anything you like''', it will still work."
'''CJ''': You can '''rename winsetup.exe to anything you like''', it will still work.
----
----
Character to '''mask % symbol in strings''': %
Character to '''mask % symbol in strings''': %
<pre>Display("The %% is the percent symbol.");</pre>
Display("The %% is the percent symbol.");


Character to '''mask quotemarks in strings''': \
Character to '''mask quotemarks in strings''': \
<pre>Display("The \" is a quotemark.");</pre>
Display("The \" is a quotemark.");


Character for '''line breaks in strings''': [
Character for '''line breaks in strings''': [
<pre>Display("The [ is a line break.");</pre>
Display("The [ is a line break.");


Character to '''mask [ in strings''': \
Character to '''mask [ in strings''': \
<pre>Display("The \[ is a left brace.");</pre>
Display("The \[ is a left brace.");
----
----
===Adventure Creator / Adventure Game Studio version history===
*1997-02-?? - [http://www.bigbluecup.com/ac_100.zip ac_100.zip]
*1997-07-10 - (Revision)
*1998-12-18 - (Version 1.00 SR-1)
*1999-01-16 - [http://aafiles.bicycle-for-slugs.org/ags/ac_11.zip ac_11.zip] (hosted by Fuzzpilz)
*1999-01-31 - (Version 1.12)
*1999-02-13 - [http://aafiles.bicycle-for-slugs.org/ags/ac_112.zip ac_112a.zip] (hosted by Fuzzpilz)
*1999-03-20 - [http://aafiles.bicycle-for-slugs.org/ags/ac_113.zip ac_113.zip] (hosted by Fuzzpilz)
*1999-04-10 - [http://aafiles.bicycle-for-slugs.org/ags/ac_114.zip ac_114.zip] (hosted by Fuzzpilz)
*1999-05-?? - (Version 1.14a)
*1999-09-18 - [http://aafiles.bicycle-for-slugs.org/ags/ags_200x.zip ags_200x.zip] (hosted by Fuzzpilz)
*1999-09-26 - [http://aafiles.bicycle-for-slugs.org/ags/ags_201.zip ags_201.zip] (hosted by Fuzzpilz)
*1999-10-01 - [http://aafiles.bicycle-for-slugs.org/ags/ags_202.zip ags_202.zip] (hosted by Fuzzpilz)
*1999-11-26 - [http://aafiles.bicycle-for-slugs.org/ags/ags_203.zip ags_203.zip] (hosted by Fuzzpilz)
*2000-01-10 - [http://aafiles.bicycle-for-slugs.org/ags/ags_204.zip ags_204.zip] (hosted by Fuzzpilz)
*2000-02-13 - ags_205.zip
*2000-02-15 - (Version 2.05 SR-1)
*2000-02-17 - [http://aafiles.bicycle-for-slugs.org/ags/ags_205.zip ags_205_sr2.zip] (hosted by Fuzzpilz)
*2000-03-07 - ags_206.zip
*2000-03-09 - [http://aafiles.bicycle-for-slugs.org/ags/ags_206.zip ags_206_sr1.zip] (hosted by Fuzzpilz)
*2000-04-28 - ags_207.zip
*2000-05-01 - (Version 2.07 SR-1)
*2000-05-03 - (Version 2.07 SR-2)
*2000-05-13 - (Version 2.07 SR-3)
*2000-05-19 - [http://aafiles.bicycle-for-slugs.org/ags/ags_207.zip ags_207_sr4.zip] (hosted by Fuzzpilz)
*2000-07-22 - [http://aafiles.bicycle-for-slugs.org/ags/ags_210.zip ags_210.zip] (hosted by Fuzzpilz)
*2000-07-23 - [http://aafiles.bicycle-for-slugs.org/ags/ags_211.zip ags_211.zip] (hosted by Fuzzpilz)
*2000-07-?? - (Version 2.11 SR-1)
*2000-07-25 - (Version 2.11 SR-2)
*2000-08-22 - [http://aafiles.bicycle-for-slugs.org/ags/ags_212.zip ags_212.zip] (hosted by Fuzzpilz)
*2000-11-28 - (Version 2.13)
*2000-11-?? - (Version 2.13 SR-1)
*2000-12-03 - (Version 2.13 SR-2)
*2000-12-23 - (Version 2.13 SR-3)
*2001-01-01 - (Version 2.14)
*2001-01-27 - (Version 2.14 SR-1)
*2001-02-01 - ags_214_sr2.zip
*2001-02-04 - ags_214_sr3.zip
*2001-02-07 - ags_214_sr4.zip
*2001-02-14 - [http://aafiles.bicycle-for-slugs.org/ags/ags_214_sr5.zip ags_214_sr5.zip] (hosted by Fuzzpilz)
*2001-02-22 - ags_215.zip
*2001-02-28 - ags_215_sr1.zip
*2001-03-10 - ags_215_sr2.zip
*2001-03-30 - [http://www.bigbluecup.com/ags_215_sr3.zip ags_215_sr3.zip]
*2001-05-28 - [http://aafiles.bicycle-for-slugs.org/ags/ags_22.zip ags_22.zip] (hosted by Fuzzpilz)
*2001-08-06 - [http://www.bigbluecup.com/ags_221.zip ags_221.zip]
*2001-12-13 - [http://aafiles.bicycle-for-slugs.org/ags/ags_222.zip ags_222.zip] (hosted by Fuzzpilz)
*2002-01-26 - [http://aafiles.bicycle-for-slugs.org/ags/ags_23.zip ags_23.zip] (hosted by Fuzzpilz)
*2002-03-23 - [http://www.bigbluecup.com/ags_231.zip ags_231.zip] - '''Final DOS-based editor, still fully supporting graphical scripts'''
*2002-07-?? - ags_24.zip
*2002-07-18 - (Version 2.4a)
*2002-07-21 - [http://aafiles.bicycle-for-slugs.org/ags/ags_24b.zip ags_24b.zip] (hosted by Fuzzpilz)
*2002-09-18 - [http://aafiles.bicycle-for-slugs.org/ags/ags_25.zip ags_25.zip] (hosted by Fuzzpilz)
*2002-09-?? - (Version 2.5a)
*2002-09-23 - (Version 2.5b)
*2002-10-25 - (Version 2.51)
*2002-10-?? - [ftp://a-v-o.selfhost.de/ags/v2-51a/ags_251a.zip ags_251a.zip] (hosted by a-v-o)
*2002-11-25 - [ftp://a-v-o.selfhost.de/ags/v2-52/ags_252.zip ags_252.zip] (hosted by a-v-o)
*2003-01-30 - [ftp://a-v-o.selfhost.de/ags/v2-53/ags_253.zip ags_253.zip] (hosted by a-v-o)
*2003-03-20 - [ftp://a-v-o.selfhost.de/ags/v2-54/ags_254.zip ags_254.zip] (hosted by a-v-o)
*2003-06-06 - [ftp://a-v-o.selfhost.de/ags/v2-55/ags_255.zip ags_255.zip] (hosted by a-v-o)
*2003-08-29 - (Version 2.56)
*2003-08-?? - (Version 2.56a)
*2003-08-?? - (Version 2.56b)
*2003-09-06 - [ftp://a-v-o.selfhost.de/ags/v2-56/ags_256d.zip ags_256d.zip] (hosted by a-v-o)
*2003-12-22 - [ftp://a-v-o.selfhost.de/ags/v2-60/ags_26.zip ags_26.zip] (hosted by a-v-o)
*2004-01-30 - ags_26_sp1.zip
*2004-05-30 - [ftp://a-v-o.selfhost.de/ags/v2-61/ags_261.zip ags_261.zip] (hosted by a-v-o)
*2004-11-06 - [http://www.agagames.com/ags/ags_262.zip ags_262.zip] (hosted by AGA) - '''Last version to also contain a DOS engine'''
*2005-06-05 - [http://www.bigbluecup.com/ags_27.zip ags_27.zip]
*...


==Assorted==
==Assorted==


'''Scorpiorus''': "(...) blocking commands block the text script but not the interaction editor's actions."
'''Scorpiorus''': Blocking commands block the text script but not the interaction editor's actions." [http://www.bigbluecup.com/yabb/index.php?topic=14676.msg179442#msg179442]
([http://www.bigbluecup.com/yabb/index.php?topic=14676.msg179442#msg179442 Thread])
----
----
'''CJ''': "The linux engine can play any games created with AGS v2.5 and later."
'''CJ''': The linux engine can play any games created with AGS v2.5 and later. [http://www.bigbluecup.com/yabb/index.php?topic=14384.msg174948#msg174948]
([http://www.bigbluecup.com/yabb/index.php?topic=14384.msg174948#msg174948 Thread])
----
----
'''CJ''': "(...) in the editor AGS has to convert the 16-bit images to 15-bit for display (or for clipboard copy)."
'''CJ''': In the editor AGS has to convert the 16-bit images to 15-bit for display (or for clipboard copy). [http://www.bigbluecup.com/yabb/index.php?topic=11001.msg171794#msg171794]
([http://www.bigbluecup.com/yabb/index.php?topic=11001.msg171794#msg171794 Thread])
----
----
'''CJ''': "Set your desktop colour depth to 32-bit, then run winsetup and select to run the game in a window.
'''CJ''': Set your desktop colour depth to 32-bit, then run winsetup and select to run the game in a window.
Then, you can launch ACWIN (or any AGS game) with the parameter '--15bit' (without the speech marks), which will '''force it into 15-bit mode'''."
Then, you can launch ACWIN (or any AGS game) with the parameter "--15bit" (without the speech marks), which will '''force it into 15-bit mode'''. [http://www.bigbluecup.com/yabb/index.php?topic=13721.msg166897#msg166897]
([http://www.bigbluecup.com/yabb/index.php?topic=13721.msg166897#msg166897 Thread])
----
----
'''CJ''': "'''Object.MergeIntoBackground is effectively RawDrawObject''' followed by Object.Visible = false (...)"
'''CJ''': '''Object.MergeIntoBackground is effectively RawDrawObject''' followed by ''Object.Visible = false;''. [http://www.bigbluecup.com/yabb/index.php?topic=12051.msg166879#msg166879]
([http://www.bigbluecup.com/yabb/index.php?topic=12051.msg166879#msg166879 Thread])
----
----
'''CJ''': "(...) '''with TTF fonts the full 256 characters are supported''' (but not unicode, sorry)."
'''CJ''': '''With TTF fonts the full 256 characters are supported''' (but not unicode, sorry).
:''Works only using translations, not directly.''
:''Works only using translations, not directly.''
----
----
'''CJ''': "(...) GUI names actually #define to a special '''hidden function FindGUIByName''', so that even if the numbers have changed, it will still find the right one."
'''CJ''': GUI names actually #define to a special '''hidden function FindGUIByName''', so that even if the numbers have changed, it will still find the right one. [http://www.bigbluecup.com/yabb/index.php?topic=13234.msg158627#msg158627]
([http://www.bigbluecup.com/yabb/index.php?topic=13234.msg158627#msg158627 Thread])
----
----
'''Gilbot''': "(...) '''FLICs are limited to 256 colours''' (...)"
'''Gilbot''': '''FLICs are limited to 256 colours'''.
:''FLI supports only one resolution: 320x200 with 256 colors
:''FLI supports only one resolution: 320x200 with 256 colors
FLC supports any resolution up to 1024x768 with 256 colors.''
FLC supports any resolution up to 1024x768 with 256 colors.''
----
----
'''Scorpiorus''': "AGS moves characters only when all scripts are finished."
'''Scorpiorus''': AGS moves characters only when all scripts are finished.
----
----
'''CJ''': "Only characters, objects, mouse cursors and GUI backgrounds support being drawn with an alpha channel in-game."
'''CJ''': Only characters, objects, mouse cursors and GUI backgrounds support being drawn with an alpha channel in-game.
:''You can have '''alpha-channel GUI buttons''' if you use a GUI background image that has no background layer.''
:''You can have '''alpha-channel GUI buttons''' if you use a GUI background image that has no background layer.''
----
----
'''CJ''': "If the conversation is launched from a global script function (eg. the character interaction) then repeatedly_execute doesn't run in the background (...)"
'''CJ''': If the conversation is launched from a global script function (eg. the character interaction) then repeatedly_execute doesn't run in the background.
:''Is this still true?''
:''Is this still true?''


==External links==
==See also==
* [[:Category:Tidbits and Snippets|Tidbits and Snippets]] - Better organized version of this page (may not be complete yet). Use this when adding new stuff.


*[http://www.strazer.net/ags/tidbits.htm strazer's original page]
[[Category:Scripting]]

Latest revision as of 23:54, 28 January 2014

Aside from all the great ideas and scripts I've found after browsing through the whole beginners and technical forum, I noticed the small things either not in the manual or easy to miss.

I have sorted through my notes and thought I'd post what I've found, maybe some of you will find this useful at one point or another.

Please don't add anything to this page, add to the Tidbits and Snippets category instead.

Enjoy,

strazer


General

CJ: There's no hard limit, but a sprite cannot be taller than the screen resolution.


CJ: If you put a room file called "_blank.crm" in your game folder, it will be used as the template for new rooms. [1]


CJ: Adding a blank dialog option will make it unclickable. [2]

So you can use that as default dialog option that gets run when all others have been turned off.

CJ: Most of the data (i.e. rooms and sprites) is only loaded when needed. [3]


bonordberg: AGS only allows 35 or so characters and objects on the screen at the same time. [4]

AGS v2.62 increased the limit to 50.

CJ: You could double-click the "Edit this .AGSGame" file to open the game in the editor.
You can create this association manually if you like, just set up .AGSGame files so that their association is: [5]

c:\path\to\ags\agsedit.exe -shelllaunch "%1"

CJ: You cannot load a game saved at a different resolution.

So start playing your low-res game in hi-res if you intend to switch to bigger-sized windowed mode later.

CJ: The AGS editor can only automatically use 16-colour icons. (Tracker)

As of AGS v2.72 hi-color icons can be used when running Windows 2000/XP.

CJ: Labels and text boxes have a maximum length of 200 characters, just like the max string length. [6]


CJ: Tiled sprite import now goes from left to right in rows.


Scorpiorus: You can have about 150 lines of text in a listbox.


CJ: You can have up to 1000 rooms, but any numbered >300 will not have their state saved when the player leaves the room. This basically means that room script variables, object positions, etc will all be reset to their default values when you leave the room. [7]


CJ: Beta versions of the engine are larger, because they don't have all the debug code stripped out, and aren't compressed. [8]


CJ: #define is replaced with its definition at compile-time. [9]


CJ: AGS v2.3 and later request 85 Hz from DirectX.


Erica McLane: Games compiled for DOS have 60 Hz.


CJ: When creating a translation source, AGS only scans backwards 10 characters to check for the 'GetxxxProperty'. [10]


CJ: Fatal exceptions eip +5997 mean the MP3 player and eip +379 mean a problem drawing the GUI. [11]


Esseb: 320*200 is what the game engine reverts to if no config file is present. [12]


CJ: To ensure [the pathfinder] always works, your walkable areas should always be at least 3 pixels wide.

I suppose the same applies to non-walkable areas.

Gilbot: Sprites are always stored in the basic executable, the splitted resources only contain room data.

As of AGS v2.7, sprite data is stored in the first splitted resource file.

CJ: The inventory window currently keeps track of the order that items are added to it, until the player character is changed, at which point the items switch back to the default order. [13]

As of AGS v2.7, the inventory item order for each character is remembered.

CJ: The dialog options are drawn in the player character's talking colour. The highlighted option colour uses the GUI foreground colour if you are using a GUI TextWindow, otherwise it is hardcoded to yellow. (Tracker)


CJ: Character.UnlockView doesn't change the loop number back, so he will go to facing in whichever direction the loop that was playing in the animation was.


CJ: Character.FaceLocation will only allow a character to face directions which he can actually walk in.


inFERNo: Every interaction in the interaction editor list is executed first, the run script always when all others are done.


CJ: The maximum room height is 1400 pixels (at 320x200 resolution - you could have a 2800-tall 640x400 room).

I asked CJ for clarification:

CJ: The pathfinder uses an 1400-sized array for storing potential routes, and there's one row for each line.

That means in 320x200 and 320x240 the maximum room background height is 1400 pixels, in 640x400, 640x480 and 800x600 it's 2800 pixels. In theory, there's no width limit.

CJ: Objects are placed with 320x240-res co-ordinates, so at 640x480 you can only place them on even pixels.

Keep this in mind when designing your backgrounds/objects!

Scripting

CJ: Keys that aren't listed in the ASCII Code Table have no guarantees about their keycode numbers and may well overlap keys that are listed. [14]


CJ: I'd just like to clarify that there is no point in using a short rather than an int as a local variable. In fact, ints are faster because the CPU is better at reading/writing 32-bit chunks of memory than it is at 16-bit chunks. [15]


CJ: There is no fixed limit on the size of global arrays, but as scotch says they use up memory so don't go silly with creating massive ones unless you really need to. [16]


CJ: The workaround for displaying player-entered strings, in case anyone wants to know, is simply to do this:

Display("%s", playerString);

since that way, the player string will not be parsed for special tokens. [17]


CJ: You have to place the export after the variable's declaration. [18]

So you don't necessarily have to put the exports at the end of scripts.

CJ: You should be able to have up to 15 parameters to a function. [19]


CJ: Note that optional parameters only work with int and enum parameters, you can't do it with strings or floats.


CJ: Basically, to be consistent with Java/C#, the protection level always goes first: [20]

protected import static function get_slots();

CJ: You'll get an error if you define over 4 KB's worth of variables inside a function. [21]


CJ: It's not until a room is loaded that the current viewport size is known. [22] (Tracker)

So better not rely on system.viewport_width or system.viewport_height in game_start.

(Unknown): You can use :return; to abort the rest of the script.


CJ: Local room scripts have their data segment saved when the room is destroyed, so all variables retain their values.

Useful to store the condition of light switches, for example.

CJ: RunInventoryInteraction doesn't get run immediately - instead, it gets run when the calling script finishes.

Applies only if the interaction runs a script. Interaction editor commands are executed immediately.

CJ: The number of game loops [speech text] stays for is: [23]

int gameloops = ((StrLen(text) / game.text_speed) + 1) * GetGameSpeed();

CJ: Functions cannot return structs or arrays - they can only return primitive types. [24]


Gilbot: A [char] is a one byte integer, so you can use = and = = directly. [25]

Meaning, unlike strings, you can do
char tmpchar = 'A';
tmpchar += 2; // will make tmpchar into 'C'

RickJ: A variable declaration in the header will cause a seperate [static] variable for each room.

Could be used instead of room properties if you need to change them at run-time.

SSH: Strings in structs have to be declared as char desc [256]; [26]

I think it's 200, the AGS maximum string length:
struct myStruct {
  char mystring [200];
};
Since you can't make arrays from string variables, you can make it from such a struct instead. (AGS v2.71's new String type works as an array.)

Scorpiorus:

cJack.Say("The new code is %04d", GetGlobalInt(99));

will add leading zeros (up to 4) if necessary.

Here are more format flags:
// (number) = Create a field (number) characters wide:
Display("Here comes %4d a test", 22); //=> Here comes   22 a test
// - = Left justify:
Display("Here comes %-4d a test", 22); //=> Here comes 22   a test
// 0 = Field is padded with 0's instead of blanks:
Display("Here comes %04d a test", 22); //=> Here comes 0022 a test
// + = Sign of number always shown:
Display("Here comes %+d a test", 22); //=> Here comes +22 a test
// (blank) = Positive values begin with a blank:
Display("Here comes % d a test", 22); //=> Here comes  22 a test

RickJ: The character's global inventory variables are integers and can be used to keep track of how many items the character has.

Characters, objects & hotspots

Scorpiorus: The exact MoveCharacterToObject offsets are +5 and +6 from the object's x and y respectively." [27]

This function is obsolete as of AGS v2.7

CJ: A character with a move speed of 0 instantly warps to their destination. [28]


Spyros: The default idle view delay is 20 sec.

It's hidden in the manual.

Cornjob: Character.LoseInventory only decreases the quantity by 1. (ezboard-Thread)

Similarly, Character.AddInventory increases the quantity by one each time it's used.

So better use

if (player.InventoryQuantity[iCoin.ID]) { // if player has one OR MORE of inv item iCoin
instead of
if (player.InventoryQuantity[iCoin.ID] == 1) { // if player has EXACTLY one inv item iCoin

CJ: There is an undocumented Character.on variable, which is normally 1, but you can set it to 0 to make the character invisible.

Note that Character.Walk and the like don't work with characters turned off this way.

Scorpiorus: If the hide player option is ticked the Character.on variable holds 0. [29]


CJ: Directly modifying Character.room won't prompt a room change, it'll just make the player character disappear.

Multimedia

CJ: If you don't want to bundle the flic's, just put them in your Compiled folder rather than your game folder, and they won't get built into the EXE. [30]


Scorpiorus: The PlayMP3File(filename) function requires the mp3 file to be in the game\compiled folder rather than game folder.

I think this is in the manual. However, I find it worth repeating.

CJ: The 'Play music on room load' textbox only accepts music numbers from 1-120. To play a higher numbered music, you need to use PlayMusic.


CJ: Music 0 is automatically played at game startup.

Works with compiled games, too. :)

(Unknown): If you import 24-bit pictures in AGS, it will automatically convert to [16-bit].

Just import 24-bit pictures into your high-color game.

Windows default sound volume: All sliders to 50%


CJ: AGS doesn't actually use Media Player itself to play avi videos, it just uses the same DirectShow that Media Player does.


Scorpiorus: If music has been disabled or there's no sound card, GetMP3PosMills() always returns 0.

Miscellaneous

CJ: You can disable the abort key by doing: game.abort_key = -1; [31]

Please don't. If your game locks up, the user won't be able to abort.

In dialog scripts, the '...' will pause for 1 second (regardless of game speed setting).


CJ: Calling "game.exe --setup" is all that the winsetup.exe program does.


CJ: You can rename winsetup.exe to anything you like, it will still work.


Character to mask % symbol in strings: %

Display("The %% is the percent symbol.");

Character to mask quotemarks in strings: \

Display("The \" is a quotemark.");

Character for line breaks in strings: [

Display("The [ is a line break.");

Character to mask [ in strings: \

Display("The \[ is a left brace.");

Assorted

Scorpiorus: Blocking commands block the text script but not the interaction editor's actions." [32]


CJ: The linux engine can play any games created with AGS v2.5 and later. [33]


CJ: In the editor AGS has to convert the 16-bit images to 15-bit for display (or for clipboard copy). [34]


CJ: Set your desktop colour depth to 32-bit, then run winsetup and select to run the game in a window. Then, you can launch ACWIN (or any AGS game) with the parameter "--15bit" (without the speech marks), which will force it into 15-bit mode. [35]


CJ: Object.MergeIntoBackground is effectively RawDrawObject followed by Object.Visible = false;. [36]


CJ: With TTF fonts the full 256 characters are supported (but not unicode, sorry).

Works only using translations, not directly.

CJ: GUI names actually #define to a special hidden function FindGUIByName, so that even if the numbers have changed, it will still find the right one. [37]


Gilbot: FLICs are limited to 256 colours.

FLI supports only one resolution: 320x200 with 256 colors

FLC supports any resolution up to 1024x768 with 256 colors.


Scorpiorus: AGS moves characters only when all scripts are finished.


CJ: Only characters, objects, mouse cursors and GUI backgrounds support being drawn with an alpha channel in-game.

You can have alpha-channel GUI buttons if you use a GUI background image that has no background layer.

CJ: If the conversation is launched from a global script function (eg. the character interaction) then repeatedly_execute doesn't run in the background.

Is this still true?

See also

  • Tidbits and Snippets - Better organized version of this page (may not be complete yet). Use this when adding new stuff.