Page 1 of 1

Events

Posted: Fri Aug 16, 2013 12:15 pm
by mister-man
Hay,

today I tried some basic things about Events.

My Code:

Code: Select all

# =============================================================================
# >> IMPORTS
# =============================================================================

from events import Event
from AoD._libs import saylib

# =============================================================================
# >> FUNCTION
# =============================================================================

@Event
def player_spawn(GE):
    userid = GE.get_int('userid')
    psay = saylib.saylib()
    psay.tell('#greenYour userid is ' + str(userid) ,userid)


Error:

Code: Select all

[SP]  Caught an Exception:
Traceback (most recent call last):
  File '..\addons\source-python\_libs\addons\manager.py', line 48, in __missing_
_
    instance = _LoadedAddon(addon_name)
  File '..\addons\source-python\_libs\addons\manager.py', line 237, in __init__

    self._addon = __import__(addon_name + '.' + addon_name)
  File '..\addons\source-python\AoD\AoD.py', line 16, in <module>
    from AoD._plugins import player
  File '..\addons\source-python\AoD\_plugins\player.py', line 11, in <module>
    from events import Event
  File '..\addons\source-python\_libs\events\__init__.py', line 11, in <module>

    from events.manager import EventRegistry
  File '..\addons\source-python\_libs\events\manager.py', line 10, in <module>
    from events import EventsLogger

ImportError: cannot import name EventsLogger

Posted: Sun Aug 18, 2013 3:20 pm
by mister-man
I won't push, but no one with an idea?

Posted: Mon Aug 19, 2013 3:28 pm
by mister-man
I found these exampe, but it seems, there is the same bug as in my script

Code: Select all

@Event
def player_say(event):
    # Get the userid from the event
    userid = event.get_int('userid')
    # Get the CPlayerInfo instance from the userid
    playerinfo = playerinfo_from_userid(userid)
    # And finally get the player's name
    name = playerinfo.get_name()

Posted: Mon Aug 19, 2013 3:31 pm
by Omega_K2
You gotta fix it urself in that file, or update to a newer revision.

Posted: Mon Aug 19, 2013 4:23 pm
by mister-man
I updated today and compiled all new.
Same error.

Sry my experience with sp is not so big, but Im learning ;)


Edit1:
Okay I found the rev....

Thanks


Edit2:
Okay I tried a new reversion (11011a987fea)), but it seems there is the same error!

Code: Select all

[SP]  Caught an Exception:
Traceback (most recent call last):
  File '..\addons\source-python\_libs\addons\manager.py', line 48, in __missing_
_
    instance = _LoadedAddon(addon_name)
  File '..\addons\source-python\_libs\addons\manager.py', line 237, in __init__

    self._addon = __import__(addon_name + '.' + addon_name)
  File '..\addons\source-python\AoD\AoD.py', line 20, in <module>
    from events import Event
  File '..\addons\source-python\_libs\events\__init__.py', line 11, in <module>

    from events.manager import EventRegistry
  File '..\addons\source-python\_libs\events\manager.py', line 11, in <module>
    from events.listener import _EventListener
  File '..\addons\source-python\_libs\events\listener.py', line 10, in <module>

    from events import EventsLogger

ImportError: cannot import name EventsLogger

Posted: Tue Aug 20, 2013 11:32 am
by Omega_K2
Fix that manually for the time being.