Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:BuyTradeSkill

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 · Crafting functions
Version: WAR 1.4.8

Asks the trainer the player is talking to for a trade skill, optionally giving up another one.

BuyTradeSkill(tradeSkill, skillToDiscard)

Arguments

tradeSkill
number – The trade skill to learn, as a GameData.TradeSkills value (1 = BUTCHERING … 6 = SALVAGING). The stock UI passes GameData.InteractData.trainerTradeSkill.
skillToDiscard
number – A trade skill the player gives up to make room, or 0 for none.

Returns

Nothing.

Details

  • Both values are sent as single bytes together with the id of the current interaction (the trainer the player is talking to).
  • The client does not check the values. Which skills conflict is worked out by the stock UI (EA_Window_InteractionTraining.GetConflictingTradeSkill), and the server decides whether the purchase is allowed.
  • 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 default/ea_interactionwindow/source/interactiontradeskills.lua:

function EA_Window_InteractionTraining.DiscardTradeSkillAndBuyAnother()
    BuyTradeSkill( GameData.InteractData.trainerTradeSkill, EA_Window_InteractionTraining.ConflictingSkill )
    PlayInteractSound("trainer_accept")
end

function EA_Window_InteractionTraining.BuyTradeSkill()
    BuyTradeSkill( GameData.InteractData.trainerTradeSkill, 0 )
    PlayInteractSound("trainer_accept")
end

See also