Adding Script Events to sys: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
 
m (categorised)
Line 5: Line 5:
  /src/game/script/script_thread.cpp (and .h)
  /src/game/script/script_thread.cpp (and .h)


Just add them there as you would add any other script events (see iddevnet.com for a guide to adding script events, there are a lot of steps)
Just add them there as you would add any other script events (see iddevnet.com for a guide to adding script events, there are a lot of steps).


I'm compiling my changes now and still have to test them, but hopefully it'll work. This way you can add events that are global, for example as a frontend for accessing a global object contained in game_local.
This way you can add events that are global, for example as a frontend for accessing a global object contained in game_local.


The "sys" object is an artificial "global object" within the scripting language. The scripting language only sees actual spawned entities, and the global object. So you can't have abstract objects (like container classes contained within an entity or something). Therefore if you want an object to call functions on without spawning an entity, the "sys" object is a good choice. (It's not a real object in the sdk either, it's just seen that way by scripting, and it can only call methods/events on the idThread class)
The "sys" object is an artificial "global object" within the scripting language. The scripting language only sees actual spawned entities, and the global object. So you can't have abstract objects (like container classes contained within an entity or something). Therefore if you want an object to call functions on without spawning an entity, the "sys" object is a good choice. (It's not a real object in the sdk either, it's just seen that way by scripting, and it can only call methods/events on the idThread class).


[[Category:SDK]]
{{sdk}}

Revision as of 08:06, 30 June 2008

Originally written by Ishtvan on http://forums.thedarkmod.com/topic/1582

Btw, if anyone's curious how to add new "sys" events, i.e., events you call with $sys.<eventname> from the script, they're located here:

/src/game/script/script_thread.cpp (and .h)

Just add them there as you would add any other script events (see iddevnet.com for a guide to adding script events, there are a lot of steps).

This way you can add events that are global, for example as a frontend for accessing a global object contained in game_local.

The "sys" object is an artificial "global object" within the scripting language. The scripting language only sees actual spawned entities, and the global object. So you can't have abstract objects (like container classes contained within an entity or something). Therefore if you want an object to call functions on without spawning an entity, the "sys" object is a good choice. (It's not a real object in the sdk either, it's just seen that way by scripting, and it can only call methods/events on the idThread class).