Delay problems

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Delay problems

Postby Kami » Tue Dec 27, 2016 10:28 pm

Hey guys I'm currently trying to create and remove an overlay in hl2dm.

This is are the ways I tried to do it:

Code: Select all

def create_overlay(index, overlay, duration):
    player = Player(index)
    player.client_command('r_screenoverlay %s' % overlay)
    player.delay(duration, remove_overlay, index)
 

def remove_overlay(index):
    player = Player(index)
    player.client_command('r_screenoverlay 0')


This will result in the following error:

Image

The other thing I tried was:

Code: Select all

def create_overlay(index, overlay, duration):
    player = Player(index)
    player.client_command('r_screenoverlay %s' % overlay)
    player.delay(duration, player.client_command, 'r_screenoverlay 0')


This would lead to this error:

Image


I'm not sure what to do now, so any help is appreciated! :)
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Re: Delay problems

Postby D3CEPTION » Wed Dec 28, 2016 5:35 am

its the same error for both, sp doesnt check for the callbacks arg types, so you have to pass a sequence as it says in the error or it will listdivide your string etc..

Code: Select all

player.delay(duration, remove_overlay, (index,))
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Re: Delay problems

Postby Kami » Wed Dec 28, 2016 7:51 am

Okay, wow. This is propably the only thing I did not try already and it works. Thank you very much for that quick and great help! :)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 27 guests