The Binding of Isaac: Rebirth

The Binding of Isaac: Rebirth

Not enough ratings
yaEID Documentation
By goki_dev
This guide is the documentation for yaEID's API. It explains the functionality and has code examples and accompanying screenshots to help you create your own external description expansion mods.
   
Award
Favorite
Favorited
Unfavorite
General Documentation
The yaEID API has 1 important class and 4 useful functions to create and register instances of that class.

DescriptionEntry( id, variant, description, image )

Number id is the relevant ID number of the collectible, trinket, card, or pill effect
Number variant is the PickupVariant value for the pickup being described
String description is the actual description text (\n new line character supported)
Boolean image is for utilizing images as descriptions (in the case of non-English like translations)

If image is true, description should instead describe the relative path of the image to be drawn.
To use the image "mod/resources/gfx/mushroom.png", the description should be "gfx/mushroom.png" and image should be set to true

The main function to register entries:

YAEID:RegisterDescriptions( * key, Table entries )

The four functions below are convenience functions to make registering descriptions a bit easier by passing the proper variant in as the key for you.

YAEID:RegisterCollectibles( Table entries ) YAEID:RegisterTrinkets( Table entries ) YAEID:RegisterCards( Table entries ) YAEID:RegisterPills( Table entries )

entries is a table of tables. The table listed in entries describe how to build a DescriptionEntry.

{ Number id, String description[, String languageCode] }

If languageCode is ignored, it defaults to the value of CONFIG.Language ("enUS" by default).
Image Descriptions
magic_mush.png is a file in the mod/resources

local MOD = RegisterMod( "YAEID: Example", 1 ) local function Register() YAEID:RegisterCollectibles({ {CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM,"magic_mush.png",nil,true} }) end YAEID_QUEUE = YAEID_QUEUE or {} YAEID_QUEUE["yatboim_example_en"] = Register if YAEID ~= nil then Register() end

Modded Item Descriptions
Simply take advantage of the API function in the Isaac namespace:

integer GetItemIdByName (string itemName) integer GetTrinketIdByName (string trinketName) integer GetCardIdByName (string cardName) integer GetPillEffectByName (string pillEffect)

local MOD = RegisterMod( "YAEID: Example", 1 ) local function Register() YAEID:RegisterCollectibles({ {Isaac.GetItemIdByName("Marshmallow"), "A familiar that changes based on the last Fire Place it touched.\n".. "Extinguished by enemy projectiles and explosions.\n".. YAEID.COLORS.Grey.."Normal: Deals contact damage and blocks bullets\n".. YAEID.COLORS.Orange.."Burning: Contact damage ignites enemies\n".. YAEID.COLORS.Red.."Red Fire: Shoots flaming tears\n".. YAEID.COLORS.LightBlue.."Blue Fire: Immune to projectiles\n".. YAEID.COLORS.Magenta.."Purple Fire: Shoots homing tears, immune to projectiles"} }) end YAEID_QUEUE = YAEID_QUEUE or {} YAEID_QUEUE["yatboim_example_en"] = Register if YAEID ~= nil then Register() end

Language Support
You can create multiple entries for the same item for separate languages in one mod. Simply register another entry.

The code below sets the language override to nil. Any registration that omits its own language code will use the default language as defined in the main.lua. This is "enUS" by default, but a user could change it.

Then, three descriptions are registered for the Magic Mushroom item, one for the default "enUS", one for Google Translated Spanish "spanishGT", and one last fun one "joke".

At the end, it sets the language override to "spanishGT". The override will persist until it is changed again, so assuming this is the only yaEID mode to override the language, the player will see descriptions in "spanishGT" if they exist, their default language if it doesn't, and if the default language has no descriptions, it will fallback to in-game descriptions.

