View Single Post
Old 08-06-2007, 09:07 PM   #22
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Game Monkey Script Status Update:

- Now Uses PhysFS
- CG_ConsoleCommand is no longer intercepted
- Now has global Commands table that you set Commands to a function.
- Color Constants added to "COLOR" table.
- Garbage Collection is turned off during Init and when dispatch command is called if there is more than the cmd arg.
- Tweaked the other intercept functions a bit.
- Removed: CGAME.Argv, CGAME.Argc, and CGAME.ConcatArgs (No longer really needed).

The following functions are available in the "CGAME" table:
  • ChatmMsg
  • Time
  • SVTime
  • Milliseconds
  • Broadcast
  • SiegeValid
  • PlayerData
  • ForceData
  • ItemData
  • PowerupData
  • ClassData
  • TeamPlayers
  • CleanColor
  • LoadHud
  • AddCommand
  • RemoveCommand
  • LastAttacker
  • CrosshairPlayer
  • StrIStr
  • StrReplace
  • GetKeyCatcher
  • SetKeyCatcher
  • Cvar_Get
  • Cvar_Set
  • Cvar_Clear
  • Command
  • ReliableCommand
  • GetTranslatedString
  • GetConfigString
  • Gametype
  • ScoreboardActive
  • DemoPlayback
  • IsJedi
  • IsMerc
  • IsJedivsMerc
  • IsJediMaster
  • InstagibMode
  • MutantMode
  • IsMutant
  • IsBottomFeeder
  • Info_ValueForKey
  • IsEnsiMod
  • IsPublicBeta
  • IsJAPlus
  • EnsiModVer
  • DrawPic
  • RegisterShader
  • RemapShader
  • TextWidth
  • TextHeight
  • DrawText
  • GetPointContents
  • TraceLine

The following items are allowed to be set to functions in the "Events" table:
  • Init
  • Shutdown
  • Draw2D
  • RunFrame
  • CenterPrint
  • Chat
  • Respawn

Global Commands table works like so:
NOTE: The commands must actually come before you set them here (so put these at bottom of file).

Code:
Commands["csdump"] = CSDUMP;
CSDUMP looks like so:
Code:
global CSDUMP = function(csnum_str) {
	if (csnum_str == null) {
		print("usage: csdump [csnum]");
		return;
	}
	csnum = ToInt(csnum_str.Int);
	if (csnum < 0 || csnum >= MAX.CONFIGSTRINGS) {
		print("csdump: illegal csnum");
		return;
	}
	cs = CGAME.GetConfigString(csnum).String();
	print(cs);
};
The parameter will be null if local player did not specify that arg.

Moved constants to separate tables based on what the constant is part of.

CGAME.MAX_* becomes MAX.*
CGAME.KEYCATCH_* becomes KEYCATCH.*
CGAME.SCREEN_* becomes SCREEN.*
CGAME.(PLAYERDATA ITEMS) becomes PD.*
CGAME.ITEM_TEXTSTYLE_* becomes TEXT.*
CGAME.FONT_* becomes FONT.*
CGAME.CS_* becomes CS.*
CGAME.TEAM_* becomes TEAM.*
CGAME.GT_* becomes GAME.*
CGAME.CHAT_* becomes CHAT.*
Added WEAPON.*, AMMO.*, FORCE.*
Added COLOR.* (for colorTable in CGAME ie drawing text, etc).


iojamp project lead / coder

Last edited by ensiform; 10-04-2007 at 01:20 AM.
ensiform is offline   you may: quote & reply,