Dark and Light Elves

Console Commands

As most mod developers who have worked on multiplayer mods know, UI scripts are run only client-side, but there's still a lot you can do with them if you can script for a server-client scenario.



You enter commands through the chat console. When you press ENTER in-game, a horizontal textbox appears near the bottom of the screen, and you use it to type messages to other players in Multiplayer or enter built-in commands (e.g. cheat codes) in Single Player.

Any of the following commands and subcommand options can be abbreviated to 3 or more letters each. For example "/inventory drop" can be abbreviated to "/inv drop" or "/inv dro", etc. Commands are not case sensitive.

MP = multiplayer, SP = single player

All commands that are marked as SP-enabled means that they affect the currently selected party member rather than your hero/party leader. For example, "/inventory drop" will drop all the items in the selected party member's inventory to the ground.

  • /CAMERA... (using this command requires Ikkyo's dsdll)
      Sets the azimuth (-50 to 90) and distance (0 to 18) to preset values preferred by this mod's author [MP, SP]
    • /CAMERA AZIMUTH integer_min integer_max
      Sets the (angular) azimuth range if the min and max values fall in the -87 to 90 inclusive range [MP, SP]
    • /CAMERA DISTANCE integer_min integer_max
      Sets the distance range if the min and max values fall in the 0+ range, although keep in mind that 20 as a max allows a pretty far zoom already! [MP, SP]
  • /GHOST...
      find out whether or not the host has changed the ghost timeout duration [MP] (not sure this command works properly!)
    • /GHOST SETTIMER integer
      change ghost timeout duration [MP host only]
  • /GIVE string
    generate items by specifying a pcontent string as the parameter [MP, SP] (similar to the DSMOD give command, except items are spawned on the ground)
  • /GOLD integer
    give hero [MP, SP] the specified amount of gold
      delete hero inventory contents [MP, SP]
      drop hero inventory contents [MP, SP]
      attempts to unlock the hero's [MP, SP] or selected party member's [SP] frozen inventory screen (even though that problem should not be caused by this mod if you're using the most current version)
  • /NAME string
    change hero [MP host only, SP] or selected party member [SP] name
  • /PARTY...
    • /PARTY ADD string
      Adds the hireable npc or pack animal whose template is specified by the string parameter to your party [MP host only, SP]

How To Extend It

Familiarize yourself with skrit's StringTool class, because you'll probably want to do a fair amount of string parsing. Also, keep in mind that this isn't a tutorial on UI scripting (which is nearly identical to component scripting anyway).

To add new commands, edit or remove existing commands, edit the contents of the following functions (in the skrit files):

  • bool ProcessCommandMP$( string command$, string input$, int elements$ )
  • bool ProcessCommandSP$( string command$, string input$, int elements$ )
A command string looks something like this...
/command parameter1 parameter2 etc..
In this case, the first letter is the forward slash, which I call the "bang". Some Dungeon Siege commands start with + or - (e.g., +zool), and maybe you want to, instead, add commands whose effects can be turned on or off by specifying a + or - bang, respectively.

The parameters...

  • command$ is the substring from input$ that contains the bang and command name
  • input$ is the entire command string, including the bang and command name (to get individual parameters, use the StringTool.GetDelimitedValue( input$, INDEX, ' ', "") call, where INDEX is an integer greater than 1, which will return the whitespace delimited string at the specified index)
  • elements$ is the number of whitespace-delimited substrings in input$ (that means the number of parameters is elements$ - 1)
Let's take a look at a simplified version of the processing of the command /ghost settimer F, where F is a nonnegative float or integer value, which is added by this mod's TEST addon resource file, in k_inc_console_mp.skrit. It is a server-side, multiplayer-only command with multiple parameters:
//match the first three letters of the command name
if ( StringTool.SameNoCase(command$, "ghost", 3) ) {
	//check if there are at least two parameters, and
	//check if this command is being executed by the host
	if ( (elements$ > 2) && IsServerLocal() ) {
		//get the first parameter (subcommand)
		command$ = StringTool.GetDelimitedString(input$, 1, ' ', "");
		//match first three letters of the subcommand
		if ( StringTool.SameNoCase(command$, "settimer", 3) ) {
			//get the second parameter (duration)
			float duration$ = StringTool.GetDelimitedFloat(
				input$, 2, ' ', -1.0);
			if ( duration$ > -1.0 ) {

Origin Ramblings

Xaa mentioned something about catching cheat commands at the source by monitoring input for his siegelet project Mageworld in his Saga of My Little Pony thread. Although no specifics were mentioned, the concept percolated in the back of my mind for a while. Monsoon's UI mod added a separate chat box for altering player character names, and when I had trouble adding a new chat box UI control of my own for a different thing, I figured that I could just jury rig the existing chat box to process additional text of my choosing. I later realized that this was probably the gist of how you add your own skrit-driven commands.