Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: mRax on March 09, 2007, 02:31:50 PM

Title: Window events handler
Post by: mRax 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? :)
Title: Re: Window events handler
Post by: Mnemonic 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");
Title: Re: Window events handler
Post by: mRax on March 13, 2007, 04:31:07 PM
Thanks :) What about responses in the ResponseBox? Are LeftClick, MouseEntry and MouseLeave events in responses?
Title: Re: Window events handler
Post by: Mnemonic 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.