Latest Updates: Difference between revisions

From Archon Wiki
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Command line handling =
Command line must start with CUSTOM  (that is CUSTOM followed by a space).  The rest of the command line is passed to the function CUSTOM_COMMAND() in LOADINIT.BSF with the custom command line in the first work string.  Note this is called after the LOADINIT function in the script, and after the main menu has come up (and in theory after any server messages etc).  Added partly as a first part for AGEOD integration, and also could be hooked up to the player-driven campaign game app from the forums.
[I am sure there will be some foibles trying to kick off battles from the main menu, but this provides a starting point.]
Note: the max length of the command line is 768 characters (not including the CUSTOM<space> header).
= Multiplayer UI Callbacks =
= Multiplayer UI Callbacks =
There are a number of callbacks for MP UI use
There are a number of callbacks for MP UI use
  <nowiki>FUNCTION MULTIPLAYER_USERDATA_CALLBACK()
  <nowiki>FUNCTION MULTIPLAYER_USERDATA_CALLBACK( [skirmish] )
{
{
// this should fill the work array with up to 16 values
// this should fill the work array with up to 16 values
Line 8: Line 13:
}
}


FUNCTION MULTIPLAYER_USERDATA_TOOLTIP_CALLBACK()
FUNCTION MULTIPLAYER_USERDATA_TOOLTIP_CALLBACK( [skirmish])
{
{
// this is called with the user data in the work array, and should fill the UI string with the appropriate tooltip
// this is called with the user data in the work array, and should fill the UI string with the appropriate tooltip
Line 15: Line 20:
}
}


FUNCTION MULTIPLAYER_USERDATA_ACCEPT_CALLBACK()
FUNCTION MULTIPLAYER_USERDATA_ACCEPT_CALLBACK( [skirmish, side] )
{
{
// this is called with the user data in the work array
// this is called with the user data in the work array
Line 21: Line 26:
// if returns !=0 then appends the contents of the first UI string to the list entry
// if returns !=0 then appends the contents of the first UI string to the list entry
return 0 ;
return 0 ;
}</nowiki>
}
 
FUNCTION MULTIPLAYER_PROT_ACCEPT_CALLBACK( [skirmish, side, prot] )
{
// this is called with the user data in the work array
// the prot value is the bitfield passed from the challenge.  Note that the top bit is always set and should be ignored.
// it should return the prot value based on the sides etc
// this allows correct disabling of games that the user cannot play based on their DLC ownership
// NOTE: if a game is accepted without the DLC being available it will still fail on battle start
}


FUNCTION SKIRMISH_COMMENT_CALLBACK()
{
// Allows for additional text to be added to skirmish descriptions in the MP creation screen.
// Place any string to be added in the first UI string
}
FUNCTION LOAD_USERDATA_CALLBACK( [skirmish] )
{
// Called immediately after loading the userdata when a game is loaded
// skirmish param is zero or one.  Userdata is in the first work array.
}
</nowiki>


= WriteScenarioFile =
= WriteScenarioFile =

Latest revision as of 17:36, 29 March 2019

Command line handling

Command line must start with CUSTOM (that is CUSTOM followed by a space). The rest of the command line is passed to the function CUSTOM_COMMAND() in LOADINIT.BSF with the custom command line in the first work string. Note this is called after the LOADINIT function in the script, and after the main menu has come up (and in theory after any server messages etc). Added partly as a first part for AGEOD integration, and also could be hooked up to the player-driven campaign game app from the forums. [I am sure there will be some foibles trying to kick off battles from the main menu, but this provides a starting point.] Note: the max length of the command line is 768 characters (not including the CUSTOM<space> header).

Multiplayer UI Callbacks

There are a number of callbacks for MP UI use

FUNCTION MULTIPLAYER_USERDATA_CALLBACK( [skirmish] )
{
	// this should fill the work array with up to 16 values
	// generally this would be driven by custom UI
	// these values are then available in the working array immediately after the battle loads
}

FUNCTION MULTIPLAYER_USERDATA_TOOLTIP_CALLBACK( [skirmish])
{
	// this is called with the user data in the work array, and should fill the UI string with the appropriate tooltip
	// only adds a tooltip if it returns != 0
	return 1 ;
}

