useSkillBase
useSkillBase is a hook that reads the level a player has earned in a skill —
what is left when a boost or a drain is taken away — and makes the component
follow it. useSkill is the level
they have right now.
useSkillBase(skill: SkillRef): IntReference
Section titled “Reference”useSkillBase(skill)
Section titled “useSkillBase(skill)” /** The same twenty-three again, unboosted. A total is counted from these. */ const baseAttack = useSkillBase(Skills.ATTACK); const baseStrength = useSkillBase(Skills.STRENGTH); const baseDefence = useSkillBase(Skills.DEFENCE);Parameters
Section titled “Parameters”skill: ASkills.*reference, named at the call — the same rule asuseSkill.
Returns
Section titled “Returns”The base level, as an Int.
Caveats
Section titled “Caveats”- The reference is named at the call (
TS2E123otherwise). Pass the level down, not the skill. - Read-only.
- Use the base level for a requirement. A boost should not unlock content; a drain should not lock it.
Showing boosted and base together
Section titled “Showing boosted and base together” <SkillTile icon={SkillIcons.get(Skills.STRENGTH)} level={strength} base={baseStrength} x={1} y={1 + TILE_H} /> <text x={44} y={16} w={15} h={12} text={`${base}`} font={Fonts.SMALL} align="center" shadow color={Colors.YELLOW} />Counting a total
Section titled “Counting a total” const total = baseAttack + baseStrength + baseDefence + baseRanged + basePrayer <text x={2} y={2} w={{ fill: 4 }} h={{ fill: 4 }} text={`Total level: ${total}`} font={Fonts.SMALL} align="center" valign="middle" shadow color={Colors.YELLOW} />Troubleshooting
Section titled “Troubleshooting”The number does not move when a boost is applied
Section titled “The number does not move when a boost is applied”If you wanted the boosted level, read
useSkill.