Could you check my game for room crash/error?

Started by steptoe, Wed 22/02/2012 05:16:03

Previous topic - Next topic

steptoe

#20
Ghost, No, both sounds actually last for about 10 seconds but looped as per music.

The error message line states line blah blah which was the Volume property (audio channel) line which I have now taken out. Not sure what else could cause someone to have these problem.

If you feel that this could be what is causing the problem perhaps I should look at changing the music files altogether for new ones?

I know this is probably the wrong place for this but it is on subject:

Code: ags

// room script file

function room_Load()
{
  gIconbar.Transparency=0;
  gIconbar.Visible=true;
  region[2].Enabled=false;
  }


function room_AfterFadeIn()
{
   RemoveWalkableArea(2);
   RemoveWalkableArea(4);
   aBEES.Play();
   object[0].SetView(60);
   object[0].Animate(0, 4, eRepeat, eNoBlock);
   cjonesy.Walk(45, 198, eBlock, eAnywhere);
   cjonesy.Say("Agh! A massive beehive with lots of deadly bees! How am I going to get passed without being stung to death!!");
   region[2].Enabled=true;
   }

function region1_WalksOnto()
{
  cjonesy.Say("I can't pass by without getting stung! I need those bees to buzz off!");
}

function oleaves_Look()
{
  Display("You see some dead, dried leaves");
}

function oleaves_Interact()
{
  Display("You could grab the dried leaves but you have a better idea!");
}

function oleaves_UseInv()
{
  aBEES.Play();
  
  if (cjonesy.ActiveInventory==ilighter)
 {
   region[1].Enabled=false;
   RestoreWalkableArea(2);
   cjonesy.Walk(112, 188, eBlock);
   cjonesy.ActiveInventory=null;
   cjonesy.LoseInventory(ilighter);
   cjonesy.LockView(62);
   cjonesy.Animate(2,4, eOnce, eBlock);
   object[1].Visible=false;
   cjonesy.UnlockView();
   object[2].Visible=true;
   object[2].SetView(61);
   object[2].Animate(0, 4, eRepeat, eNoBlock);
   object[2].Transparency=40;
   object[0].Graphic=989;
   aBEES.Stop();
   //AudioChannel *channel =   
   aANIMALSOUNDS.Play();
  // Wait(40);
  // channel.Volume = 100;
   cjonesy.AddInventory(ilighter, 20);
   cjonesy.Walk(54,198, eBlock);
   cjonesy.FaceLocation(104, 197);
   cjonesy.SetWalkSpeed(10, 10);
   cjonesy.Say("Now's my chance to shifty passed!");
   cjonesy.Walk(311, 176, eBlock, eWalkableAreas);
   cjonesy.Walk(340, 176, eBlock, eAnywhere);
   cjonesy.ChangeRoom(18, 16, 190);
   }
 else 
 {
  
   Display("As if that is going to help!");
   }
 }


function obees_Look()
{
  Display("The beehive is huge!");
  }

function obees_Interact()
{
  Display("No way are you touching that beehive! There must be a way to shoo those bees away!");
  }

function obees_UseInv()
{
  Display("That would only aggreviate the bees to attack!");
  }

function region2_WalksOnto()
{
  cjonesy.Say("I can't go back. I must get the sacred tablet!");
  }

function hHotspot1_Look()
{
  Display("The Indian sky is clear and has an orangy colour");
  }

function hHotspot2_Look()
{
  Display("The Indian country is very overgrown with plants and is jungle like and stretches for miles. You can hear animals nearby");
 }

function hHotspot2_Interact()
{
  Display("It's best you keep to the path and not enter the jungle overgrowth unless you really have to!");
  }

function hHotspot3_Look()
{
  Display("The Indian path is just dried dust");
  }

function room_RepExec()
{
 
 }


cheers

steptoe



Ghost

Hm. Looks solid, and I see no problems with the volume change. But you play aBees without parameters and later call aBees.Stop... that could actually be the offensive line. If I remember correctly you can only call Stop to a sound that is actually playing.

Khris

Regarding AudioChannel.Volume and null pointer errors:
I'm pretty sure that one can't call channel.IsPlaying() to avoid a null pointer error that occurs due to channel being null.
Because if that's the case, channel.IsPlaying() will also throw that error.

The reason why it doesn't is that after the sound has finished playing, the AudioChannel will still be there, and so channel will still point to something valid.

Changing the volume of a channel that isn't playing anything does nothing but won't throw an error either.

Now in the manual, in the example given for AudioChannel.Volume, it says:
Code: ags
AudioChannel *channel = aExplosion.Play();
Wait(40);
channel.Volume = 20;

Not only is the curious Wait(40) in there, but the pointer is also named "channel".

steptoe, it looks like you used a code example from the manual without really getting what it does. There's no need to Wait(40) if you just want to increase the volume of the sound you're trying to play.

Also, I can't make heads or tails of this:
Quote from: steptoe on Sat 25/02/2012 15:42:30strange but line 158 was a Hotspot interact with a Display but on just looking the Hotspot Interact Events Panel Hotspot NO Interact was not assigned!! Weird...
Could you please just post line 158 and surrounding ones, and mark line 158 somehow?

steptoe

Hi Khris,

thanks for your informative answer.

I did not really need to use AudioChannel.Volume I should have used Volume property (system) instead.

I have since taken out all AudioChannel.Volume and have just used basic music.Play() so it does not seem to be relevant anymore.

Also, due to a revamp, the original line 158 has now GONE.

I understand more about volume channels and null pointers now, so next time i will keep this is mind.

I am presently waiting for an updated test report.

Thank you guys very much

steptoe





SMF spam blocked by CleanTalk