Page 1 of 1

Script won't load

Posted: Thu Aug 29, 2013 11:59 pm
by arawra
This script just plain fails to load. No error in console.

SP version gives no output. Download from Aug-07-2013

[SP] Loading addon 'dnd'....
[SP] Addon 'dnd' was unable to be loaded.


Code: Select all

from messages import Chat

from Source import Player
from Source import Engine
from Source import Entity

from events import GameEvent


def round_start(GameEvent):
    userid = GameEvent.GetInt('userid')
    player = Player.EdictOfUserid(userid)
    index = Engine.IndexOfEdict(player)
    Chat(index, '[DND] Loaded!')

Posted: Fri Aug 30, 2013 2:25 am
by satoon101
http://www.sourcepython.com/forumdisplay.php?37-Source-Python-Wiki

The plugin has undergone many changes. Pretty much none of that script will work with the current version.

Satoon

Posted: Fri Aug 30, 2013 2:45 am
by arawra
There wouldn't happen to be a script I could look at for syntax, would there? The tutorial script also seems to be from an older version.

Posted: Fri Aug 30, 2013 2:52 am
by satoon101
Which tutorial script would that be? For a script that does what your example attempts to, look at these pages:
http://www.sourcepython.com/showwiki.php?title=Wiki:events
[url]http://www.sourcepython.com/showwiki.php?title=Wiki :p layers+helpers[/url]
http://www.sourcepython.com/showwiki.php?title=Wiki:messages

Sorry for the lack of example on events, but basically use the Event class like the following to register the function for the event:

Code: Select all

from events import Event

@Event
def round_start(game_event):
    pass
Also, there is no need to import GameEvent (or game_event) as that is just automatically passed to each event.

Satoon

Posted: Fri Aug 30, 2013 2:57 am
by arawra
With JUST that in my script, it still fails to load. Still no errors, still just "unable to load".

Windows 7
CS:GO Dedi Server Executable 1.30.2.0
CS:GO Dedi Server build 13:34:39 Aug 26 2013 (5406) (730)
SP Zip download from Aug 7 2013

Posted: Fri Aug 30, 2013 3:03 am
by satoon101
To get proper tracebacks in console, you need to set the logging level in your ../cfg/source-python/core_settings.ini file.

Satoon

Posted: Fri Aug 30, 2013 3:07 am
by arawra
Thank ya.

Yeah the problem is from the update, not the script. Thanks for the help.

Posted: Sun Sep 01, 2013 1:28 am
by satoon101
I knew what your error was, but I hadn't fixed it yet in the repository. It is fixed now, and I will upload a new version in a few days. In the meantime, you can get the update yourself from the repository.

Satoon