Working on some cgame function wrappers that can be added to scripts to interpret your own commands, or close file descriptors, or add commands to auto completion for instance.
Ex:
Code:
-- return 0 to pass through to cgame
-- return 1 to interpret cmd here
-- cmd is command accepted from CG_ConsoleCommand via CG_Argv(0)
function cg_ConsoleCommand(cmd)
if cmd == "mycmd" then
--run functions, do work, etc
return 1
end
return 0
end
Code:
function cg_DrawActiveFrame(serverTime, stereoView, demoPlayback)
cg.Print(string.format("cg_DrawActiveFrame: [%d] [%d] [%d]\n", serverTime, stereoView, demoPlayback))
end
Code:
-- clientNum is the clientNum passed from the vmCall to CG_Init
function cg_Init(clientNum)
cg.Print(string.format("cg_Init: [%d]\n", clientNum))
end
Code:
function cg_ShutDown()
-- close any file descriptors, do clean-up, etc.
end