Delay Args Syntax Error

Please post any questions about developing your plugin here. Please use the search function before posting!
decompile
Senior Member
Posts: 322
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Delay Args Syntax Error

Postby decompile » Thu May 18, 2017 11:02 am

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
User avatar
L'In20Cible
Project Leader
Posts: 955
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Delay Args Syntax Error

Postby L'In20Cible » Thu May 18, 2017 11:20 am

Syntax: Select all

kwargs=dict(sample=SOUND_NAME, update_positions=False)
decompile
Senior Member
Posts: 322
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Delay Args Syntax Error

Postby decompile » Thu May 18, 2017 11:53 am

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.
User avatar
L'In20Cible
Project Leader
Posts: 955
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Delay Args Syntax Error

Postby L'In20Cible » Thu May 18, 2017 12:06 pm

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).
User avatar
satoon101
Project Leader
Posts: 2389
Joined: Sat Jul 07, 2012 1:59 am

Re: Delay Args Syntax Error

Postby satoon101 » Thu May 18, 2017 12:28 pm

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
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 1 guest