API:BarbershopSetFeature
From RoR Wiki
UI Lua API · Appearance functions
Version: WAR 1.4.8
Changes one appearance feature of the barbershop preview.
BarbershopSetFeature(featureIndex, featureValue)
Arguments
- featureIndex
number– Index of the feature, starting at 1. This is the index into the feature table thatINTERACT_BARBERSHOP_FEATURE_UPDATEdelivers.- featureValue
number– The new value, one of the values listed in that feature's table.
Returns
Nothing.
Details
- The call only has an effect while the barbershop is open. Otherwise it does nothing.
- Only the preview changes. The change is sent to the server by BarbershopSubmitFeatures.
- After the change the client fires
SystemData.Events.INTERACT_BARBERSHOP_FEATURE_UPDATEwith the updated feature table. The stock handlerBarbershopWindow.UpdateCurrentFeatures(newFeaturesData)reads it as one list of allowed values per feature, 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
From ea_barbershopwindow/source/barbershopwindow.lua:
function BarbershopWindow.SelectFeature( curSel )
if ( curSel < 1 )
then
-- Bail if the selection was cleared
return
end
local featureType = WindowGetId( WindowGetParent( SystemData.ActiveWindow.name ) )
local featureData = featuresData[featureType]
local featureValue = featureData[curSel]
BarbershopSetFeature( featureType, featureValue )
end
