Skip to content

rq.ids ​

since 1.15.0 changed 1.16.0 changed 2.4.0 changed 2.24.0

The game's numbers by name: characters, items, monsters, quests, skills, and the small lists the game names (classes, states, races, character types, elements, item kinds, skill targets).

Each kind is a table of constants, so rq.ids.skill.FORTUNE_448 is 448 and rq.ids.item.SKILL_AGAIN is 306. Editors complete them from lua/rq_ids.lua, with each entry's number and in-game name. A key is the English name in upper snake case. A name the game gives to more than one number gets the number as a suffix on each of them (FORTUNE_158, FORTUNE_448), and a key that would start with a digit starts with N_ (N_10_TON_HAMMER). Some repeated names also have a key without the number, beside the numbered keys: the plain key for the one players know (FORTUNE is 448, RICK_ADDISON is 93), or a key of its own for another version (CAPTURE_EX, USE_IBEPROFUN_EX, STAMINA_BOOST_1). The docs' data tables list every entry and mark those keys.

The tables hold the base game only, not what mods define; use a mod's text id for those. Reading a key that does not exist raises an error, so a typo stops the mod at once instead of passing nil along; use rq.ids.find for a name that may not be there. Nothing in rq.ids can be changed. It works at the top level of init.lua.

KindNumbers
characharacter numbers (no), not roster slots
chara_typecharacter type values (タイプ), as in rq.chara.get(iic).type: HUMANOID is 22
classclass numbers, as in rq.chara.get(iic).class
elementelements (属性): NOTHING, LIGHT, DARKNESS, ELECTRIC, ICE, FIRE
itemitem numbers, not instances
item_kinditem kinds (種類詳細), as in an item's subtype: SWORD, SHORTSWORD, SPEAR, CLOTHING, ...
map_kindmap kinds (◆MAP基礎型), as in rq.dungeon.on_area's ctx.kind: CAVE, FOREST, CASTLE, MALGRID, ... The game names none; the names are the docs'
monstermonster numbers, as rq.battle.start takes them and rq.battle.snap gives them: COCKROACH is 358
musicmusic track numbers, as rq.music takes them: INDOOR_CRAWL_R8 is 1, BATTLE_2_R8 52
questquest numbers
raceraces (種族), as in rq.chara.get(iic).race: HUMAN, HANNY, ...
skillskill numbers
statestatus values (状態変化): NONE, POISON, STUN, DOWNED
targetskill target codes (対象): MELEE, RANGED, ALL_ENEMIES, ROW, SELF, ALLY, ALL_ALLIES, RANDOM_TARGET
lua
local FORTUNE = rq.ids.skill.FORTUNE  -- 448, also FORTUNE_448
local iic = rq.chara.find(rq.ids.chara.KAORU_QUINCY)
if rq.item.number(ii) == rq.ids.item.POISON_MASK then ... end
if ctx.race == rq.ids.race.HANNY then return nil, 50 end
local no = rq.ids.find("skill", "Spear Knowledge")  -- from a config file or a player

Properties ​

NameTypeDescription
chararq.IdsCharaCharacters by name; each key is in the docs' Characters table (Game data).
chara_typerq.IdsCharaTypeCharacter types by name; each key is in the docs' Character types table (Game data). Since 1.16.0.
classrq.IdsClassClasses by name; each key is in the docs' Classes table (Game data).
elementrq.IdsElementElements by name; each key is in the docs' Elements table (Game data). Since 1.16.0.
itemrq.IdsItemItems by name; each key is in the docs' Items table (Game data).
item_kindrq.IdsItemKindItem kinds by name; each key is in the docs' Item kinds table (Game data). Since 1.16.0.
map_kindrq.IdsMapKindMap kinds by name; each key is in the docs' Map kinds table (Game data). Since 2.24.0.
monsterrq.IdsMonsterMonsters by name; each key is in the docs' Monsters table (Game data). Since 1.16.0.
musicrq.IdsMusicMusic tracks by name; each key is in the docs' Music table (Game data). Since 2.4.0.
party_staterq.IdsPartyStateWhere a character is (登録状態) by name: NONE, PARTY, RESERVE, USED, SECOND; each key is in the docs' Party states table (Game data). Since 2.35.0.
questrq.IdsQuestQuests by name; each key is in the docs' Quests table (Game data).
racerq.IdsRaceRaces by name; each key is in the docs' Races table (Game data). Since 1.16.0.
skillrq.IdsSkillSkills by name; each key is in the docs' Skills table (Game data).
staterq.IdsStateStatus changes (状態変化) by name: NONE, POISON, STUN, DOWNED; each key is in the docs' States table (Game data).
targetrq.IdsTargetSkill targets by name; each key is in the docs' Skill targets table (Game data). Since 1.16.0.

