Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Nadarian on Tue 21/07/2020 13:51:27

Title: [SOLVED] Associating an ambience sound to an object (custom property error)
Post by: Nadarian on Tue 21/07/2020 13:51:27
Hi!

I have this ticking looping sound I want to associate to a wall clock, that plays just when you're in that specific room, and permanently stops when you pick up the object (there's background music playing on a loop in the meantime).
I've tried with a custom property, which has worked perfectly for me in many other occasions, but here this "So_Rellotge" gives me the undefined token error all the time.

Code (ags) Select

function room_Load()
{
if  (So_Rellotge)
  {
    aRellotge.Play();
  }


And I really don't know what am I doing wrong, as there are other properties in the exact same function, all working fine, except this one.


Thanks in advance!
Title: Re: Associating an ambience sound to an object (custom property error)
Post by: Khris on Tue 21/07/2020 14:13:01
By "custom property", do you mean "global bool variable"? Because you're using it like it's a global bool.
If that's a property, you need

Code (ags) Select
  if (oClock.GetProperty("So_Rellotge"))
Title: Re: Associating an ambience sound to an object (custom property error)
Post by: Nadarian on Tue 21/07/2020 14:21:42
Ok, solved in less than a minute... and felt a bit stupid here  (roll)
A month without coding, and I mistake custom properties for global variables.

Thanks for your infinite patience, Khris!!