AGS Editor & User Interface

From Adventure Game Studio | Wiki
Jump to: navigation, search

Editing Displaying close-ups of inventory

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 GUIs 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).

When using a GUI for the close-up, it's rather simpler than using a separate room, and you can even have the close-up cover only a large portion of the room, and not replace it entirely. So, create a new GUI and put in a button that you will use as (1) an image to display the close-up, and (2) a method of getting rid of the GUI to go back to the room (by clicking on it). After you create the GUI and set the colors and settings you want, create a button and resize it to your liking. Set the image to the close-up sprite (after you import the image, of course), and set the button's property to "Run script".

If you are using AGS 2.7 or later, you should then give the button an object name. Once you have done this you can double-click the button in the editor to access the button's script function. The code to close down the GUI would be something like:

function btnCloseUp_Click(GUIControl *control, MouseButton button) {
  control.OwningGUI.Visible=false;
}

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.

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?

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

My walkable areas and walk-behind areas are finished and work fine, except for one thing: parts of my character will sometimes shift suddenly, OR will seem to walk right through things at times.

Well, since the X-Y coordinates of a character are located at the center of the bottom edge of its sprite, the feet can sometimes walk off some walkable areas (and appear to go into/through the walls), or even walk through stuff. To solve this, simply allow more room. Don't put the edges of walkable areas right at the wall; instead, leave 10 pixels or so of room between the WA edge and the wall. The same goes for walk-behind areas in the room: leave some room while making the walkable areas around the walk-behind areas so the character won't pass through the WBAs abruptly.

Deleting stuff besides sprites and frames

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.

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.

You can also delete GUI objects in the editor. Just select the object and hit the DEL key. WARNING: You must be even more careful in doing this, for the same reason mentioned above.

Room objects can also be deleted by right-clicking now. Use the same caution as above for this feature. For fonts, characters, views, inventory items, etc., just re-use them as advised above or just leave them alone. They don't contribute much to file size anyway. Note that the deletion of items is only meant to used by experienced users, and remember to BACKUP your game before doing any such hazardous acts!

We understand the desire - the need - to "clean up" after yourself, so to speak. But keep in mind that sometimes it is better to simply leave unused items alone (or until you can reuse those slots). There is no significant increase in memory usage or filesize anyway.

As for characters, why delete them when you can just re-use them? If you have one too many character slots, just don't use that last character slot.

Reverting back to default AGS 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. 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.

An explanation of split resources (".001" files, etc.)

What exactly is stored in the split ".001", ".002", etc., resource files?

Glad you asked. The split resources only contain room data. Sprite data is always stored in the basic executable.

Renaming "winsetup.exe", and its function

Is it safe to rename the "winsetup.exe" file? I DO want my game to be ultra-customizable and super-awesome, y'know!

No problem. You can rename winsetup.exe to anything you'd like; it will still work. In fact, all the winsetup.exe program does is call "game.exe -setup". That's all.

Actually, winsetup.exe is useful, as most people just playing AGS games may not know the "game.exe --setup" trick. Simply creating a batch file won't work for some Windows NT based systems. Using a Windows shortcut is not practical as you shouldn't force the player to install your game in some fixed folder. So, please, include winsetup.exe (or whatever you rename it to) when you distribute your game.

Changing dialog speech colour

How do I change the dialog speech colour? Is there some hidden text script function? Is there some hidden editor setting? Is it even possible???

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 AGS 2.72 BETA 5 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

Is it possible to use joysticks or gamepads for game control in AGS?

No, not currently, unless their drivers have a mouse or keypress emulation feature and are configured in that mode before playing. Sorry!

SCI fonts and creating them

I see that, in addition to TrueType fonts (TTF), AGS also supports a font format called SCI. What is it, and how would I create my own fonts using SCI?

SCI (Sierra Creative Interpreter) refers to the game engine that used such a font. SCI fonts are bitmap fonts, in that they cannot be resized like TTF fonts can.

The only standalone programme out there that creates and edits SCI fonts is Radiant's Font Editor. I haven't tried it myself, but it seems to be the only stable option for creating SCI fonts out there. Unless you want to use SCI Studio to do it, but it's a bit much to download an entire game engine just to create fonts.

