Ink vitals
Example apps / ink-vitals / v0.1.0
Node modIn the downloadneeds codeware
V's health and RAM as bars, and money, on the HUD in the game's own look. Every value is bound: the plugin reads it each frame, and the mod sends nothing after building it. Needs Codeware.
Press Hurt V below and watch the bar and the number follow, read four times a second here (every frame in the game).
// Ink vitals: health, RAM and money on the HUD, drawn by the game (the ink API, I2c).
// Every value is bound: the plugin reads it every frame and changes the screen only when it
// changes, so a hit shows at once. This mod builds the tree and sends nothing after that.
import { ink } from 'rednode';
// A label, a bar and its number, in one row.
const meter = (label, bind, of, tone, format) =>
ink.row(
{ gap: 14, align: 'center' },
ink.text(label, { style: 'small', tone: 'dim', width: 80, height: 40 }),
ink.bar({ bind, of, width: 320, height: 10, tone }),
ink.text('', { style: 'value', tone, bind, format }),
);
ink.mount(
'hud',
{ anchor: 'bottom-left', x: 80, y: -300 },
ink.column(
{ gap: 8 },
ink.text('Vitals', { style: 'label' }),
meter('HP', 'player.health', 'player.healthMax', 'normal', '{value}'),
meter('RAM', 'player.memory', 100, 'accent', '{value}%'),
ink.text('', { style: 'value', tone: 'highlight', bind: 'player.money', format: '{value} €$' }),
),
);
console.log('Ink vitals ready: the plugin reads every value; this mod sends nothing more');
REDnode runs JavaScript. The rednode package also has TypeScript types, so an editor checks these calls; compile TypeScript to .mjs first.
{
"id": "ink-vitals",
"name": "Ink vitals",
"version": "0.1.0",
"author": "Edgemodders",
"description": "V's health and RAM as bars, and money, on the HUD in the game's own look. Every value is bound: the plugin reads it every frame and the mod sends nothing after building it. The sample of phase I2c. Needs Codeware.",
"main": "mod.mjs",
"open": false,
"requires": {
"codeware": ">=1.16"
}
}
The manifest names the package and says how REDnode runs it. Its fields are in Overlay apps.
How it works
A text with bind: "player.health" shows a game value. The plugin reads it every frame and changes the text only when what it shows changes, so a hit shows at once with no update code in the mod.
ink.bar({ bind, of }) fills from its left edge, value / of full; of is a number or another source, such as "player.healthMax".
The sources: health and its max, stamina and RAM (0 to 100), money, level, street cred, V's position and the game's clock.
What it uses
bind format ink.bar of ink.row align
Try this
- Add stamina:
meter("STA", "player.stamina", 100, "success", "{value}%"). - Show the clock: two texts bound to
game.hourandgame.minute.
Use it
Copy the files into red4ext/plugins/REDnode/apps/ink-vitals/ in the game folder, or start your own package from them: change id and name in the manifest first. The whole folder is on GitHub.