SOLVED: gInventory conflicting script issue with mouse mode.

Started by Slasher, Mon 25/03/2013 10:31:56

Previous topic - Next topic

Slasher

Hi

I think I may have a conflicting script issue with mouse mode.

It revolves around the gIconbar and in particular the 'Close' gInventory button.

When I close (cancel) either the Save or Load GUI's the mouse returns to its previous mode.

However, when closing gInventory the mode (view) goes to  pointer view if nothing is selected.

I do have it so pointer mode is that of Interact view when ginventory is open.

It should return once closed to it's mode before ginventory was opened if nothing is selected.

Like I say, its probably a script confliction.

The Save and Load cancel buttons are ok and only make that gui close with no other commands.

Don't know if this helps:

Code: AGS

// IN GLOBAL HEADER

int old_mode;

  void Talk(this Character*, String message) {
  lblTalk.Text = message;   // label's script name: lblTalk
  gTalk.Visible = true;       // GUI's script name: gTalk
  int delay = (message.Length * GetGameSpeed()) / Game.TextReadingSpeed;
  int min_delay = (Game.MinimumTextDisplayTimeMs * GetGameSpeed()) / 1000;
  if (delay < min_delay) delay = min_delay;
  int ignore_delay = (Game.IgnoreUserInputAfterTextTimeoutMs * GetGameSpeed()) / 1000;
  mouse.Visible = false;
  Wait(ignore_delay);
  delay -= ignore_delay;
  if (delay > 0) WaitMouseKey(delay);
  mouse.Visible = true;
  gTalk.Visible = false;
}

 // After combining inv items return to arrow

function on_event(EventType event, int data)
{
 if(event == eEventAddInventory && mouse.Mode == eModeWalkto)
 {
  mouse.Mode = eModeInteract;
  mouse.UseModeGraphic(eModePointer);
 }
}
 

function repeatedly_execute_always() 
{
 // WHEN CURSOR OVER STATUSLINE GUI
 
  GUI* theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);
  if (theGui == gStatusline && mouse.Mode != eModePointer) 
 {
    old_mode=mouse.Mode;
    mouse.ChangeModeGraphic (eModePointer, 304);
    mouse.Mode = eModePointer;
  }
  
 if (theGui != gStatusline && mouse.Mode == eModePointer && mouse.GetModeGraphic(eModePointer) == 304) 
 {
    mouse.Mode=old_mode;


If you close ginventory without selecting an inv item I want Mode to go back to the Mode it was before ginventory was opened. As I said, it does when closing Save or Load gui's.

I hope I have explained this problem ok

cheers

EDIT: At the moment I have cancelled changing mode graphic to pointer when in inventory. When closing Inventory it shows hand Interact. Not exactly what I wanted but will do for now until fully solved.

26th march
EDIT: All solved (well, 99%)  8-)





SMF spam blocked by CleanTalk