API:PregameSetFeature
From RoR Wiki
UI Lua API · Pregame functions
Version: WAR 1.4.8
Sets one appearance feature of the character being created on the character creation screen.
PregameSetFeature(featureType, featureValue)
Arguments
- featureType
number– Index of the feature, starting at 1. This is the index into the feature table thatCHARACTER_CREATE_FEATURES_UPDATEDdelivers.- featureValue
number– The value to use for that feature, one of the values listed in that feature's table. It is stored as a single byte (0–255).
Returns
Nothing.
Details
- The call only works in the pregame state while the character creation data is set up. At any other time it does nothing.
- The value is applied to the preview character, which is then redrawn with its new appearance.
- Afterwards the client fires
SystemData.Events.CHARACTER_CREATE_FEATURES_UPDATEDwith the updated feature table. The stock handler isCharacterSelectWindow.FeaturesUpdated(featuresData), which readsfeaturesData[featureType]as a list of allowed values pluscurValue, the current one. - The function needs at least two arguments and only reads the last two.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
Stepping to the next allowed value, from interfacecore/source/characterselectwindow.lua:
function CharacterSelectWindow.NextFeature()
local featureType = WindowGetId( WindowGetParent( SystemData.ActiveWindow.name ) )
local featureData = CharacterSelectWindow.featuresData[featureType]
local curValue = CharacterSelectWindow.FindFeatureCurrentValue( featureData )
local featureValue = featureData[curValue + 1]
if ( featureValue == nil )
then
featureValue = featureData[1]
end
PregameSetFeature( featureType, featureValue )
end
