Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetStoreCategories

From RoR Wiki

UI Lua API · Interact functions
Version: WAR 1.4.8

Returns the names of the item categories of the merchant store the player has open.

categories = GetStoreCategories()

Arguments

None.

Returns

categories
table – Category names (wstring), keyed by category id plus 1. Empty if the store has no categories.

Details

  • The keys are the store's own category ids (0–255) plus 1. They are not necessarily consecutive, so use pairs rather than ipairs, as the stock UI does.
  • Pass a key to SwitchStoreCategories to show that category. The selectedCategory field of GetStoreData uses the same numbering.
  • If the Lua state is not available, the function returns nothing.

Errors

None.

Example

From default/ea_interactionwindow/source/interactionwindowstore.lua:

EA_Window_InteractionStore.storeCategories = GetStoreCategories()
if( next(EA_Window_InteractionStore.storeCategories) ~= nil )
then
    ComboBoxClearMenuItems( "EA_Window_InteractionStoreFilterCategoryBox" )

    local localCategoryId = 1;
    for index, catName in pairs( EA_Window_InteractionStore.storeCategories ) do
        EA_Window_InteractionStore.categoryIdMap[localCategoryId] = index
        ComboBoxAddMenuItem( "EA_Window_InteractionStoreFilterCategoryBox", catName )
        localCategoryId = localCategoryId + 1
    end
    ...

See also