per Scorpicus2k, this change will be going in:
http://www.eqemulator.net/forums/viewtopic.php?t=13920
meaning that we can start calling functions from the server. IMO we should move as many of these exported variables into getVariable functions on the server as possible. This will save some overhead. Once you have the userid exported (I'm assuming this is charid?.. haven't checked), you can use that to determine player level, inventory, race, gender, etc.
It just doesn't make sense to keep a lot of these variables the way they are with this new capability, so if you are thinking of adding new ones, please take a look at the perl/XS docs. The framework is now in to start adding functions. Briefly, the way I do it is:
- create C function that we are going to be calling
run h2xs in some directory to create a workspace (one-time thing)
create .xs file, including C function or C function prototype (whatever you feel like doing)
generate C code from .xs file
insert original C function, and XS-generated C code into cperl.cpp, also adding in the appropriate newXS() call.
I had plans to add some new functions (to replace hasitem, etc), and also write a little tutorial.. I'm thinking I may not get around to it before I take off to school this week, though. :cry: