Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Kaz

Pages: 1 ... 12 13 [14] 15 16
196
Ah, I hadn't thought of that, thanks. Although I guess it would be better if my code was written so I didn't make the error of addressing an empty Node in the first place!  :-[

I'll recheck my logic.

197
Hello M and Mn

The sound is an ogg. Thanks for looking at the method.

One last thing: what do I need to do to stop getting this:

11:00:34:  Runtime error. Script 'scenes\04_Lounge\ANSAPHONE\scr\Play.script', line 33
11:00:34:    Call to undefined method 'Reset'. Ignored.


from this code?
   a = Scene.GetNode("subx");
   Sprite = a.GetSpriteObject();
   Sprite.Reset();


Thanks

Kaz

198
Interesting new development. Thanks for the idea to create a minigame, it's definitely thrown up something...

In order to create the minigame, I had to rebuild the sprite. Half a dozen timed frames, with a sound file connected to the first frame. Set that running in SpriteEdit. Then press the 'stop' button. The animation stops, but the sound keeps going! So even SpriteEdit cannot stop the attached sound - so I'm less surprised now that I couldn't stop the sprite in the game either. Could that be a bug?

In any case, although sprites would be a convenient way of handling this scene, the sound handling seems suspect. I guess I'll take the sound out and control it separately with a MusicChannel. That way I can do an IsMusicChannel and if it's true, do a StopMusicChannel at the same time as an ent.Active=false on the node carrying the subtitles (after resetting the node's sprite of course).

Thanks for all your help guys.

Cheers

Kaz

199
I've given up on this one. I'll find another way of playing the messages. Still don't know why I couldn't control the sprite though, which is disconcerting.

200
Hi Metamorphium,

Yes I'm sure about that. The code that runs the sprite is in another part of the Attached script, and it must be working, because the sprite plays its designated mixture of subtitles and voiceover:
var Sprite;
var a;
global gNextMessageToPlay;
  if(gNextMessageToPlay == 1)
    {
   gHeardMessage1 = true;
    Sprite = "scenes\04_Lounge\ANSAPHONE\TommyANSA1.sprite";
             a = Scene.GetNode("subx");
   a.SetSprite(Sprite);
   a.Active = true;
    }
So if I'd got the case wrong relative to the scene entity, it wouldn't play, let alone stop, right?

Cheers

201
Hi,

I've attached the whole script - because now the game just gives me a run-time error and says that 'Pause' is not defined.

I'm completely at a loss.

#include "scripts\base.inc"
//
global gNextMessageToPlay;
global gHeardMessage1;
var a;
var Sprite;
Game.AttachScript("scenes\04_Lounge\ANSAPHONE\scr\MessagePlay.script");
//
on "LeftClick"
  {
  // Disable exit
  a = Scene.GetNode("zoom_out");
  a.Active = false;
  //
  Game.PlaySound("sounds\LittleSwitch.ogg");
  Sleep(500);
  // Are we listening to the bleep?
  a = Game.IsMusicChannelPlaying(1);
  if(a == true)
    {
    Game.StopMusicChannel(1);
    }
  //
  // Are we listening to a message?
  a = Scene.GetNode("subx");
  Sprite = a.GetSpriteObject();
  if(!Sprite.Finished && !Sprite.Paused)
    {
    Game.Msg("I'm not finished");
    Sprite.Pause();
    }
  else
    // if we can't hear a message, time to play one
    {
    if(gHeardMessage1 == false)
      {
      gNextMessageToPlay = 1;
      Game.MessageNumber();
      }
    Game.PlayMessage();
    }
  }

202
Oops with the brackets. Put them in, but the sprite still rolls merrily on. The script is running because I see the Game.Msg.

I've even tried disabling the Node that carries the sprite, but the message and subtitles keep coming no matter how often I go through the routine.

203
Oops

Din't complete edit b4 sending - code should read

// Are we listening to a message?
a = Scene.GetNode("subx");
m = a.GetSpriteObject();
if(m.Finished == false && m.Paused == false)
  {
  Game.Msg("I'm not finished");
  Game.StopSound();
  m.Reset;
  m.Pause;
  }

204
Nope. that didn't work

This sprite is relentless. No matter what I throw at it, it just keeps going. It's a message on an answering machine, subtitles and sound in one sprite. I put it into Node "subx" with a 'SetSprite' and then check if it is running- with a view to stopping it if it is. My code is:

// Are we listening to a message?
a = Scene.GetNode("subx");
m = ItemNormal.GetSpriteObject();
if(m.Finished == false && m.Paused == false)
  {
  Game.Msg("I'm not finished");
  Game.StopSound();
  m.Reset;
  m.Pause;
  }
But it just trundles on. This is how much hair I had before I started writing this script.  O0 This is me now.  ???  I tried to copy the hints Mnemonic and Metamorphium gave me and I've read everything I can find. What am I doing wrong?


205
Hi Mnemonic

Thanks for that. Put that way, looks obvious :-)

Can you please point me to where I'd find that in the documentation? I'd prefer not to ask daft questions when the answer is already catered for in the script engine.

Thanks

Kaz

206
Actually, what I'm mainly looking for is what to check to see if the sprite is running. Can anybody tell me plase what should be in my
'if' statement to test whether or not a sprite is running?

Thanks

207
Thanks Metamorphium

The effect I'm trying to achieve is "If this, then do that - if any sprite is running in node subx, stop it." I tried to make the code you pointed me work like an 'if', thus:
b = null;
a = Scene.GetNode("subx");
b = a.GetSpriteObject();
if(b != null)
  {
  b.Reset();
  }
Doesn't work, the sprite in subx keeps playing. Thanks for the assistance and forgive me for being unable to implement it. Any pointers gratefully accepted.

Regards

Kaz

208
Technical forum / How to check if a sprite is running and stop it?
« on: March 08, 2008, 05:28:51 PM »
Hi all

I set a sprite running in an entity like this:
a = "MySprite.sprite";
b = Scene.GetNode("SpritePlace");
b.SetSprite(a);

Which works fine, but I can't figure out how to check if the sprite is running and then stop it. I guess it must be something to do with querying the entity? I've put 'Stop Sprite running' into the forum, but nothing seems to point me to the answer. Can anybody help?

Thanks

Kaz

209
Technical forum / Re: Global variable becoming corrupted?
« on: March 03, 2008, 06:16:49 PM »
Hi Metamorphium

Took me a while to get back to this part of development but thanks to the help from you and Mnemonic, I got it working, and I've learned a bit more about attaching scripts and methods now.

Why not use function? Coz I haven't figured out the difference between that and method yet, but method works, so I can crack on. Thanks again.

Ta

Kaz
 

210
Technical forum / Re: loop avi as a background
« on: March 03, 2008, 12:24:51 PM »
Wow, worked beautifully! And converting to ogg brought it down from 143Mb to 140Kb!

Brilliant, thanks very much.

Kaz


Pages: 1 ... 12 13 [14] 15 16

Page created in 0.027 seconds with 19 queries.