local MOD = RegisterMod( "YAEID: Example", 1 ) local function Register() YAEID_LANGUAGE_OVERRIDE = nil YAEID:RegisterCollectibles({ {CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM,"A really good item, pick it up every time!"}, {CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM,"Un articulo realmente bueno. !Recojala cada vez!","spanishGT"}, {CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM,"I mean, it's a mushroom. You probably shouldn't eat it, but...","joke"} }) YAEID_LANGUAGE_OVERRIDE = "spanishGT" end YAEID_QUEUE = YAEID_QUEUE or {} YAEID_QUEUE["yatboim_example_en"] = Register if YAEID ~= nil then Register() end
Language Support (with Fonts)
First and foremost keep in mind that the API DOES NOT READ font files from mod folders. so to get this working you (any people who download the mod) must place the font files into the resources folder at Steam\SteamApps\common\The Binding of Isaac Rebirth\resources\font. If Nicalis ever fixes this, mods should not have to be updated.

There is support for hotswapping fonts in the middle of a description. First, register a font by path to get the font key:

local JAPANESE_FONT = YAEID:RegisterFont( "font/japanese/mplus_10r.fnt" )

Now, when you want to switch to the font that supports Japanese characters, just append JAPANESE_FONT to the string:

YAEID:RegisterCollectibles({ {CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM, JAPANESE_FONT.."マギクマシルム"} })

You may want to have a custom language only for a specific portion of the code, so using YAEID.FONT in a string will set the font back to the user's default:

local JAPANESE_FONT = YAEID:RegisterFont( "font/japanese/mplus_10r.fnt" ) local UNSET_FONT = YAEID.FONT YAEID:RegisterCollectibles({ {CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM, JAPANESE_FONT.."マギクマシルム"..UNSET_FONT.." ( Magic Mushroom )"} })

Lastly, you should always make sure to use a specific language override to ensure that you don't overwrite descriptions for the previous description packs language.

YAEID_LANGUAGE_OVERRIDE = "jp" -- Registration Code

Putting this all together, here's an example mod that uses the games default japanese font (mplus_10r.fnt) to add a simple Japanese translation to the Magic Mushroom item:

local MOD = RegisterMod( "YAEID: Japanese", 1 ) local function Register() YAEID_LANGUAGE_OVERRIDE = "jp" local JAPANESE_FONT = YAEID:RegisterFont( "font/japanese/mplus_10r.fnt" ) local UNSET_FONT = YAEID.FONT YAEID:RegisterCollectibles({ {CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM, JAPANESE_FONT.."マギクマシルム"..UNSET_FONT.." ( Magic Mushroom )"} }) end YAEID_QUEUE = YAEID_QUEUE or {} YAEID_QUEUE["yatboim_japanese"] = Register if YAEID ~= nil then Register() end


Keep in mind that this sets the user's language override to jp. If there aren't definitions for other items in that language, it will fall back to the default language, and then to the game's text.
Line Colours
If you use a particular character at the start of a line (the first character in the description or after any \n character) you can set the colour of that line.

YAEID.COLOR_CHAR is a convenience table with names for these characters.

