CG_InitConsoleCommands Tab Completion Problem


(CoD4Fun) #1

hi all,

i had a problem today which did cost me about 3 hours of senseless coding until i found out that the coding itself was not the problem. instead there was sth wrong about the way i started the game. well let me explain what i did specifically:

i normally installed vc and the source code. i opened cg_consolecmds.c and there i went to CG_InitConsoleCommands() to add another command in the end of that function. i added

trap_AddCommand ("testcmd");

i did compile (no errors) and went to test the code. the result of that snippet should have been a tab completion with no real function behind it, but as i started the game with

sv_pure 0
g_gametype 2
devmap radar

there was no effect to see. so i tried here and there and a stunning 3 hours went by when i was almost done, headache to its fullest, and then tried to start the game with the ‘host game’ menu. and suddenly the tab completion took effect.

can someone pls explain the inner meaning of this ? im happy that i finally made it, but what is this about ? i start the game via devmap and it is not working, i start the game via ‘host game’ and it works perfectly.

thanks for replies


(stealth6) #2

start the game with +fs_game “yourmod” ?


(CoD4Fun) #3

hi stealth,

i did that. i played my mod the whole time like that. other things worked great so far, for example changing the starting ammo to 35 or calling specific functions, always worked great. strange thing though is that once i did ‘host game’ it will also work on ‘devmap’ mode.

if you got questions or need more info pls ask. i want to know why this happens because i really like to start my mod via ‘devmap’ mode. i wrote a makro for that :slight_smile:


(Paul) #4

Try look the one above, and press go to declaration and stuff… Maybe it’s defined somewhere else to and you forgot to add your custom one there?


(CoD4Fun) #5

hi paul,

what do you mean by ‘the one above’

…and press go to declaration and stuff… Maybe it’s defined somewhere else to and you forgot to add your custom one there?

this is what i tried for 3 hours with several of the other commands which are great examples i thought. but it turned out that for the tab completion you need to add only 1 line of code, nothing more. but i can only get it to work if i once started it with ‘host game’ like i explained above.

pls reproduce it if you dont know what i mean, add this 1 line of code in your project in this specific function and you will see that it will only work if you played with ‘host game’. well i hope so, because then the problem might be with me and i really wouldnt know what to do then.


(CoD4Fun) #6

bump

just for the sake of nosiness. did anyone tried this and can confirm that changes in the code in that special function will only get accepted when you start your mod with host game.

kinda confusing to me :confused:


(ailmanki) #7

I suggest to log everything , and monitor that file… maybe something else is going wrong and your mod ain’t loaded when using devmap.


(CoD4Fun) #8

did you try what i explained on your own ?

can you pls do it !

tell me what is your result.

do it in this order: first devmap, then host game, then again devmap. im repeating myself :confused: im searching for the reason and therefore need info if it is the same with others too. the mod defintly gets loaded.


(system) #9

…deleted…:slight_smile:


(CoD4Fun) #10

whatever you wanna say with this.


(dutchmeat) #11

Change ‘testcmd’ to something else, cause it’s likely to be used by ET’s devs(atleast i thought it was).
After you’ve done that, use cg_printf in the addCommand function to see if it’s being called, so you know its your mod


(system) #12

Sorry, i wrote something without thinking so i deleted my message :slight_smile: .