AGS v2.7 Final: Yet Another Edition

Started by Pumaman, Sat 13/11/2004 21:02:00

Previous topic - Next topic

Pumaman

Ok, beta 15 is now up. This tidies up some bits and bobs to make 2.7 more release-worthy.

Now, that definitely is the last beta that I'm planning. The next version should hopefully be RC1.

Rui 'Trovatore' Pires

* Added GUI OnClick handler to provide a more intuitive way to handle clicks on the GUI background.

I suppose this is related to the disappearance of GUI_MDOWN and GUI_MUP. What do I replace my GUI_MUP code with, now?
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Pumaman

Good point. I kinda presumed that nobody actually used M_UP, and that the new OnClick would replace M_DOWN. If you find it useful, I can add it back.

Rui 'Trovatore' Pires

Very useful indeed. I have some code that, for compatibility, is only called when the player's mouse moves up.

Besides, wasn't it vital for verb coins? I thought it was...
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Gregjazz

Quote from: Rui "Erik" Pires on Sun 30/01/2005 21:20:46
Very useful indeed. I have some code that, for compatibility, is only called when the player's mouse moves up.

Besides, wasn't it vital for verb coins? I thought it was...

Yeah, I use that function, too.

Pumaman

Ok, no worries, I'll add an enum for it.

It should actually still work in this version if you use the GUI_MUP, it's just that I didn't create a new-style name for the event.

Rui 'Trovatore' Pires

Ah yes it does, if I uncheck "Enforce object-style" it works fine! Thanks for the tip.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

strazer

#387
Quote from: Pumaman on Sun 30/01/2005 15:49:01
QuoteYeah, that's what I meant. Not one module for every individual GUI interaction, one for every inventory item etc, but one big module for ALL GUI interactions, one for all inventory etc. So you'd end up with about 5 or 6 different, largeish modules.

That's not a bad idea ... I'll bear it in mind for 2.71.

Tracker'd: http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=501

Quote from: Pumaman on Sat 29/01/2005 10:33:33
QuoteWould it be possible for the compiler to support operators (at least + and *) in array declarations?

This is actually non-trivial to add but I'll bear it in mind.

Tracker'd: http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=500

Quote from: Pumaman on Sun 30/01/2005 21:18:45that the new OnClick would replace M_DOWN.

Hm, I used GUI_MDOWN to be able to change the cursor mode with a right click even when over the main GUI, since on_mouse_click isn't triggered then.
How would I do that now since OnClick isn't called when the mouse is over a GUI control?

And since we have tracker entries for label background color and border color, I propose to rename Label.Color to Label.TextColor.

Rui 'Trovatore' Pires

BTW, CJ, the new OnClick can't replace M_DOWN, because experimentation has showed me that it actually processes it UPON CLICKING. And some code should only be processed UPON THE MOUSE BUTTON BEING DEPRESSED, so that releasing it would "cancel and return to the previous thingie". Which is the way I did things. And after moving my (event== GUI_MDOWN && data==MIXER) to the gMixer OnClick handle and finding it did NOT work anymore, I had to move it back.

Heh. Looks like you can't remove or replace anything without risking these situations... ::)
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

TheMagician

QuoteAdded Button.TextColor property

Perfect timing ... I was just in need of that property!

QuoteAdded confirmation prompt in script editor if you choose "Discard and exit";

Thank you very very much ...Ã,  ;D

Scorpiorus

Quote from: Pumaman on Wed 26/01/2005 20:45:28
QuoteOne question about the unhandled_event function, could it be a good idea to replace their parameters with appropriate enum values, since enums are now autocompleted?

Good point. It's a bit difficult with unhandled_event though, because the second parameter can mean different things depending on the first one, so an enum wouldn't really work. It's a bit messy, come to think of it.
Ah, yeah I didn't notice the second parameter has different values for different things like look at for object is 0 but look at for hotspot is 1. And rearanging them now would mean the engine will not be backward compatible with games made in earlier versions if AGS.

SSH

