Page 1 of 1

Delay Args Syntax Error

Posted: Thu May 18, 2017 11:02 am
by decompile
Hey,

Im currently doing some Delay stuff, and Im getting a Syntax error in following line:

Syntax: Select all

player.delay(delay=SOUND_DELAY,
callback=player.emit_sound,
args=(sample=SOUND_NAME,
update_positions=False)
)


It appears that I cant use the '=' in args, but how do I else update 'update_positons' to False in the args.

Thanks for the help

Re: Delay Args Syntax Error

Posted: Thu May 18, 2017 11:20 am
by L'In20Cible

Syntax: Select all

kwargs=dict(sample=SOUND_NAME, update_positions=False)

Re: Delay Args Syntax Error

Posted: Thu May 18, 2017 11:53 am
by decompile
Thanks, works.

Just wondering, what kwargs do I need to fill in, that the sound is being played from the players loc as it does, but doesnt move its origin when you move.

Re: Delay Args Syntax Error

Posted: Thu May 18, 2017 12:06 pm
by L'In20Cible
I'm not sure if this is possible. However you could create an info_null entity at the player's location, emit the sound from that entity and after the sound is done playing spawn it (an info_null get deleted when it spawns).

Re: Delay Args Syntax Error

Posted: Thu May 18, 2017 12:28 pm
by satoon101
You should be able to do that without having to create another entity. Just use SOUND_FROM_WORLD as the index and the player's origin as the origin in emit_sound:
https://github.com/Source-Python-Dev-Te ... p#L99-L104

Also works with the Sound/StreamSound classes:
https://github.com/Source-Python-Dev-Te ... #L110-L116