Inside3D!
     

stuffcmd tutorial

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Wed Dec 23, 2009 8:44 am    Post subject: stuffcmd tutorial Reply with quote

i wrote this and put it on my homepage i figured it might have a little use here too so ...


In this basic tutorial ill show you how to stuffcmd something. there's a lot of uses when using this so i think its a good tutorial.

ok to start off we need to have something to stuffcmd.

so lets make a function to print your name. just for something to use.

so i always like to make a new .qc file to put most of my custom stuff in and another for custom definitions so my way of doing things might be a little weird to some. but it helps me keep organized.

so first things first lets make a new .qc files called custom. in this file add your function to print your name like so:

Code:
void() nameprint =
{
if (self.impulse == 15) // if self.impulse equals 15 .
centerprint(self,self.netname);  // print my name in the center of the screen.
};

next thing to do is go to weapons.qc and go down to "impulse commands." IN this function you want to add:



Code:
if (self.impulse == 15) // sets self.impulse to 15
nameprint(); // and if its 15 calls our function.





next save and open up client.qc go down to "clientconnect" and in this function paste this:


Code:
 stuffcmd(self,"alias myname \"impulse 15\"\n");
stuffcmd(self,"bind m myname \n");


next, make one more .qc file and name it moddefs.qc in this paste your new definitions. when modding i like to have all of my custom definitions within my own def qc file. helps me keep track of what im doing.what you have should look like this:
Code:
void() nameprint ;



last step, open up progs.src and make it look like this:


Code:
../progs.dat
 
defs.qc
         moddefs.qc  // added this
subs.qc
fight.qc
ai.qc
combat.qc
items.qc
weapons.qc
world.qc
client.qc
player.qc
monsters.qc
doors.qc
buttons.qc
triggers.qc
plats.qc
misc.qc
         custom.qc  // added this
 
ogre.qc
demon.qc
shambler.qc
knight.qc
soldier.qc
wizard.qc
dog.qc
zombie.qc
boss.qc
 
tarbaby.qc    // registered
hknight.qc    // registered
fish.qc    // registered
shalrath.qc    // registered
enforcer.qc    // registered
oldone.qc    // registered


the only issue with adding the bind stuffcmd is that every time the player connects IF he has a custom bind set to your alias it will reset their to the default you set. but like i said stuffcmding can be used for a lot of things this is just a tutorial to familiarize you with using it.
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group