i have some questions about this project:
- will there be somewhat of a system for C++ addons to expose functionality? (like sourcemods extensions) - i think this would be nice even in a basic form because i think this was a problem in eventscripts.. i mean, DIY worked okay for SPE, but if there was many other addons it wouldn't be very cute i think.
- is there a reason this is a VSP and not using mm:s?
and a suggestion; i think it would be cool to expose engine functionality in some kind of generic way such that it would be easy to support multiple scripting engines in the future (even if you plan not too, others will have the option in the future - i think this maybe why the sourcemod python extension didn't mature). although i know it's currently heading against this method, i just thought to put it out there.
and finally, i have some feedbacks for you which you can feel free to ignore or not, since i know it's very early and you probably know about these issues (and some of them might even by my fault XD):
- the NODEFAULTLIB cmake configurations seem to be reversed (ignores libcmtd on release which i had to change to libcmt in order to compile and vice-versa), though i'm not too well versed on these conflicts.
- there's a few missing #ifs for SOURCE_ENGINE<3 builds (GetLaunchOptions, Get/SetUint64), and a link with interfaces.lib which shouldn't be necessary on <3 builds
- it seems like addons can be loaded multiple times? or at least very weird things happen when making mistakes like this, including crashes and sometimes an inability to reload addons
- it seems you need to explicitly make global almost every reference within an addon (including imports and functions), otherwise you get a name error (ie. script below demonstrates what i had to do to get it working)
Syntax: Select all
###############################################################################
## EventScripts3 Test
import engine as _engine
import random
engine = None
def load():
global engine, _engine
engine = _engine.GetEngine()
print('** Hihi~ from test.py @ ES3 :3 **')
def unload():
print('** Ciao~ from test.py @ ES3 :3 **')
def player_say(event):
global set_gravity, random
print('** Player say from test.py @ ES3 :3 **')
if not event.IsEmpty('text') and not event.IsEmpty('userid'):
text = event.GetString('text')
if text == '.gravity':
set_gravity(random.randint(100, 800))
else:
print('Player (%s) :: \'say\' :: %s' % (event.GetInt('userid'),
text))
def set_gravity(n):
global engine
engine.ServerCommand('sv_gravity %s\n' % n)
engine.ServerExecute()
###############################################################################
anyway, i'm excited for this project! and i'm glad you are using a good build system, this will hopefully releive people of making many manual edits to makefiles to get things compiling :) ciao~