View Single Post
Old 02-09-2007, 11:34 AM   #6
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
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


iojamp project lead / coder

Last edited by ensiform; 02-09-2007 at 04:05 PM.
ensiform is offline   you may: quote & reply,