Search found 241 matches
- Tue Feb 03, 2015 4:02 pm
- Forum: Plugin Development Support
- Topic: PlayerEntity's properties broken?
- Replies: 2
- Views: 2383
- Mon Feb 02, 2015 1:00 pm
- Forum: Plugin Development Support
- Topic: PlayerEntity's properties broken?
- Replies: 2
- Views: 2383
PlayerEntity's properties broken?
This used to work a week or two ago: from players.entity import PlayerEntity from players.helpers import index_from_userid from events import Event @Event def player_spawn(game_event): entity = PlayerEntity(index_from_userid(game_event.get_int('userid'))) enti...
- Mon Feb 02, 2015 12:59 pm
- Forum: Plugin Development Support
- Topic: How to reset the player's sound to normal on player_blind?
- Replies: 55
- Views: 29250
- Sun Jan 25, 2015 12:03 pm
- Forum: Plugin Development Support
- Topic: Getting a PlayerEntity from player_connect?
- Replies: 7
- Views: 4969
- Sun Jan 25, 2015 11:57 am
- Forum: Plugin Development Support
- Topic: Getting a PlayerEntity from player_connect?
- Replies: 7
- Views: 4969
You cannot get a PlayerEntity instance from that event/listener. The index is not linked to the other player's objects at this point. Try with the player_activate event, instead. Still giving me the same error: [SP] Caught an Exception: Traceback (most recent call last): File '..\addons\source-pyth...
- Sun Jan 25, 2015 11:37 am
- Forum: Plugin Development Support
- Topic: Getting a PlayerEntity from player_connect?
- Replies: 7
- Views: 4969
Oh, this is my fault. ClientConnect listeners require more parameters. http://forums.sourcepython.com/showthread.php?670-Custom-params-in-event&p=3708&viewfull=1#post3708 ClientDisconnect requires only an index. Ahh okay sry, I should've figured that myself, the error just didn't tell me anything a...
- Sun Jan 25, 2015 11:11 am
- Forum: Plugin Development Support
- Topic: Getting a PlayerEntity from player_connect?
- Replies: 7
- Views: 4969
Getting a PlayerEntity from player_connect?
Hey! I'm attempting to get a PlayerEntity object when the player is connecting: from events import Event from players.entity import PlayerEntity players = [] @Event def player_connect(game_event): player = PlayerEntity(game_event.get_int('index')) players.append(p...
- Sun Jan 18, 2015 5:28 pm
- Forum: API Design
- Topic: Coding Style
- Replies: 42
- Views: 203510
Never let an editor wrap you code! That's ugliest thing you can do, imo. This will always generate different output depending on the size of your editor window and the type of you editor. Moreover it doesn't split you code logically. Here is an example how it will look like: def my_func(param1, par...
- Sun Jan 18, 2015 5:17 pm
- Forum: General Discussion
- Topic: Python imports style question
- Replies: 5
- Views: 4557
Isn't the whole module's code ran anyways, regardless of how you import it (correct me if I'm wrong)? So why use pickle_dump intead of just importing pickle? I actually find pickle.dump clearer than pickle_dump, since everyone surely knows that dot means it's dump function from pickle module. Yes, ...
- Sat Jan 17, 2015 12:27 pm
- Forum: Plugin Development Support
- Topic: unloading a sub module?
- Replies: 3
- Views: 3398
- Sat Jan 17, 2015 11:30 am
- Forum: API Design
- Topic: Coding Style
- Replies: 42
- Views: 203510
I feel I need to reiterate this, but these are guidelines for the plugin itself not for scripters to adhere to for their plugins. Ah yes, that's good news for me. I highly disagree with you both, and there are plenty of ways to properly break your code up to look nice without going over the 80 char...
- Sat Jan 17, 2015 11:20 am
- Forum: General Discussion
- Topic: Python imports style question
- Replies: 5
- Views: 4557
Everything else I pretty much agree on, but this just made me curious Other items, which can have ambiguous names, I often import and give them a new name: [python]from pickle import load as pickle_load from pickle import dump as pickle_dump[/python] Isn't the whole module's code ran anyways, regard...
- Tue Jan 13, 2015 4:46 pm
- Forum: API Design
- Topic: Coding Style
- Replies: 42
- Views: 203510
I dislike PEP8's 80 char limit per line and never follow it, I find that it breaks up the logic of your program just to look nicer. As for readability, we're in 2015, it's not hard to find an editor that can do dynamic word wrapping, it has the advantages of always wrapping at the correct spot, and...
- Sun Jan 11, 2015 10:22 pm
- Forum: Plugin Development Support
- Topic: player.health += health raises Boost.Python.ArgumentError
- Replies: 1
- Views: 2059
player.health += health raises Boost.Python.ArgumentError
File '..\addons\source-python\plugins\mymod\stuff\default_stuff.py', line 37, in on_attack player.health += hp 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\enti...
- Sun Jan 11, 2015 10:12 pm
- Forum: API Design
- Topic: Coding Style
- Replies: 42
- Views: 203510
Lines must be no longer than 80 characters (that includes the built-in \n, making it 79 characters of code) Satoon Why is the \n included here, any reasoning at all? Also, just curious, is there a reason you prefer not to use[PYTHON]from os.path import dirname, join, curdir[/PYTHON]Which is obvious...
- Sun Jan 11, 2015 8:25 pm
- Forum: Plugin Development Support
- Topic: Multiple buffs/debuffs with various times
- Replies: 5
- Views: 4148
- Tue Jan 06, 2015 5:14 pm
- Forum: Plugin Development Support
- Topic: Change event's name?
- Replies: 4
- Views: 3387
- Mon Jan 05, 2015 4:17 pm
- Forum: Plugin Development Support
- Topic: Change event's name?
- Replies: 4
- Views: 3387
Change event's name?
Hey there! I was wondering if it's possible (or would be possible in near future) to change event's name, i.e. have a set_name method for events. @Event def player_death(game_event): game_event_kill = copy(game_event) game_event_kill.set_int('victim', game_event.get_int...
- Fri Jan 02, 2015 10:06 am
- Forum: Plugin Development Support
- Topic: Timed player regeneration
- Replies: 6
- Views: 4860
- Thu Jan 01, 2015 3:55 pm
- Forum: Plugin Development Support
- Topic: Creating events of variable name without using the decorator?
- Replies: 6
- Views: 4954
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/packages/source-python/events/manager.py#L56 We haven't gotten around to making the wiki page for game_event_manager, but the following should help give a basic understanding of what you are looking to do: from...