TEMPLATE: SCUMM VERBCOIN GUI v2.0.0 (for AGS 3.x)

Started by Electroshokker, Sun 21/10/2007 16:31:02

Previous topic - Next topic

Electroshokker

Once upon a time long, long ago, I decided to write an AGS module out of my game script.


- the old version (1.7.2) is already included in the current AGS builds (has been for quite a while now)!
- version 2.0.0 for AGS 3.3 is available! (Get the agt file here)

New 2.0.0 Features:

- separate event handler scripts for characters and inventory items (aka interact/look/talk to/use interactions are now handled outside of the global script, keeping it nice and clean. You only need to set a specific function as catch-all function in the events)
- dynamic changing of overhotspot action labels and the 'act' property (if for instance you want to change a specific action to something different than what you set in the corresponding property, or if you want to turn a regular hotspot into an exit or something)
- cursor outline when holding an inventory item and moving over something it can interact with

Old features (but more bug-free):

- fully interchangable gui system (want to switch verbcoin/inventory GUI's half way through the game? you can!)
- a fully integrated verbcoin system where you can add upto 6 buttons to the verbcoin
- @overhotspot@ special interaction label properties (change an object/character/hotspot's properties to display either default or custom text when moving over the corresponding verbcoin button)
- basic keyboard support
- double-click functionality on hotspots/objects based on a boolean property ('act') (useful for room exits!)
- game resolution independent
- the ability to enable/disable this module at any point in your game!

backwards compatibility notice

v2.0.0 will *break* your old 1.7.2 code, though it is possible to replace the old functions with the new (more logically named) functions and properties.
AGS 3.3.0's find all occurrences functionality will make the transition a bit smoother.

Known bugs

No known bugs yet. Old 1.7.2 bugs stomped.
I expect bug reports from you guys!

Scorpiorus

Nice work with rewriting the MI3 user interface! Many people will surely find a use for it :)

Pumaman

Good work, thanks! I'd like to include this with the AGS 3.0 distribution if that's ok -- but before I do so, can I just check about the graphics. I'm assuming they're ripped from MI3, is that the case? If so I'll have to replace them with some very dodgy home-made images before including it.

Dualnames

Always glad to see people get motivated. It was your CODE anyway. As I did pointed. Good Job. Hope this time it works like it should.


EDIT: Though you've scripted it for BETA 3.0.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Radiant


Electroshokker

Quote from: Radiant on Mon 22/10/2007 01:04:49
So does this have keyboard support?

No.

Quote from: RadiantMoving the main character with the cursor arrows is only a nice extra - however, invoking the GUI by keyboard presses (W=walk, T=talk, etc) is essential for LucasArts and VerbCoin GUIs (and a nice extra for Sierra ones). Hence, I would appreciate this being in the standard template. It's only a couple of lines, after all.

Quite. But I won't add it in the module code. I will however put up example code in the globalscript soon. The game designer will almost always want to modify which key does what anyways, and putting it in the globalscript will allow just that.

Rui 'Trovatore' Pires

Actually, you'll find that if the template is well designed, people rarely change standard keyboard shortcuts. And if you provide for Look, Talk to and Use and leave placeholders for the other three modes, people will find their ways to them quite soon. I support Radiant's suggestion for having shortcuts in the template itself.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Electroshokker

Quote from: Rui "Trovatore" Pires on Mon 22/10/2007 20:25:35
Actually, you'll find that if the template is well designed, people rarely change standard keyboard shortcuts. And if you provide for Look, Talk to and Use and leave placeholders for the other three modes, people will find their ways to them quite soon. I support Radiant's suggestion for having shortcuts in the template itself.

Yes, but I was talking about the module code. I fully intend to add keyboard support the way you suggest, but I'll add it in the template globalscript, where it's easy to find and customize.

If people start murking around in the module code (which does all the heavy lifting for the verbcoin gui) who knows what would happen.

I've been testing my own template further to fix up all the loose ends. I'll be posting an updated template later this week.

known issues:

- creating one of the 3 custom buttons will cause the game to crash when moving over them. This is due to a text property not being transferred to a string variable. (to be fixed)
- no keyboard support (to be added)
- still uses the old SetText() function (minor issue)

AGS 3.0 beta 14 known issue:

- text property changes doesn't set the room changed flag (bypass: change something else, such as the room/hotspot description in the room and save)

If you come across anything else, let me know.

Rui 'Trovatore' Pires

QuoteYes, but I was talking about the module code. I fully intend to add keyboard support the way you suggest, but I'll add it in the template globalscript, where it's easy to find and customize.

Aaah. My bad, sorry. I agree completely. Best to avoid having people messing with the module code.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SSH

The module could have a function that sets up keyboard shortcuts. I think that would be the best way to make things configurable in the global script and avoid people editing the module but keep the internals of the module hidden:

SCUMM_VERBCOIN_GUI.SetShortcut('X', eModeWhatever);

Also, I have to ask why the functions are so verbose and use numbers rather than GUI pointers:

Code: ags

SCUMM_VERBCOIN_GUI.Item_Count(10);  //how many inventory items fit in your inventory screen?
SCUMM_VERBCOIN_GUI.Inv_Border_x_active(true); //inventory exit borders to the left and right
SCUMM_VERBCOIN_GUI.Inv_Border_y_active(false); //inventory exit borders to the top and bottom
SCUMM_VERBCOIN_GUI.Inv_Border_Bottom_Pos(190);  //y-coördinate of the bottom exit border (inventory exit point)
SCUMM_VERBCOIN_GUI.Inv_Border_Top_Pos(40);  // y-coördinate of the top exit border (inventory exit point)
SCUMM_VERBCOIN_GUI.Inv_Border_Left_Pos(40); // x-coördinate of the left exit border (inventory exit point)
SCUMM_VERBCOIN_GUI.Inv_Border_Right_Pos(295); // x-coördinate of the left exit border (inventory exit point)
SCUMM_VERBCOIN_GUI.verbgraphic_idle_verbcoin(1);
SCUMM_VERBCOIN_GUI.verbgraphic_interact_button(2);
SCUMM_VERBCOIN_GUI.verbgraphic_look_button(3);
SCUMM_VERBCOIN_GUI.verbgraphic_talk_button(4);
SCUMM_VERBCOIN_GUI.verbgraphic_custom1_button(0);
SCUMM_VERBCOIN_GUI.verbgraphic_custom2_button(0);
SCUMM_VERBCOIN_GUI.verbgraphic_custom3_button(0);
SCUMM_VERBCOIN_GUI.Inventory_Underlay(gInvUnderlay.ID);
SCUMM_VERBCOIN_GUI.Inventory(gInventory.ID);
SCUMM_VERBCOIN_GUI.Verbcoin_GUI(gVerbCoin.ID);


would be better as:

Code: ags

SCUMM_VERBCOIN_GUI.Item_Count(10);  //how many inventory items fit in your inventory screen?
SCUMM_VERBCOIN_GUI.Inv_Border_active(true, false); //inventory exit borders
SCUMM_VERBCOIN_GUI.Inv_Border_SetPos(40,40, 295,190);
SCUMM_VERBCOIN_GUI.verbgraphic(null, 1);
SCUMM_VERBCOIN_GUI.verbgraphic(interact_button, 2);
SCUMM_VERBCOIN_GUI.verbgraphic(look_button, 3);
SCUMM_VERBCOIN_GUI.verbgraphic(talk_button, 4);
SCUMM_VERBCOIN_GUI.verbgraphic(custom1_button, 0);
SCUMM_VERBCOIN_GUI.verbgraphic(custom2_button, 0);
SCUMM_VERBCOIN_GUI.verbgraphic(custom3_button, 0);
SCUMM_VERBCOIN_GUI.Inventory(gInventory, gInvUnderlay);
SCUMM_VERBCOIN_GUI.Verbcoin_GUI(gVerbCoin);



12

Electroshokker

Quote from: SSH on Tue 23/10/2007 11:24:46
The module could have a function that sets up keyboard shortcuts. I think that would be the best way to make things configurable in the global script and avoid people editing the module but keep the internals of the module hidden:

SCUMM_VERBCOIN_GUI.SetShortcut('X', eModeWhatever);

Sounds good to me. One thing's been bugging me for keyboard support, however: there are custom text properties in which you can fill in the action being performed for display when moving over a button. (so when moving over the mouth icon, for example, you could have "Drink from bottle", "Bite hamburger", "Chew gum", ...)

If I set keyboard shortcuts to immediately perform the corresponding action, you don't get to see the custom text. I'm thinking about popping up the verbcoin when you press a certain button and as long as you are holding the button down the corresponding verbcoin button will look "pressed" as well as the corresponding text showing in the label gui.

Does this sound workable, or would it be annoying? Perhaps I should include an option which enables/disables this type of keyboard reaction? (so if set to "enabled" you would see the verbcoin and the custom text when pressing a button, if set to "disabled" the action would just run)

Or maybe if you press a certain key only the custom text label would pop up for as long as you press down the key? (and not the verbcoin)

What do you think the best way would be to implement keyboard support? (I want the one using the template to have total freedom)

Quote from: SSH on Tue 23/10/2007 11:24:46Also, I have to ask why the functions are so verbose and use numbers rather than GUI pointers

Basically, I spent more time thinking what functionality and options I should give your average AGS developer rather then the way to present it.

So thank you for your suggestions! I'll incorporate it in the next release. (Probably date of release: this friday or saturday)

Misj'

Quote from: Pumaman on Sun 21/10/2007 18:27:35
Good work, thanks! I'd like to include this with the AGS 3.0 distribution if that's ok -- but before I do so, can I just check about the graphics. I'm assuming they're ripped from MI3, is that the case? If so I'll have to replace them with some very dodgy home-made images before including it.

Nooooo! - Not dodgy home-made images :P

Alternatively, I would like to give a small gift containing alternative (png) images for an AGS-template-Verb-Coin.



All files (in .png format) are contained within the following zip-file: http://www.2dadventure.com/ags/Misj-VerbCoin-Graphics.zip. The resolution of each sprite is the same as it's counterpart used in the original (MI3) template, and the Verb-Coin graphics contain one inactive, and three seperate active images.

All that rests me is a nice disclaimer (also contained within the zip-file)...since I don't want these graphics to end up in public domain.  :-[

Quote from: Misj'
------------------------------------------------------------------------------------------------------------------------------------
Graphics for the Verb-Coin-GUI for Adventure Game Studio 3 (AGS3).
------------------------------------------------------------------------------------------------------------------------------------

All graphics are created by Misj' in CorelDraw X3. These  images
are not in public domain, but may be used for GUI-templates for
AGS (as well as AGS games using that GUI). The images may not be
altered without permission of the author (with the exception of
file type conversions, and alterations to the empty inventory
sprite to create additional inventory items).

If you have created a GUI using these graphics, and you would
like to acknowledged me, do so at the location of distribution,
or in a text-file accompanying the GUI (or not at all ;) ).

