API:TomeGetPlayerTitleData
From RoR Wiki
UI Lua API · Tome functions
Version: WAR 1.4.8
Returns the data of a player title: its display name, description and where it is unlocked.
titleData = TomeGetPlayerTitleData(titleId)
Arguments
- titleId
number– Title id, for exampleGameData.Player.activeTitleor anidfrom TomeGetPlayerTitlesTypeData.
Returns
- titleData
table– The title's data. Empty if the title is locked or the id is invalid.
| Key | Type | Meaning |
|---|---|---|
id |
number |
Title id. |
name |
wstring |
The title as displayed, with the player's name filled in. If no name is available, Title # followed by a number.
|
text |
wstring |
Description of the title. |
type |
number |
A number stored with the title. |
unlockInfo |
table |
Where the title is unlocked: section (number), entry (number), name (wstring), text (wstring). section and entry are 0 when there is no unlocking entry.
|
Details
- For a title the player has not unlocked, the returned table is empty. The stock UI checks
titleData.name ~= nil. - If the id is unknown, an error is logged and an empty table is returned.
Errors
These are written to the UI log; the call returns normally.
Error in function call 'TomeGetPlayerTitleData': %d is not a valid title id.
Example
From ea_tomeofknowledge/source/tomewindow_rewards.lua:
local titleId = GameData.Player.activeTitle
if( titleId ~= 0 ) then
local titleData = TomeGetPlayerTitleData( titleId )
if( titleData ) then
titleText = titleData.name
end
end
From ea_tomeofknowledge/source/tomewindow.lua:
local titleData = TomeGetPlayerTitleData( rewardData.rewardId )
if( titleData.name ~= nil ) then
name = titleData.name
end
