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: PlaySoundEvent in scene_init  (Read 5149 times)

0 Members and 1 Guest are viewing this topic.

Jose

  • Regular poster
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 134
    • View Profile
PlaySoundEvent in scene_init
« on: February 13, 2011, 04:57:12 PM »

Hi,

I've trying to use the PlaySoundEvent method in an scene_init.script but it seems that the event never rises. I've tried with this.PlaySoundEvent() and also creating an entity and executing the PlaySoundEvent from the entity but the event had been never rised.

If I execute the PlaySoundEvent from a script attached to a scene region entity then the event rises fine.

Anyone can help me?

Thanks in advance.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: PlaySoundEvent in scene_init
« Reply #1 on: February 13, 2011, 06:09:51 PM »

How exactly are you using the function? The event is triggered in the object that's used to play sound. So if you use "this.PlaySoundEvent()" in scene_init.script, "this" is a scene, so the event is triggered in scripts attached to a scene.

Code: WME Script
  1. this.PlaySoundEvent("sound.ogg", "SomeEvent");
  2.  
  3. on "SomeEvent"
  4. {
  5.   Game.Msg("blah");
  6. }
  7.  

This should work.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Jose

  • Regular poster
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 134
    • View Profile
Re: PlaySoundEvent in scene_init
« Reply #2 on: February 13, 2011, 06:19:02 PM »

Hi Mnemonic I've a scene_init.script like that

Code: [Select]

#include "scripts\base.inc"

// here comes the stuff which initializes the scene

this.PlaySoundEvent("music\intro\intro.ogg", "soundOver");

////////////////////////////////////////////////////////////////////////////////
on "soundOver"
{
    Game.Msg("On event");
}

////////////////////////////////////////////////////////////////////////////////
// scene state
global Stateintro;


// default values
if(Stateintro==null)
{
  Stateintro.Visited = false;
  // add scene states here
}



////////////////////////////////////////////////////////////////////////////////
// setup scene according to state variables



////////////////////////////////////////////////////////////////////////////////
if(!Stateintro.Visited)
{
  Stateintro.Visited = true;

  // this is our first visit in this scene...
}


but when the game run, on that scene I can hear the sound but I can't see the message. Even if I set a breakpoint on the Game.Msg line the game doesn't stop on it.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: PlaySoundEvent in scene_init
« Reply #3 on: February 13, 2011, 06:23:11 PM »

Well, if this doesn't work, it's a bug, I'm afraid.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Jose

  • Regular poster
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 134
    • View Profile
Re: PlaySoundEvent in scene_init
« Reply #4 on: February 13, 2011, 06:29:50 PM »

OK, I'll try to find a workaround  ;)

Thanx!
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: PlaySoundEvent in scene_init
« Reply #5 on: February 13, 2011, 06:42:16 PM »

It does seem to work for entities, only scene has a problem.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Jose

  • Regular poster
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 134
    • View Profile
Re: PlaySoundEvent in scene_init
« Reply #6 on: February 13, 2011, 07:15:30 PM »

Yes, but only for entities created in Scene Editor. If you create it dynamically, for example in scene_init.script, it does neither work I think...
« Last Edit: February 13, 2011, 11:45:07 PM by Jose »
Logged

eborr

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 196
    • View Profile
Re: PlaySoundEvent in scene_init
« Reply #7 on: February 13, 2011, 10:11:22 PM »

maybe I am missing something really obvious, whynot just

Scene.PlaySoundEvent()
Logged

Jose

  • Regular poster
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 134
    • View Profile
Re: PlaySoundEvent in scene_init
« Reply #8 on: February 13, 2011, 11:44:10 PM »

I'm afraid it doesn't work either eborr...
Logged
 

Page created in 0.051 seconds with 22 queries.