These graphics were created as a gift to the AGS community, and
Chris Jones - creator of the Adventure Game Studio - in particular.

Have fun adventuring,

Misj'
23.10.2007
------------------------------------------------------------------------------------------------------------------------------------

Ps. No, I have no idea why wooden nickels would come in such a bag...but I didn't have time to think about that :)

Pps. The name 'Adventure Game Studio' is emprinted onto the coin. This is done, because these are only (AGS) template graphics, created to encourage people to draw their own game-specific versions.

SupSuper

Well using pre-made templates is the first step towards laziness :P though nice job. Maybe you should do the 3.0 default template too. ;)
Programmer looking for work

Electroshokker

Quote from: Misj' on Tue 23/10/2007 19:02:27

Nooooo! - Not dodgy home-made images :P

Alternatively, I would like to give a small gift containing alternative (png) images for an AGS-template-Verb-Coin.

Great! I'm pretty much done fixing the code to more user-friendliness as well as some bug fixes. I created a background containing some stuff from the old AGS demo game and quickly threw in an old colored sketch for character.

Only thing left to do now is add keyboard support... then I can release the new template. ;)

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Electroshokker

Quote from: Jim "Dualnames" Span on Thu 25/10/2007 10:21:56
Do that will ya?

Version 1.1 is released. It includes basic keyboard support and all new graphics (and some minor jokes)

