Xonotic Forums
[SUGGESTION] Event keys - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10)
+--- Forum: Xonotic - Suggestion Box (https://forums.xonotic.org/forumdisplay.php?fid=20)
+--- Thread: [SUGGESTION] Event keys (/showthread.php?tid=419)



Event keys - clanclanclan - 05-12-2010

A great feature to have in Xonotic would be event binds, ie when an event happens a command is triggered without having to dirty your hands in QC.

A really easy (from the user's perspective, anyway) method of implementing this would be to have events as keys, so you could use the current bind <key> <command> syntax like bind <event> <command>. You could have some of the Quake C entry points as events and some others too, which could include:
e_on_vehicle_enter, e_on_vehicle_exit, e_on_deathtype_riddled, e_on_game_exit, e_on_server_connect, e_on_server_disconnect, etc., etc..

Is this a realistic idea? Is it even worth it? Is it already implemented/planned?


RE: Event keys - DiaboliK - 05-12-2010

Its realistic but there are a lot of events to create.


RE: Event keys - Roanoke - 05-18-2010

Some events already have this. Do "apropos _hook_gamestart".


RE: Event keys - Mr. Bougo - 05-20-2010

To use those gamestart hooks, alias cl_hook_gamestart_foo to whatever command you want it to execute, where foo is one of the possibilities listed in the apropos list.
sv_hook are serverside hooks.

When I implemented that, I thought of what event I could use to trigger aliases, and gamestart/end seemed to be the only necessary ones...


RE: Event keys - Roanoke - 05-20-2010

With the gametype-specific hooks, one can run a specific set of binds for different gamemodes (so you don't say "I have the flag!" during a DM match.)


RE: Event keys - clanclanclan - 05-21-2010

Hmm, that's roughly what I need.

I s'pose that if I need more I'll add them as I'm going Smile


RE: Event keys - Mr. Bougo - 05-21-2010

Add them? How? Tongue

Anyway, I thought the other events (for example flag capture or even worse, fragging) would lead to annoying auto-spam... So I left those out.


RE: Event keys - clanclanclan - 05-21-2010

I'll have to see how it's the current aliases are called in Xonotic, but if I really want them I'll have to add them myself in a similar way.

I definitely see what you mean about spamming:
GOOD SHOT!
NICE CAP!
I JUST DIED!
JOINING THE RED TEAM!
I THINK I MIGHT HAVE ENTERED THE RAPTOR!

Update: I found where it is currently, it's simply called on Gamemode_Init() and CSQC_Shutdown().


RE: Event keys - Mr. Bougo - 05-21-2010

Yep, though you can't add your own... CSQC modding is impossible due to hash checks, to prevent cheating.
Besides, hooks for different events would likely have to be placed somewhere else, and in a different way.

If you have good ideas for hooks, feel free to suggest them or better, implement them and submit a patch, before xonotic is released.


RE: Event keys - clanclanclan - 05-21-2010

Mr. Bougo Wrote:If you have good ideas for hooks, feel free to suggest them or better, implement them and submit a patch, before xonotic is released.

Sounds like an easier way to do this Big Grin