Quote from: Scorpiorus on Mon 31/01/2005 17:10:58
Quote from: Pumaman on Wed 26/01/2005 20:45:28
QuoteOne question about the unhandled_event function, could it be a good idea to replace their parameters with appropriate enum values, since enums are now autocompleted?

Good point. It's a bit difficult with unhandled_event though, because the second parameter can mean different things depending on the first one, so an enum wouldn't really work. It's a bit messy, come to think of it.
Ah, yeah I didn't notice the second parameter has different values for different things like look at for object is 0 but look at for hotspot is 1. And rearanging them now would mean the engine will not be backward compatible with games made in earlier versions if AGS.

*cough* implement unions *cough*  :=
12

Pumaman

QuoteHm, I used GUI_MDOWN to be able to change the cursor mode with a right click even when over the main GUI, since on_mouse_click isn't triggered then.
How would I do that now since OnClick isn't called when the mouse is over a GUI control?

Ok, I'm convinced of the need to keep MDOWN and MUP. I'll add them both back in the next version.

Quote
And since we have tracker entries for label background color and border color, I propose to rename Label.Color to Label.TextColor.

Sounds like a plan, I'll do that.

QuoteBTW, CJ, the new OnClick can't replace M_DOWN, because experimentation has showed me that it actually processes it UPON CLICKING. And some code should only be processed UPON THE MOUSE BUTTON BEING DEPRESSED, so that releasing it would "cancel and return to the previous thingie".

I'm not really sure what you mean, because OnClick is called at exactly the same time as M_DOWN was. Anyway, as I say I'll add it back in the next version.

Quote*cough* implement unions *cough*

Quiet, you :P

strazer

I decided to update my main game to the new object-based scripting using AGS v2.7 Beta 15.
It compiles fine, but upon testing, I get

QuoteScript link failed: Runtime error: unresolved import
'InventoryItem::IsInteractionAvailable^1'

Here is an excerpt of my global rep_ex function that contains the part that causes the problem:

Code: ags

function repeatedly_execute() {

  // (...)

  if (IsGamePaused() == 0) {
	if (GetLocationType(mouse.x, mouse.y) == eLocationHotspot) { // if mouse is over a hotspot
		Hotspot *temp = Hotspot.GetAtScreenXY(mouse.x, mouse.y); // get hotspot
		temp.GetPropertyText("IsExit", hotspotisexit); // check hotspot for exit
	}
	else if (GetLocationType(mouse.x, mouse.y) == eLocationObject) {
		Object *temp = Object.GetAtScreenXY(mouse.x, mouse.y); // get object
		temp.GetPropertyText("IsExit", hotspotisexit);
	}
	else if (GetLocationType(mouse.x, mouse.y) == eLocationCharacter) {
		Character *temp = Character.GetAtScreenXY(mouse.x, mouse.y); // get character
		temp.GetPropertyText("IsExit", hotspotisexit);
	}
	else StrCopy(hotspotisexit, ""); // nothing, gui or inventory

	if (StrCaseComp(hotspotisexit, "") != 0) { // if mouse is over an exit
		if (lastmodebeforeexit == -1) lastmodebeforeexit = mouse.Mode; // store current cursor mode
		mouse.Mode = eModeWalkTo; // switch to walk mode
		if (StrCaseComp(hotspotisexit, NoTranslateProperty("N")) == 0) mouse.UseModeGraphic(eModeN); // if mouse over exit North, change mouse cursor to North exit sprite
		else if (StrCaseComp(hotspotisexit, NoTranslateProperty("NE")) == 0) mouse.UseModeGraphic(eModeNE);
		else if (StrCaseComp(hotspotisexit, NoTranslateProperty("E")) == 0) mouse.UseModeGraphic(eModeE);
		else if (StrCaseComp(hotspotisexit, NoTranslateProperty("SE")) == 0) mouse.UseModeGraphic(eModeSE);
		else if (StrCaseComp(hotspotisexit, NoTranslateProperty("S")) == 0) mouse.UseModeGraphic(eModeS);
		else if (StrCaseComp(hotspotisexit, NoTranslateProperty("SW")) == 0) mouse.UseModeGraphic(eModeSW);
		else if (StrCaseComp(hotspotisexit, NoTranslateProperty("W")) == 0) mouse.UseModeGraphic(eModeW);
	}
	else { // if mouse is NOT over an exit
		if (lastmodebeforeexit != -1) mouse.Mode = lastmodebeforeexit; // restore cursor mode (and mouse cursor)
		lastmodebeforeexit = -1;

		if (mouse.Mode == eModeInteract) {
			if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y) != hotspot[0]) || (Character.GetAtScreenXY(mouse.x, mouse.y) != null) || (Object.GetAtScreenXY(mouse.x, mouse.y) != null)) { // if mouse is over a hotspot, character or object

				if (IsInteractionAvailable(mouse.x, mouse.y, eModeInteract)) { // if interaction is defined
					mouse.UseModeGraphic(eModeUsermode1); // change mouse cursor to interaction indicator
				}
				else { // if hotspot interaction is NOT defined
					mouse.UseDefaultGraphic(); // restore normal mouse cursor
				}

			}

//--- THE FOLLOWING PART CAUSES THE ERROR:

			else if (InventoryItem.GetAtScreenXY(mouse.x, mouse.y) != null) { // if mouse is over an inventory item
				InventoryItem *temp2 = InventoryItem.GetAtScreenXY(mouse.x, mouse.y); // get item
				if (temp2.IsInteractionAvailable(eModeInteract)) { // if interaction for item is defined
					mouse.UseModeGraphic(eModeUsermode1); // change mouse cursor to interaction indicator
				}
				else { // if interaction for item is NOT defined
					mouse.UseDefaultGraphic(); // restore normal mouse cursor
				}
			}

//---

			else { // if mouse is anywhere else
				mouse.UseDefaultGraphic(); // restore normal mouse cursor
			}
		}
	}
  }

  // (...)

}


