Page 1 of 1
player.color don't work
Posted: Thu Sep 25, 2014 1:48 am
by 8guawong
Syntax: Select all
player.color = (255, 0, 0, 255)
Code: Select all
File '../addons/source-python/packages/source-python/entities/entity.py', line 241, in __setattr__
super(BaseEntity, self).__setattr__(attr, value)
File '../addons/source-python/packages/source-python/entities/entity.py', line 312, in set_color
self.rendermode = self.rendermode | 1
File '../addons/source-python/packages/source-python/entities/entity.py', line 235, in __setattr__
self.datamaps[attr]._set_value(value)
File '../addons/source-python/packages/source-python/entities/datamaps.py', line 368, in _set_value
getattr(self.current_pointer, self.set_attr)(value, self.offset)
Boost.Python.ArgumentError: Python argument types in
Pointer.set_char(Pointer, int, int)
did not match C++ signature:
set_char(CPointer {lvalue}, char, int offset=0)
Posted: Thu Sep 25, 2014 3:18 am
by L'In20Cible
Open the file
.../addons/source-python/packages/source-python/entities/datamaps.py and replace the line
48 by the following one. All the members I saw registered as FIELD_CHARACTER needs to be handled as integer.
Posted: Thu Sep 25, 2014 3:49 am
by 8guawong
L'In20Cible wrote:Open the file
.../addons/source-python/packages/source-python/entities/datamaps.py and replace the line
48 by the following one. All the members I saw registered as FIELD_CHARACTER needs to be handled as integer.
Code: Select all
player.color = (0, 0, 255, 255)
File '../addons/source-python/packages/source-python/entities/entity.py', line 241, in __setattr__
super(BaseEntity, self).__setattr__(attr, value)
File '../addons/source-python/packages/source-python/entities/entity.py', line 318, in set_color
self.render = value
File '../addons/source-python/packages/source-python/entities/entity.py', line 208, in __setattr__
self._set_property(attr, value)
File '../addons/source-python/packages/source-python/entities/entity.py', line 256, in _set_property
getattr(self.edict, 'set_prop_{0}'.format(prop.type))(prop.prop, value)
OverflowError: Python int too large to convert to C long
Posted: Thu Sep 25, 2014 4:19 am
by L'In20Cible
Replace 'int' by 'uint', then.
Posted: Thu Sep 25, 2014 4:22 am
by 8guawong
L'In20Cible wrote:Replace 'int' by 'uint', then.
Code: Select all
player.color = (255, 0, 0, 255)
File '../addons/source-python/packages/source-python/entities/entity.py', line 241, in __setattr__
super(BaseEntity, self).__setattr__(attr, value)
File '../addons/source-python/packages/source-python/entities/entity.py', line 312, in set_color
self.rendermode = self.rendermode | 1
File '../addons/source-python/packages/source-python/entities/entity.py', line 235, in __setattr__
self.datamaps[attr]._set_value(value)
File '../addons/source-python/packages/source-python/entities/datamaps.py', line 368, in _set_value
getattr(self.current_pointer, self.set_attr)(value, self.offset)
OverflowError: can't convert negative value to unsigned int

Posted: Thu Sep 25, 2014 4:26 am
by L'In20Cible
Alright, alright... 'long'

Posted: Thu Sep 25, 2014 4:33 am
by satoon101
lol.
I should also mention that the BaseEntity structure is getting a rewrite, currently. We will do our best to test all functionality prior to merging the changes into the master branch. Setting the color used to work fine, until we added in the datamap functionality. Instead of render and rendermode using send properties, the way they work in the current release is to use datamap offsets. These work slightly different than the send props, which is what is causing these errors.
Posted: Thu Sep 25, 2014 4:38 am
by 8guawong
L'In20Cible wrote:Alright, alright... 'long'
Code: Select all
player.color = (255, 0, 0, 255)
File '../addons/source-python/packages/source-python/entities/entity.py', line 241, in __setattr__
super(BaseEntity, self).__setattr__(attr, value)
File '../addons/source-python/packages/source-python/entities/entity.py', line 318, in set_color
self.render = value
File '../addons/source-python/packages/source-python/entities/entity.py', line 208, in __setattr__
self._set_property(attr, value)
File '../addons/source-python/packages/source-python/entities/entity.py', line 256, in _set_property
getattr(self.edict, 'set_prop_{0}'.format(prop.type))(prop.prop, value)
OverflowError: Python int too large to convert to C long

maybe i'll wait for the rewrite