Functions ​

NameSummary
rq.ids.findReturns the number of the thing with this name.
rq.ids.find_allReturns the numbers of every entry whose name contains a text.
rq.ids.nameReturns the in-game name of a number.

rq.ids.find ​

lua
rq.ids.find(kind, name) -> integer|nil, string?

since 1.15.0 changed 1.16.0 changed 2.4.0 changed 2.24.0

Returns the number of the thing with this name.

The name is compared without case, spaces or punctuation, and é matches e, so "spear knowledge" finds Spear Knowledge. A key works too ("FORTUNE_448", "CAPTURE_EX"). When the game uses the name for more than one number, the number of its plain key is returned ("Fortune" gives 448); a repeated name with no plain key returns nothing, and the message lists the numbers. rq.ids.find_all gives them all.

Raises an error for an unknown kind or a name that is not a string.

lua
local no, err = rq.ids.find("item", cfg.item)
if not no then rq.log(err) end  -- such as: more than one skill is named "Attack": 155, 386, ...
ParameterTypeDescription
kind"chara"|"chara_type"|"class"|"element"|"item"|"item_kind"|"map_kind"|"monster"|"music"|"quest"|"race"|"skill"|"state"|"target"The kind.
namestringThe in-game English name, or a key.
ReturnsTypeDescription
nointeger|nilThe number, or nil when no entry or more than one has that name.
errstring?Why there is no number.

Changed in 1.16.0: Takes the kinds chara_type, element, item_kind, monster, race and target. A repeated name with a plain key gives that key's number.

Changed in 2.4.0: Takes the kind music.

Changed in 2.24.0: Takes the kind map_kind.

See also: rq.ids.find_all

rq.ids.find_all ​

lua
rq.ids.find_all(kind, text) -> integer[]

since 1.15.0 changed 1.16.0 changed 2.4.0 changed 2.24.0

Returns the numbers of every entry whose name contains a text.

The text is compared as in rq.ids.find. An empty text gives every number of the kind.

Raises an error for an unknown kind or a text that is not a string.

lua
rq.ids.find_all("skill", "fortune")  -- {158, 159, 160, 293, 448, 585}: Fortune, Improve Fortune,
                                     -- 7 Misfortunes, 8 Pains
ParameterTypeDescription
kind"chara"|"chara_type"|"class"|"element"|"item"|"item_kind"|"map_kind"|"monster"|"music"|"quest"|"race"|"skill"|"state"|"target"The kind.
textstringWhat the name must contain.
ReturnsTypeDescription
numbersinteger[]The numbers, smallest first; empty when none.

Changed in 1.16.0: Takes the kinds chara_type, element, item_kind, monster, race and target.

Changed in 2.4.0: Takes the kind music.

Changed in 2.24.0: Takes the kind map_kind.

See also: rq.ids.find

rq.ids.name ​

lua
rq.ids.name(kind, no) -> string|nil

since 1.15.0 changed 1.16.0 changed 2.4.0 changed 2.24.0

Returns the in-game name of a number.

It is the base game's English name, as rq.skill.get and the like give it. Some names keep the game's own code for é (Tomato Pur・e).

Raises an error for an unknown kind.

lua
rq.log("used " .. (rq.ids.name("skill", ctx.skill) or "a mod skill"))
ParameterTypeDescription
kind"chara"|"chara_type"|"class"|"element"|"item"|"item_kind"|"map_kind"|"monster"|"music"|"quest"|"race"|"skill"|"state"|"target"The kind.
nointegerThe number.
ReturnsTypeDescription
namestring|nilThe name, or nil when the base game has none for that number.

Changed in 1.16.0: Takes the kinds chara_type, element, item_kind, monster, race and target.

Changed in 2.4.0: Takes the kind music.

Changed in 2.24.0: Takes the kind map_kind.