FUNCTION MULTIPLAYER_USERDATA_ACCEPT_CALLBACK( [skirmish, side] )
{
	// this is called with the user data in the work array
	// if returns 0 then no side string is shown in the accept list
	// if returns !=0 then appends the contents of the first UI string to the list entry
	return 0 ;
}

FUNCTION MULTIPLAYER_PROT_ACCEPT_CALLBACK( [skirmish, side, prot] )
{
	// this is called with the user data in the work array
	// the prot value is the bitfield passed from the challenge.  Note that the top bit is always set and should be ignored.
	// it should return the prot value based on the sides etc
	// this allows correct disabling of games that the user cannot play based on their DLC ownership
	// NOTE: if a game is accepted without the DLC being available it will still fail on battle start
}

FUNCTION SKIRMISH_COMMENT_CALLBACK()
{
	// Allows for additional text to be added to skirmish descriptions in the MP creation screen.
	// Place any string to be added in the first UI string
}

FUNCTION LOAD_USERDATA_CALLBACK( [skirmish] )
{
	// Called immediately after loading the userdata when a game is loaded
	// skirmish param is zero or one.  Userdata is in the first work array.
}

WriteScenarioFile

This function can allow a scenario file to be created from the combination of a header string and the contents of a file. The command looks for the file in <campaign>/DATA/SCRIPTS and then DATA/SCRIPTS. It then creates a new .BSF file named for the scenario which is made up of the header followed by the contents of the template file.

The calling script must handle overwrite confirms etc (if needed).

//create a scenario file for the current editor scenario. The file is the headerSource followed by the contents of the templateFilename file. If overwrite !=0 then will overwrite any existing file, otherwise not. Returns -1 (failed), 0 (exists), 1 success. See wiki for more details.
WriteScenarioFile(templateFilename, headerSource, overwrite)

The header can include (e.g.) globals or defines which are then referenced in the template script.

Editor Font Customisation

You can now set up aliases for the fonts used in various modes for the main list (ScenEdTileList). Aliases must be in the global chunk (at the top) of the font file. They are of the form:

ALIAS <name>=<actualFont>

So an example (for the tile list in the editor) would be:

ALIAS SmoothFont_EdTileSet=MyEdTileFont

Note you will get an error if the aliased font does not exist. The currently defined aliases are

SmoothFont_EdTileSet
SmallFont_EdObjSet
Default_EdUnitSet
Default_EdBonusSet
Default_EdCarrySet

If no alias is defined, then the base (pre-underscore) name will be used for the font (e.g. SmoothFont for SmoothFont_EdTileSet).

Load/Save and Options Layout

If you include a screen whose root is called SystemMenu, then the default load/save etc functionality will be disabled somewhat. ESC will open this SystemMenu, or close either the LoadSave, Options, or SystemMenu screen (whichever is at the top level). This allows for finer control of the layout and use of the loadsave screens.

Note, you can open a correctly set up loadsave or options screen by using custom command values 0 or 1 respectively. E.g.

COMMAND CUSTOM 1 attached to a button will open the options screen.

Unit Orientation

If you include a TerrainFollow attrib in the squads file, then for units with this attrib as non-zero they will align themselves with the terrain (i.e. hills etc)

Formation Change

All units now call the formation callback, not just those with more than 1 man remaining.

Editor Unit Loading

Set the tweak EditorDefaultLoading to zero to require the CTRL key to load units onto other units. For editor ease of use for games where units cannot carry other units.

Editor Unit Values

You can now set up to 4 user values on units in the editor. These are stored in 4 attribs called System_EditorData0 to System_EditorData3. Users should set them onto the units in the editor in the usual way using SetAttrib. To facilitate editor functionality the new script command GetEditorLastUnit() is available.

Editor Display Callback

FUNCTION HELPER_UNIT_EDITOR_DISPLAY(side, unit)

This new function in the helper script is called for each unit on the map in the editor. If it returns non-zero then the system will include the contents of the first UI string in the information that is shown over the unit (e.g. Fixed, Carryover, etc).