[SOLVED] Associating an ambience sound to an object (custom property error)

Started by Nadarian, Tue 21/07/2020 13:51:27

Previous topic - Next topic

Nadarian

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

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!
Teaching film photography in the 21st century.
Now, trying to do it through adventure games.

Khris

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
  if (oClock.GetProperty("So_Rellotge"))

Nadarian

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!!
Teaching film photography in the 21st century.
Now, trying to do it through adventure games.

SMF spam blocked by CleanTalk