Two new commands allow for adjusting the gamma values when in fullscreen. To allow for saving of the gamma value (or others) there are 3 additional Custom* options values available. Custom1, Custom2, Custom3. All default to zero. Suggested values for gamma would be 0.5 to 2.0 or so, depending on the variation you wish to allow.
//set the gamma value, if possible. gamma is in 1000ths. SetGamma(gamma) //returns 1 if the current setup allows for gamma adjustment (e.g. driver support, or because gamma requires fullscreen). AllowsGamma()
Get/SetUnitString Script Commands
Tile. New commands to allow a custom unicode string to be attached to a unit.
//place the contents of the first UI string as a custom string for the unit. SetUnitString(me)
//place the contents of the unit custom string into the first UI string. Returns 0 if there is no custom string, 1 otherwise GetUnitString(me)
User Content Debugging
Tile. When in DEBUGMODE is set to 2, the system will additionally load list_debug.txt into the user content list from the server. This is to allow for simpler testing of user content from the server without polluting the release list.
GetSkirmishPoints & GetCurrentMod
Tile. New script commands to fetch the currently set skirmish points, and to query the current mod.
//sets the first 4 values in the first work array with the current skirmish points values (fixed0, fixed1, select0, select1) GetSkirmishPoints() //if a mod is selected, place the name of the current mod into the first UI string and return its index, otherwise return -1. Always returns -1 in multiplayer. GetCurrentMod()
Tile. Mods can now override S4F and their animation files for units. They can also override scripts for AI, unit, HELPERS, and CORE BSF files.
Lobby Colouring Tweak
Tile. You can now use the VALUE5 entry for the accept games list to define the RGB value for disabled games (where you do not have the necessary campaign etc). Alpha is set to 0xFF by the game. Zero uses the default colouring.
Tile. You can have up to 8 read-only strings attached to a squad template. These must be defined in the squads file using tags ##0 to ##7. The string data for each element must have 27 characters or less, and spaces are not permitted. You can then retrieve these using the new command
//place the given attrib string into the first work string. typeIndex is the index of the unit type. index is currently [0,7]. GetAttribString(typeIndex, index)
Note that the string returned will have been converted into upper case.
UpdateUserStringFromUI and GetUIEditboxToInt Script Commands
//take the UI string from an editbox object and update it if it has changed (or is new). Return 1 if a change has been made, zero otherwise. UpdateUserStringFromUI(objectName, tag) //takes the contents of the UI editbox and converts them to a string. If there are any non-numeric characters in the string, then the return value is invalidValue. Skips leading and trailing whitespace. GetUIEditboxToInt(objectName, invalidValue)
Review Battlefield After Battle
Tile. You can now set up the UI to allow the user to review the battlefield after a battle ends. To do this you should:
- Add a button the the EndBattle control called EndBattleReview
- Create a new UI screen to allow the user to exit after they have finished reviewing. This screen should be called EndReview, and should include a button named EndReviewOK. EndReview should not be modal, but should have the same HANDLER as EndBattle (DeployHandler).
This should allow the player to review the battlefield, with all units shown.
New script command which moves the viewable area (if needed) to show the given item.
//move the UI listbox to show the given item index. Scrolls unless immediate is non-zero, in which case it instantly changes the view ShowUIListboxItem(objectName, index, [immediate])
GetString Control Change
If the UI object GetStringTitle exists, then the title text for the system GetString control will be placed there, rather than in the title of the GetString object window as per default.
Tile. Unit script function that is called each time a unit is moved by dragging when in deployment.
FUNCTION DEPLOY_DRAG_CALLBACK(me, tilex, tiley)
Multiline for UI Edit Controls
Adding a CHATMODE tag to edit controls will now allow them to contain more than one line.
Further INCLUDE Functionality for UI Files
You can now use a prefix to rename included UI file components, allowing reuse of UI fragments. See here:UI
User Music Control
Tile. You can alter the music that is playing using the new script command
//switch to the denoted music track. Must be [0,5] currently as per the MUSIC.TXT file order. SwitchMusic(track)
Can be combined with the new tweak DisableDefaultMusic, which stops all hardcoded changes of music (NOTE: other than the initial playing of the main menu music, and some other changes back to the main menu music when internal code takes the UI back to the main menu).
It is also worth reminding of the existence of the SetMusicFile command
//set a music file to be loaded and used. Looks in local then core files. A ? as filename means leave the existing music entry. SetMusicFile(filename)
New Script Commands: GetMapStyle & DeleteUserCampaign
//place the current map style string into the first work string. GetMapStyle() //delete a user campaign. The filename is expected to include the CAMPAIGNS or MULTIPLAYER path element depending upon where the campaign is. E.g. MULTIPLAYER/MYCAMPAIGN. NOTE: it is good practice to prompt the user to confirm deletion. DeleteUserCampaign(filename)
Including Templates in UI Files
You can now include other files in UI files. Note this should be used with care as objects with the same names are still prohibited. All includes must be the first thing in the UI file. Lines must be of the form
The template files must be in DATA/UI/TEMPLATES
AreNewDownloads Script Command
//returns 1 if there are new user content downloads available, 0 otherwise AreNewDownloads()
Button Text Colour Updates
You can now define different colours for buttons to use when they are being actioned. These colours can be set globally in the UIDEFAULTS.TXT file using
BUTTONOVERCOLOUR <hex> BUTTONDOWNCOLOUR <hex> BUTTONDISABLEDCOLOUR <hex>
You can also over-ride these values on a per-button basis in the UI text file using
OVERCOLOUR <hex> DOWNCOLOUR <hex> DISABLEDCOLOUR <hex>
Tile. There is now a callback when the editor starts. This can be located in either or both the CORE.BSF and scenario scripts. The function is of the same form as PRESTARTBATTLE: