AGS Editor & User Interface: Difference between revisions
Jump to navigation
Jump to search
m
no edit summary
mNo edit summary |
|||
(13 intermediate revisions by 8 users not shown) | |||
Line 2: | Line 2: | ||
''I have an inventory item that I want to display a close-up of when the player looks at it. How do I do this? Is there some sort of top-secret function or code that you guys are not sharing with us beginners? Let's have it, oldie!'' | ''I have an inventory item that I want to display a close-up of when the player looks at it. How do I do this? Is there some sort of top-secret function or code that you guys are not sharing with us beginners? Let's have it, oldie!'' | ||
No. Think about it a little bit. Have you read the manual and learned about | No. Think about it a little bit. Have you read the manual and learned about [[GUI]]s yet? Although I shouldn't have to tell you this, a GUI is like a separate "window" where you can display anything from text boxes and list boxes, to buttons and labels. Buttons can also just be plain images. Basically, there are two different ways that one can do this: use a separate room, or use a GUI. | ||
With a separate room, you will have to make sure that once you are done with the close-up room, you have code in the first room that, once you return to it, it will place you at the same place you were when you looked at the item. You might have to use global variables for this (check the manual regarding them). So basically, in the "'''Look at inventory'''" interaction script, write the command to change the current room to whatever room number you choose as the close-up room. Then, in the "'''Player enters room (after fade-in)'''" script, write the script to display a description of the item, then wait a little bit perhaps, then change rooms to the player's previous room ('''character[ABC].prevroom''' or '''cAbc.PreviousRoom''' for AGS V2.7 and newer). | With a separate room, you will have to make sure that once you are done with the close-up room, you have code in the first room that, once you return to it, it will place you at the same place you were when you looked at the item. You might have to use global variables for this (check the manual regarding them). So basically, in the "'''Look at inventory'''" interaction script, write the command to change the current room to whatever room number you choose as the close-up room. Then, in the "'''Player enters room (after fade-in)'''" script, write the script to display a description of the item, then wait a little bit perhaps, then change rooms to the player's previous room ('''character[ABC].prevroom''' or '''cAbc.PreviousRoom''' for AGS V2.7 and newer). | ||
Line 14: | Line 14: | ||
} | } | ||
For AGS 2.62 or earlier: In your global script, you should see an interface_click function. Inside, there are a collection of if/else if commands. These check to see what GUI (interface) was active and what object (generically called button) was clicked on it. Let's say that you created GUI #6. In the code, add an else if command to check if interface passed 6 as a value. If you are only having an image/button in your GUI, you do not need any other if code to determine which button was clicked, because there is only one possibilty for that GUI. Then, insert the code that will close down the GUI. To activate the GUI, put the code in the "'''Look at inventory'''" interaction event, just like above. | For [[AGS Version history|AGS 2.62]] or earlier: In your global script, you should see an interface_click function. Inside, there are a collection of if/else if commands. These check to see what GUI (interface) was active and what object (generically called button) was clicked on it. Let's say that you created GUI #6. In the code, add an else if command to check if interface passed 6 as a value. If you are only having an image/button in your GUI, you do not need any other if code to determine which button was clicked, because there is only one possibilty for that GUI. Then, insert the code that will close down the GUI. To activate the GUI, put the code in the "'''Look at inventory'''" interaction event, just like above. | ||
==Simulating 3D distance perspective with scalable walkable areas== | ==Simulating 3D distance perspective with scalable walkable areas== | ||
''I have X-number of walkable areas in my room, with incrementing values of scaling, to simulate realistic 3D perspective. But my character looks jerky when (s)he changes size. What can I do?'' | ''I have X-number of walkable areas in my room, with incrementing values of scaling, to simulate realistic 3D perspective. But my character looks jerky when (s)he changes size. What can I do?'' | ||
AGS has a feature called continuous scaling. Simply create one walkable area, and set the top ("rear") and bottom ("front") scaling percentage values, and your character will be scaled smoothly from small to large. TIP: AGS also shows you the percentage value at a certain Y-coordinate within the walkable area. This is great for creating a walkable-area within a walkable-area for, say, lighting effects like street lights and shadows, where you want the scaling to say consistent. | AGS has a feature called continuous scaling. Simply create one walkable area, and set the top ("rear") and bottom ("front") scaling percentage values, and your character will be scaled smoothly from small to large. TIP: [[AGS]] also shows you the percentage value at a certain Y-coordinate within the walkable area. This is great for creating a walkable-area within a walkable-area for, say, lighting effects like street lights and shadows, where you want the scaling to say consistent. | ||
==Characters walk over/through things; Characters shift suddenly sometimes== | ==Characters walk over/through things; Characters shift suddenly sometimes== | ||
Line 29: | Line 29: | ||
''Can I delete stuff in the editor somehow, besides sprites and animation frames? For example, can I delete characters?'' | ''Can I delete stuff in the editor somehow, besides sprites and animation frames? For example, can I delete characters?'' | ||
No. If this were possible, then beginners could potentially screw up their game big-time. To avoid frustration and accidents, Chris has disabled the deleting of most things. But what if you don't need that extra inventory item for now? Or what if you don't want that extra GUI you created? Although you can now delete GUIs in AGS, there is an alternative. Just set the GUI so that it never appears (Set it to "Popup Modal"), or simply never refer to the inventory item. If you can't delete it, ignore it. | No. If this were possible, then beginners could potentially screw up their game big-time. To avoid frustration and accidents, [[Chris Jones|Chris]] has disabled the deleting of most things. But what if you don't need that extra inventory item for now? Or what if you don't want that extra GUI you created? Although you can now delete GUIs in AGS, there is an alternative. Just set the GUI so that it never appears (Set it to "Popup Modal"), or simply never refer to the inventory item. If you can't delete it, ignore it. | ||
To delete a GUI, just click the "'''Delete this GUI'''" button. '''WARNING:''' You must be ''' ''very careful'' ''' in doing this, as items in AGS are referenced by number; if you delete a GUI that is not the last in the list, the GUI IDs will be renumbered. As a result, it is possible that your game's script will refer to the wrong GUIs or even a non-existing GUI, causing crashes that end up being difficult to track. Fortunately, you have a name for each of the GUIs. If you only refer to them with their script names (i.e., you didn't type in the '''exact''' GUI IDs in your scripts), simply recompile all the rooms ('''Game -> Rebuild all room files''') and then save the game. | To delete a GUI, just click the "'''Delete this GUI'''" button. '''WARNING:''' You must be ''' ''very careful'' ''' in doing this, as items in AGS are referenced by number; if you delete a GUI that is not the last in the list, the GUI IDs will be renumbered. As a result, it is possible that your game's script will refer to the wrong GUIs or even a non-existing GUI, causing crashes that end up being difficult to track. Fortunately, you have a name for each of the GUIs. If you only refer to them with their script names (i.e., you didn't type in the '''exact''' GUI IDs in your scripts), simply recompile all the rooms ('''Game -> Rebuild all room files''') and then save the game. | ||
Line 44: | Line 44: | ||
''How do I EASILY revert my game to all of AGS's default fonts?'' | ''How do I EASILY revert my game to all of AGS's default fonts?'' | ||
Close AGS, and then delete any files named "'''agsfnt??.wfn'''" or "'''agsfnt??.ttf'''" files from your game's main folder. Then, restart AGS and load up your game. Voila! Back to the defaults. | Close AGS, and then delete any files named "'''agsfnt??.wfn'''" or "'''agsfnt??.ttf'''" files from your game's main folder. Or, to be on the safe side, move them out of the folder instead of deleting them right away. | ||
Then, restart AGS and load up your game. Voila! Back to the defaults. | |||
A newer and much easier way is to click the "'''Revert to defaults'''" button in the Fonts pane of the AGS Editor. This will revert the font choices to 0, 1, and 2 (the original SCI fonts) and will '''DELETE''' all the other fonts. As fonts above #2 are deleted, make sure you did not refer to any fonts other than 0, 1, or 2 in your game, or you will need to fix pesky crashes in your game yourself. | A newer and much easier way is to click the "'''Revert to defaults'''" button in the Fonts pane of the AGS Editor. This will revert the font choices to 0, 1, and 2 (the original SCI fonts) and will '''DELETE''' all the other fonts. As fonts above #2 are deleted, make sure you did not refer to any fonts other than 0, 1, or 2 in your game, or you will need to fix pesky crashes in your game yourself. | ||
Line 65: | Line 66: | ||
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. Maybe in the future there will be a way to change this, but for now, deal with it! | 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. Maybe in the future there will be a way to change this, but for now, deal with it! | ||
As of | As of {{thread|AGS 2.72 BETA 5|24521.0}} there is an option to set the color for used dialog options, '''game.read_dialog_option_color'''. This setting can only be set from the script. | ||
==Using joysticks or game controllers in AGS== | ==Using joysticks or game controllers in AGS== | ||
Line 117: | Line 118: | ||
''What are templates and how would I implement them into my game?'' | ''What are templates and how would I implement them into my game?'' | ||
Well, templates are pre-made sets of GUIs and | Well, templates are pre-made sets of GUIs, code, rooms, and graphics for your game, and are stored in files ending in "'''.AGT'''". In order to use them in a '''NEW''' game, simply copy that .AGT template file to the main AGS folder on your computer. Run the AGS Editor, start a New Game, then highlight the GUI template from the list. Enter a name for your new game, and that's it. | ||
For a game '''IN PROGRESS''', you will need to copy all your pre-existing characters, rooms, code, and graphics over to a newly set-up game as shown above. That's it! | For a game '''IN PROGRESS''', you will need to copy all your pre-existing characters, rooms, code, and graphics over to a newly set-up game as shown above. That's it! | ||
Line 163: | Line 164: | ||
However, this limit can be countered by using '''Global Int's''', our good friend. You can record the "'''Player Has Already Entered Room'''" flag with a Global Int, for use with the "'''first time player enters room'''" condition in the Interaction Editor. | However, this limit can be countered by using '''Global Int's''', our good friend. You can record the "'''Player Has Already Entered Room'''" flag with a Global Int, for use with the "'''first time player enters room'''" condition in the Interaction Editor. | ||
Alternately, you could use '''strazer's''' | Alternately, you could use '''strazer's''' {{thread|OtherRoom Module|20650.0}} instead of coding it all by hand. I haven't personally used this module, so I can't comment on its effectiveness. | ||
Why all the limits, you ask? Well, things like rooms and objects have to be set up as arrays and structs, and those must have a max size for the programming language to know how much memory should be assigned to them. With languages like C and VB you need to assign an array an initial value in order to first use them, and there's where those arbitrary limits come into play. Other than that, CJ could easily increase the limits on anything in AGS, if you simply ask him. He is Pumaman on the forums. | Why all the limits, you ask? Well, things like rooms and objects have to be set up as arrays and structs, and those must have a max size for the programming language to know how much memory should be assigned to them. With languages like C and VB you need to assign an array an initial value in order to first use them, and there's where those arbitrary limits come into play. Other than that, CJ could easily increase the limits on anything in AGS, if you simply ask him. He is Pumaman on the forums. | ||
Line 174: | Line 175: | ||
Read the manual as well, AGS currently supports only 16 colour standard Windows '''.ICO''' files. | Read the manual as well, AGS currently supports only 16 colour standard Windows '''.ICO''' files. | ||
[[Category: | The [[AGS Version history|AGS 2.72]] beta, however, supports more sizes and colours in Icons if the game is created with Windows 2000 or XP. | ||
==When I click on anything in the help, I get "The page cannot be displayed"== | |||
See {{thread|this forum thread|22875.0}}. | |||
[[Category:Beginner Tutorials]] |