YAEID.COLORS = { White = COLOR.."FFFFFFFF", ItemDescription = COLOR.."FFFFFFFF", Black = COLOR.."000000FF", Red = COLOR.."FF3333FF", Green = COLOR.."33AA33FF", Blue = COLOR.."3333FFFF", Magenta = COLOR.."FF33FFFF", Cyan = COLOR.."00DDDDFF", Yellow = COLOR.."FFFF00FF", DarkGrey = COLOR.."333333FF", Grey = COLOR.."666666FF", LightGrey = COLOR.."999999FF", LighterGrey = COLOR.."BBBBBBFF", ItemExtraInfo = COLOR.."BBBBBBBB", ItemBaseDescription = COLOR.."666666FF", LightRed = COLOR.."FF8888FF", LightGreen = COLOR.."88FF88FF", LightBlue = COLOR.."8888FFFF", ItemTransformation = COLOR.."9999FFFF", LightMagenta = COLOR.."FF99FFFF", PaleCyan = COLOR.."33FFFFFF", PaleYellow = COLOR.."FFFF99FF", ItemName = COLOR.."FFFF99FF", Orange = COLOR.."DDAA00FF", ItemTag = COLOR.."DDAA00FF", Pink = COLOR.."FFBBBBFF", }
local MOD = RegisterMod( "YAEID: Example", 1 ) local function Register() YAEID_LANGUAGE_OVERRIDE = nil YAEID:RegisterCollectibles({ {CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM, YAEID.COLORS.White .."White\n".. YAEID.COLORS.ItemDescription .."ItemDescription\n".. YAEID.COLORS.Black .."Black\n".. YAEID.COLORS.Red .."Red\n".. YAEID.COLORS.Green .."Green\n".. YAEID.COLORS.Blue .."Blue\n".. YAEID.COLORS.Magenta .."Magenta\n".. YAEID.COLORS.Cyan .."Cyan\n".. YAEID.COLORS.Yellow .."Yellow\n".. YAEID.COLORS.DarkGrey .."DarkGrey\n".. YAEID.COLORS.Grey .."Grey\n".. YAEID.COLORS.LightGrey .."LightGrey\n".. YAEID.COLORS.LighterGrey .."LighterGrey\n".. YAEID.COLORS.ItemExtraInfo .."ItemExtraInfo\n".. YAEID.COLORS.ItemBaseDescription .."ItemBaseDescription\n".. YAEID.COLORS.LightRed .."LightRed\n".. YAEID.COLORS.LightGreen .."LightGreen\n".. YAEID.COLORS.LightBlue .."LightBlue\n".. YAEID.COLORS.ItemTransformation .."ItemTransformation\n".. YAEID.COLORS.LightMagenta .."LightMagenta\n".. YAEID.COLORS.PaleCyan .."PaleCyan\n".. YAEID.COLORS.PaleYellow .."PaleYellow\n".. YAEID.COLORS.ItemName .."ItemName\n".. YAEID.COLORS.Orange .."Orange\n".. YAEID.COLORS.ItemTag .."ItemTag\n".. YAEID.COLORS.Pink .."Pink\n"} }) end YAEID_QUEUE = YAEID_QUEUE or {} YAEID_QUEUE["yatboim_example_en"] = Register if YAEID ~= nil then Register() end

6 Comments
AstroLight 26 May, 2018 @ 11:09pm 
Also thank you for showing how to really make registring multiple items system, now i don't need to CtrlCCtrlV "Register[TYPE]" and stuff!
AstroLight 26 May, 2018 @ 11:04pm 
No, I was talking about primitive tag, i knew how to create a tag-color text.
You actually shown me method of creating tags in Lost Card example lol
And I don't needed to create new tags, I just want to set old tags to modded items.
goki_dev  [author] 26 May, 2018 @ 10:54pm 
If you were talking about the orange tag text specifically, it is simply done manually. There is an option to enable tags in the code, but there isn't true support for adding more tags to items apart from their generic derived type and no way to add them to the default yaeid tag list.

Maybe i'll add support for that?
goki_dev  [author] 26 May, 2018 @ 10:52pm 
I'm not sure what you're asking, but adding descriptions for Cards is the same as other items. If you look at the main.lua of Lost Cards you can see easily how they get their card id's:

Isaac.GetCardIdByName("I - The Cold")

Just copy this logic to determine the card to register:

{ Isaac.GetCardIdByName("I - The Cold"),
CARD_TAG.."Apply Slow to all enemies in the room for 10 seconds upon activation"
}

Here's all the Lost Card descriptions in one complete example yaeid mod: https://hastebin.com/evujiqowef.lua
AstroLight 26 May, 2018 @ 10:08pm 
There's no tag creating description. No, I can do it by myself, but it's kinda weird.
Also, custom description for Lost Cards is not working, even when i done it perfectly by pattern.
Kid Flash 20 Dec, 2017 @ 8:09am 
Drop me a PM if you have time or would like to help someone trying to get this to work, it'd be greatly appreciated.