I'm just getting used to this, so I'm sure I'm missing something obvious here.

Edit:

Changed
  Hotspot.GetAtScreenXY(mouse.x, mouse.y) != null
to
  Hotspot.GetAtScreenXY(mouse.x, mouse.y) != hotspot[0]
since hotspot 0 is returned if there's no hotspot there.

Rui 'Trovatore' Pires

#394
What I mean is that I put some MDOWN code in the GUI OnCLick handler, and it didn't work anymore. Furthermore, the kind of behaviour I expected and which WASN't there made me assume that OnClick is not really being called when the player CLICKS on it, but rather CLICKS AND RELEASES, which - I've noticed - is the stardard way of AGS processing, which makes sense 99% of the time. For the other 1%, we praise God, CJ, AGS and M_UP/M_DOWN.

Either that, or the click upon the button in the GUI overrode it, which don't make much sense anyway.

EDIT - though it don't make much sense, it seems to be what's happening.

function gAction_Click(GUI *theGui, MouseButton button) {
  if (lstAction.SelectedIndex==lstAction.ItemCount-1) {

...and so on, and so on. If this is a valid check, I have no idea why clicking in the last item in the listbox doesn't work. And it does work in GUIM_DOWN/UP.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Scorpiorus

Yep, the same for me, seems like "InventoryItem::IsInteractionAvailable" just isn't linked with a certain engine's function.

Pumaman

Well spotted yes it's a bug, I'll fix it.

:)

Pumaman

Yes, that's because the GUI OnClick handler isn't called if you click on a GUI control, only if you click on the GUI background.

Rui 'Trovatore' Pires

Ah. Heh. Well, in that case it could never replace GUI_MDOWN. ;)
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

strazer

#399
We have a tracker entry for ENTER_ROOM_AFTER_FADEIN, should we rename eEventEnterRoom to eEventEnterRoomBeforeFadein to avoid confusion?

QuoteWell spotted yes it's a bug, I'll fix it.

Ah, ok, thanks. I thought I made a mistake when converting my script. :)

Edit:

I meant ENTER_ROOM_AFTER_FADEIN of course.  :P

SMF spam blocked by CleanTalk