Tremulous Forum
		Mods => Modding Center => Topic started by: googles on November 26, 2007, 11:11:35 am
		
			
			- 
				hey :-D i was just wondering where would i put/make an argument( like /say trem is $s would print trem is awesome!) in tremulous(cgame.qvm?) if you know please give me an example where and an example of an argument i already have the source and all that i just need a little direction :) please dont flame me :(
			
- 
				Well, with the current state of Trem you know that making a cgame mod is pointless if you ever want anyone to play it.
 
 I don't really know what you're thinking, but an example that simple could be done in just game.qvm via g_cmds.c. The code you're looking for is argc/argv. If you want to use all arguments "ie everything after token #x," look at how g_say works and see what function calls it uses.
 
 If you really want cgame, look at cg_consolecmds.c. It's done pretty similarly there though, I imagine.
- 
				So you want to add variable support... A quick look at the source:
 
 In cmd.c (which is part of the tremulous executable, not cgame), there are functions named Cbuf_*(), which are related to command line processing. Console and script commands are executed by adding them to the console buffer (as '\n'-terminated character strings), which are then executed every frame, or when you explicitly call Cbuf_Execute(). To add to the console buffer, use the Cbuf_AddText or Cbuf_InsertText commands, or you can use the Cbuf_ExecuteText to execute-right-now.
 
 That said, inside these 3 latter commands, you can edit and replace the $* characters with characters of the corresponding variable value. Note: for the ease of programming, you can store variables in cvars, named as $*, if you prefer. Note2: I don't see '$' being used anywhere in the command line processing, so normally, '$' will not conflict with anything. (If it will, you'll might want to replace variables in known commands, such as /say. But don't bother yourself with this.)
- 
				just to note im modding my client for anyone that doesnt know. I would also like to thank both of you for your advice and direction :)