Binds and commands, how i do?

Discuss programming in the QuakeC language.
Post Reply
Niit
Posts: 4
Joined: Mon Mar 16, 2009 1:33 am
Location: Brazil

Binds and commands, how i do?

Post by Niit »

Hello,
I would like to know if there is any way to bind a key for qc.


And also how to create a command and not by impulses (like the +hook in CTF).

Thank you,
Niit

PS: Sorry for the bad english, I'm from Brazil
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

binding a key in qc... stuffcmd(player, "bind uparrow +forward\n");

of course, that's hideous. you can't tell if they have that key bound or not, or if they have something else to do +forward, or anything like that so please don't do that.

creating +hook for instance:
stuffcmd(player, "alias +hook \"impulse 100\"\n");
stuffcmd(player, "alias -hook \"impulse 101\"\n");

then get the user to bind some key to do +hook and when they press it you'll receive impulse 100 followed by 101 when they release it again.
krimzon_sv_parseclientcommand allows you to use string commands instead of impulses, which are more reliable but mneh, impulses ftw.
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

Couldn't you also in theory do it from an autoexec.cfg included with the mod? Just the aliases of course, don't force binds on anyone, that's evil...
...and all around me was the chaos of battle and the reek of running blood.... and for the first time in my life I knew true happiness.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

yeah, you could do the aliases via a mod-specific default.cfg
Its generally considered bad karma to put +hook aliases in autoexec.cfg and certainly binds shouldn't go in there, binds really ought to go in default.cfg
autoexec.cfg is expected to be for the user to modify, and overrides all. config.cfg is the previous settings (delete for defaults), and default.cfg is... the defaults.

course, if this is a quakeworld mod then chances are the user won't download any of that stuff anyway, so won't benefit from any of it so the only option is to stuffcmd those aliases.
Really it depends if your mod is server-only(or download-off-server) or if they really do need to download a full mod off some website before they can connect to that server.
Niit
Posts: 4
Joined: Mon Mar 16, 2009 1:33 am
Location: Brazil

Post by Niit »

Thank you,

I just creating a SINGLE PLAYER mod.

I go to use the autoexec.cfg to the aliases.

Niit
Post Reply