Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Window events handler  (Read 2849 times)

0 Members and 1 Guest are viewing this topic.

mRax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 55
    • View Profile
Window events handler
« on: March 09, 2007, 02:31:50 PM »

Hello! :) I need in a little advice. The trouble is in playing sound, when mouse pointer is become on button (or, equally, when WME automatically use back_hover image for button).

I didn't find any window events in documentation, so I'm thinking about solution in entities now, i.e.

Code: [Select]
var lst=NULL;
while(TRUE){
  var obj=Game.ActiveObject;
  if(obj!=lst){
    if(obj.Caption=="button")
      Game.PlaySound("sounds\menu\button_on.wav");
    else Game.PlaySound("sounds\menu\button_off.wav");
    lst=obj;
  }
  Sleep(AMBIENT_LAG);
}

But what about window events? Or any other ideas? :)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Window events handler
« Reply #1 on: March 09, 2007, 05:40:52 PM »

Attach the following script to the button:

Code: [Select]
on "MouseEntry" this.PlaySound("button_on.wav");

on "MouseLeave" this.PlaySound("button_off.wav");
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

mRax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 55
    • View Profile
Re: Window events handler
« Reply #2 on: March 13, 2007, 04:31:07 PM »

Thanks :) What about responses in the ResponseBox? Are LeftClick, MouseEntry and MouseLeave events in responses?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Window events handler
« Reply #3 on: March 13, 2007, 04:53:22 PM »

The response buttons are generated by the engine and you can't access them from scripts. If you need some advanced functionality for response selection, you'd have to reimplement the response box from scratch.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.02 seconds with 19 queries.