Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Mouseentry loops?  (Read 4238 times)

0 Members and 1 Guest are viewing this topic.

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Mouseentry loops?
« on: August 22, 2011, 06:16:13 PM »

Hi all.

I'm trapping a MouseEntry event thus:
on "MouseEntry"
  {
  this.Active = false;
  if(Game.Language != "English")
    {
   Translate.Message = "FRIDAY";
   if(Translate.Loaded != true)
     {
     Game.Msg("!!!!");
     //Translate.Window = Game.LoadWindow("interface\Localization\Translator.window");
     Translate.Loaded = true;
     }
   }
  while(Translate.Loaded == true)
   {
   Sleep(20);
   }
  }

This routine loops! The Game.Msg keeps being displayed. Before I commented out the window, that kept getting loaded. I thought MouseEntry was a single event, but it appears to be constantly testing its state. What am I missing?

Thanks



Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Mouseentry loops?
« Reply #1 on: August 23, 2011, 07:16:19 AM »

MouseEntry is only sent once.
You seem to be deactivating the entity though. If the entity is deactivated and activated again, the event will be sent again (because technically the mouse left and reentered the entity in that case).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Mouseentry loops?
« Reply #2 on: August 23, 2011, 02:02:48 PM »

It seems that MouseEntry, on its own loads the window and that's the end of it. But introduce a MouseLeave event to the same script, and the MouseLeave code runs, while the mouse is still over the entity... huh? The MouseEntry then runs again, and round and round we go, "Loading window, Closing window". I thought the mouse had to leave for MouseLeave to run? Here's the whole script. Grateful for your spotting any errors. Cheers.

if(Translate.Loaded == null)
  {
  Translate.Loaded = false;
  }

on "MouseEntry"
  {
  this.Interactive = false;
  if(Translate.Loaded != true)
    { 
    if(Game.Language != "English")
      {
     Translate.Message = "FRIDAY";
      Game.Msg("loading window");
     Translate.Window = Game.LoadWindow("interface\Localization\Translator.window");
     Translate.Loaded = true;
     Sleep(200);
     }
   }
  this.Interactive = true;
  }
 
on "MouseLeave"
  {
  this.Interactive = false;
  if(Translate.Loaded == true)
    {
    Game.Msg("closing window");
   Translate.Loaded = false;
   var win = Translate.Window;
   win.Close();
   Sleep(200);
   }
  this.Interactive = true;
  }

 
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Mouseentry loops?
« Reply #3 on: August 23, 2011, 04:30:33 PM »

Now you're making the entity non-interactive. This will also cause the MouseLeave event to trigger.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Mouseentry loops?
« Reply #4 on: August 24, 2011, 11:18:59 AM »

Thanks Mnemonic. Sorry I didn't get it the first time. I get it now. Cheers for the help.
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com
 

Page created in 0.129 seconds with 18 queries.