Also, note that AGS can only display the first 128 characters in a SCI font set, symbols with ASCII value larger than 127 can only be displayed if you use a TTF with a translation file.

Disabling right-clicks in your game

How do I disable right-clicks in my game? Do I have to use script? Is there some other action I can take?

There are many ways to disable right clicks in your game. If you only need it done in one room, then use the following script in the relevant room's scripts:

 // AGS 2.62 and earlier
 function on_mouse_click(int button) {
   if (button==RIGHT) ClaimEvent();
 }
 // AGS 2.7 and later
 function on_mouse_click(MouseButton button) {
   if (button == eMouseRight) ClaimEvent();
 }

This will prevent the global script's on_mouse_click function (or any other on_mouse_click function for that matter) from reacting to right-clicks. Since there is nothing else in this function, nothing will occur when the right mouse button is clicked within that room.

To disable right mouse clicks throughout the entire game (for your own interface, for example), find the on_mouse_click function in the game's global script, and find the section that detects if the right mouse button was clicked (it's the else part in case you couldn't find it), and erase everything (usually just mouse.SelectNextMode(); in AGS 2.7 and later, or SetNextCursorMode(); in older versions) between the braces. That section should look like below:

 // AGS 2.62 and earlier
 function on_mouse_click(int button) {
   /* ... */
   else { // right-click, so cycle cursor
   }
 }
 // AGS 2.7 and later
 function on_mouse_click(MouseButton button) {
   /* ... */
   else { // right-click, so cycle cursor
   }
 }

Another way to disable right mouse clicks globally is to disable all the other cursor modes, so that only the WALK mode can be used.

Templates: What they are, and how to use them

What are templates and how would I implement them into my game?

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!

Running AGS games from the MS-DOS prompt or via batch file in Windows

I cannot run my AGS game from the MS-DOS command prompt or through a batch file in Windows. What should I do?

Well, there seems to be a few problems with the command prompt and Windows batch files when running AGS games. When AGS saves and compiles your game, it produces a ac2game.ags file in your game folder. It's your game, but without the built-in engine to run it. AGS also includes an acdos.exe and an acwin.exe file to run that .AGS file. Instead of running your gamename.exe compiled file, instead do the following:

MS-DOS Batch File - startdos.bat

 acdos.exe ac2game.ags

Windows Batch File - startwin.bat

 start acwin.exe ac2game.ags

Then, make sure that in the final release of your game, you include the following:

 startdos.bat
 startwin.bat
 acdos.exe
 acwin.exe
 ac2game.ags

The possibilities of making an FPS (First Person Shooter) with AGS

Can I make a first-person shooter (FPS) with AGS?

Bottom line: AGS is not the best program to make first-person shooters. ONLY if you have advanced knowledge of AGS scripting can you even BEGIN to think about making FPS's with AGS. I would suggest Googling some other engines for this. AGS stands for Adventure Game Studio, after all, and is geared toward that type of game.

Many people will say that it is indeed possible to make an FPS with AGS, but it will never look the same as one done by an engine dedicated to that type of game.

Using only left and right walking loops with all directions

How can I make it so that my character only uses the left and right walking views, even while walking vertically?

Thankfully, AGS now supports this. Simply delete all the frames in Loop 0 of your walking view and use only the LEFT and RIGHT walking views.

Room limitations in AGS...and if they exist

Is there any limit to the number of rooms I can have in my reasonably long AGS game?

Well, yes and no.

You can have up to 1,000 rooms in your AGS game, which is plenty for 99% of the games that could ever be made on Earth. However, any rooms numbered 301 or above will not have their states saved when the player leaves the room. In other words, if you return to room 334 it will be as if you entered it for the first time, every time.

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 OtherRoom Module 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.

Custom icon not working, doesn't appear as game's icon

My custom icon file won't appear as my game's icon? What am I doing wrong?

Well, first off, make sure that you named your icon user.ico. Also, make sure that it is placed in your game folder, not your "compiled" folder.

Read the manual as well, AGS currently supports only 16 colour standard Windows .ICO files.

The 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 this forum thread.