Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Husky

#21
Specific question: How can I keep GUI button animations running while the Text Window is open while keeping the rest of the game paused as usual?

Details: For my character's speech, I'm opening a GUI with the character's portrait on a button, then I'm opening a separate Text Window next to the portrait using DisplayAt.Ã,  While this works great with still portrait images, for animated portraits I'm having trouble keeping the portrait animated in the GUI while the Text Window is active.Ã,  The Text Window seems to pause the game (actually a good thing) but unfortunately this includes pausing the portrait animations (a bad thing.)

Here is what I have been doing:
Code: ags

gPortrait.Visible=true;Ã,  // opens portrait GUI
ButtonFace.Animate(2, 0, 4, eRepeat);Ã,  // Sets the animation for the button on the portrait
DisplayAt (72,44,236, "A few words.");Ã,  // Text appears next to the portrait.Ã,  Oh no!Ã,  The portrait animation has paused.
gPortrait.Visible=false;Ã,  //closes portrait GUI


Of note, the portrait button image is changed a lot in the game based on who is talking and what they are doing.Ã,  Sometimes it is an animation and sometimes it is still.Ã,  I'm hoping to discover a solution that is flexible enough to accommodate this.

I'd greatly appreciate anyone's thoughts.
Thank you in advance.
#22
Excellent idea, GarageGothic.Ã,  A "switch the direction" scroll option does seem in order.Ã,  Thank you.
#23
Good points, KhrisMUC.Ã,  I will use eMouseWheelSouth to select the next mouse mode and eMouseWheelNorth select the previous mouse mode.Ã,  Thank you.
#24
Thanks for the additional input, KhrisMUC.

Before this thread is closed as solved, I'm just curious, if anyone has an opinion on an issue of style.Ã,  Is it more intuitive to use eMouseWheelSouth to select the next mouse mode and eMouseWheelNorth to select the previous mouse mode?Ã,  Or should it be the opposite?Ã,  I'm experimenting with both, and they both seem fine to me.Ã,  However, if there is a convention or a general preference, I'd love to know so I don't annoy everyone by getting it backwards in the game.

Thanks again.
#25
Brilliant!Ã,  First, I did not activate "Enable mouse wheel support.”Ã,  Ã, And yes, I feel embarrassed admitting that.Ã,  Second, you were correct about adding the extra brackets to the code â€" they were needed.Ã,  Finally, I made a few minor corrections.Ã,  Now it works perfectly.Ã,  The mouse wheel is now able to switch the modes both forward AND backward.Ã,  Thank you, GarageGothic.Ã,  For the record, here is the final working code with corrections.

Code: ags

function on_mouse_click(MouseButton button) {
Ã,  // called when a mouse button is clicked.
Ã,  if (IsGamePaused() == 1) {
Ã,  Ã,  // Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button == eMouseLeft) {
Ã,  Ã,  ProcessClick(mouse.x, mouse.y, mouse.Mode );
Ã,  Ã,  }
else if ((button == eMouseRight) || (button == eMouseMiddle) || (button == eMouseWheelSouth)) {
Ã,  Ã,  mouse.SelectNextMode();
Ã,  Ã,  }
else if (button == eMouseWheelNorth) {
// simulate "Mouse Select Previous Mode" which is currently unsupported
	Ã,  if (mouse.Mode == eModeUseinv)
		Ã,  Ã,  mouse.Mode = eModeTalkto;
	Ã,  else if (mouse.Mode == eModeTalkto)
		Ã,  Ã,  mouse.Mode = eModeInteract;
	Ã,  else if (mouse.Mode == eModeInteract)
		Ã,  Ã,  mouse.Mode = eModeLookat;
	Ã,  else if (mouse.Mode == eModeLookat)
		Ã,  Ã,  mouse.Mode = eModeWalkto;
	Ã,  else if ((mouse.Mode == eModeWalkto) && (player.ActiveInventory != null))
		Ã,  Ã,  mouse.Mode = eModeUseinv;
// player has inventory item active so go to Useinv
	Ã,  else if ((mouse.Mode == eModeWalkto) && (player.ActiveInventory == null))
		Ã,  Ã,  mouse.Mode = eModeTalkto;
// player has no active inventory item so skip to Talkto
	}
}
#26
Thank you for the reply, GarageGothic.Ã,  First, you made a good correction to the final line of code, my error.Ã,  Second, you bring up a good point that all cursor modes are not always available in a game.Ã,  I'll need to tackle that next.Ã,  But for now, I think my specific problem is getting eMouseWheelNorth and eMouseWheelSouth to work, period.Ã, 

I've put together this little test to try and isolate the problem.Ã,  In the test, eMouseRight, eMouseMiddle, and eMouseWheelSouth should advance the Mouse Mode.Ã,  eMouseWheelNorth should display “Horray, I work!"Ã,  Unfortunately, the results of this test are, eMouseWheelSouth and eMouseWheelNorth do absolutely nothing, yet the left and right mouse buttons act properly.

Code: ags

function on_mouse_click(MouseButton button) {
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  if (IsGamePaused() == 1) {
Ã,  Ã,  // Game is paused, so do nothing (ie. don't allow mouse click)
	}
		else if (button == eMouseLeft) {
Ã,  Ã,  ProcessClick(mouse.x, mouse.y, mouse.Mode );
Ã,  Ã,  }
		else if (button == eMouseRight || eMouseMiddle || eMouseWheelSouth) {
Ã,  Ã,  mouse.SelectNextMode();
Ã,  Ã,  }
		else if (button == eMouseWheelNorth) {
		Display("Horray, I work!");
		}
}


I need to figure out how to get some sort of response from the mouse wheel.Ã,  Thoughts?
#27
I'm stumped on how to get the middle mouse wheel to select both the next and previous mouse modes.Ã,  I know that Select Previous Mouse Mode is currently unsupported.Ã,  However, I've been unsuccessfully trying to script a workaround.Ã,  Here is what I have so far (please note, I have no programming background, except for studying the AGS manual and reading past posts, so if I've made obvious mistakes, know I'm diligently working to improve.):

Code: ags

function on_mouse_click(MouseButton button) {
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  if (IsGamePaused() == 1) {
Ã,  // Game is paused, so do nothing (ie. don't allow mouse click)
	}
		else if (button == eMouseLeft) {
			ProcessClick(mouse.x, mouse.y, mouse.Mode );
Ã,  Ã,  }
		else if (button == eMouseRight || eMouseMiddle || eMouseWheelSouth) {
			//Any of these mouse events trigger Select Next Mouse Mode
			mouse.SelectNextMode();
Ã,  Ã,  }
		else if (button == eMouseWheelNorth) { 
			// simulate "Mouse Select Previous Mode" which is currently unsupported
			if (mouse.Mode == eModeUseinv)
			mouse.Mode == eModeInteract;
			else if (mouse.Mode == eModeInteract)
			mouse.Mode == eModeLookat;
			else if (mouse.Mode == eModeLookat)
			mouse.Mode == eModeWalkto;
			else if (mouse.Mode == eModeWalkto && (cCharacter.ActiveInventory != null)
			mouse.Mode == eModeUseinv;
			// player has inventory item active so go to Useinv
			else if (mouse.Mode == eModeWalkto && (cCharacter.ActiveInventory == null)
			mouse.Mode == eModeUseinv;
			// player has no active inventory item so skip to Talkto
		}
}


If any of you programming gurus have any advice for me, I'd greatly appreciate it.Ã,  Thanks in advance.
SMF spam blocked by CleanTalk