Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:BarbershopSetFeature

From RoR Wiki
Revision as of 19:40, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 that INTERACT_BARBERSHOP_FEATURE_UPDATE delivers.
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_UPDATE with the updated feature table. The stock handler BarbershopWindow.UpdateCurrentFeatures(newFeaturesData) reads it as one list of allowed values per feature, plus curValue, 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

See also