(Only thing "missing" is the label gui not displaying which custom action you're doing when pressing one of the action keys, like when using the mouse)


Notice: for some reason I couldn't save it as a template anymore (AGS just crashes when I try that), so I deleted the big files (debug and the backup sprite set), and zipped it all.

@Chris: could you figure out why it crashes when attempting to save as a template?

Radiant


Pumaman

Nice work with the graphics Misj, and with the template update Electroshokker! It's looking really good!

Quote@Chris: could you figure out why it crashes when attempting to save as a template?

Ah, this is happening because templates can't contain files with names longer than 24 characters, which the "ASCII Quick Converter.asc" file is breaching. I'll look into a fix for this.

Electroshokker

#18
Quote from: Pumaman on Fri 26/10/2007 21:09:55
Nice work with the graphics Misj, and with the template update Electroshokker! It's looking really good!

Thanks! Just noticed beta 15.

I discovered some new issues in my template whilest experimenting around a little:

major issue:

- high resolutions (800x600 and all higher resolutions achieved through filters) aren't supported yet. The verbcoin blinks in the upper left corner rather then open properly. This is a coördinate positioning bug.

minor issue:

- I left the custom_button1 expanded, so it can interfere when moving over the verbcoin to the right. Just setting all layout values to 1 fixes this.

I'll fix these issues and update the template.

EDIT:

- the high resolutions problem is not an issue. It only occurs if you call a room other then 1 from on_game_start()

- as for the custom_button1: see above fix.

Khris

That's a really cool Template, solid work!

You should be able to fix the resolution issue by removing the check for room 1.
It shouldn't matter if the code is called in every room.

A small suggestion: you're using many, many GetAtScreenXYs, especially in rep_ex.
Instead, you can put
Code: ags
Object*o=Object.GetAtScreenXY(mouse.x, mouse.y);
Hotspot*h=Hotspot.Get...
Character*c=...
InventoryItem*i=...
at the start of the function and use o, h, c, i afterwards. Will save a lot of typing and even a short deal of CPU time.

I've noticed a bug: open the VerbCoin over anything, then move the mouse ENE, above the talk button. The coin will disappear although the cursor hasn't left it.

Another thing I've noticed:
You're using checks for Hotspot.GetAtScreenXY(mouse.x, mouse.y) != null.
Those checks will never fail because it doesn't return null but hotspot[0].
It's a mean trap, and I fell for it a couple of times myself :)

SMF spam blocked by CleanTalk