Skip to content

Wife3 Scoring System.hx

AutisticLulu edited this page Oct 16, 2025 · 8 revisions

Wife3 Scoring Script for Psych Engine

HScript-based scoring system that implements Etterna's Wife3 accuracy calculation.

Can run alongside or replace Psych Engine's default scoring system.

Wife3 Scoring System - API Reference

Wife3 (Wife version 3) is Etterna's timing-based accuracy algorithm. This script provides 22 global callback functions accessible from any Lua or HScript.


📖 Table of Contents


Configuration Functions

wife3_setEnabled(enabled: Bool)

Enable or disable Wife3 scoring system.

wife3_setEnabled(true)   -- Enable (default)
wife3_setEnabled(false)  -- Disable

wife3_setDisplayMode(mode: String)

Control how Wife3 displays scores.

Mode Description
'default' Replace Psych Engine's scoreTxt entirely
'separate' Show Wife3 below Psych's default score (recommended)
'custom' Calculate only, no display (use for custom UI)
wife3_setDisplayMode('separate')

wife3_setJudgePreset(judgeNum: Int)

Set difficulty preset (1-9). See Judge Presets for details.

wife3_setJudgePreset(4)  -- J4 = Standard difficulty
wife3_setJudgePreset(9)  -- J9 = JUSTICE (hardest)

wife3_setJudgeScale(scale: Float)

Manually set judge scale value (advanced users).

wife3_setJudgeScale(1.0)   -- Same as J4
wife3_setJudgeScale(0.4)   -- Same as J9

Note: Scale range is 0.009 to 0.090. Values outside this range are clamped.

wife3_setScoreZoom(zoom: Bool)

Enable/disable score "bop" animation on hits.

wife3_setScoreZoom(true)   -- Enable zoom animation (default)
wife3_setScoreZoom(false)  -- Disable animation

wife3_setShowTimingDisplay(show: Bool)

Show/hide timing feedback (Early/Late display).

wife3_setShowTimingDisplay(true)   -- Show timing (default)
wife3_setShowTimingDisplay(false)  -- Hide timing

wife3_setTimingDisplayDuration(duration: Float)

Set how long timing display stays visible (in seconds).

wife3_setTimingDisplayDuration(0.5)  -- 500ms (default)
wife3_setTimingDisplayDuration(1.0)  -- 1 second

wife3_resetAccuracy()

Reset all Wife3 counters to zero. Useful for practice mode or custom restart mechanics.

wife3_resetAccuracy()

Data Getter Functions

wife3_getPercent(): Float

Returns current accuracy percentage (0-100) based on notes hit so far.

local accuracy = wife3_getPercent()
-- Example: 98.45

wife3_getTotalPercent(): Float

Returns total chart accuracy percentage if all remaining notes are hit perfectly.

local totalAccuracy = wife3_getTotalPercent()
-- Example: 99.12

wife3_getScore(): Int

Returns current song score (Wife3 calculated).

local score = wife3_getScore()
-- Example: 987654

wife3_getGrade(): String

Returns current letter grade based on accuracy.

local grade = wife3_getGrade()
-- Returns: 'AAAAA', 'AAAA', 'AAA', 'AA', 'A', 'B', 'C', 'D', or 'F'

wife3_getFormattedString(): String

Returns the complete formatted display string (same as displayed on screen).

local displayText = wife3_getFormattedString()
-- Example: "Score: 987654 | Acc: 98.45% (AAA)"

Advanced Data Access

wife3_getCurrentAccuracy(): Float

Returns raw Wife3 points accumulated from notes hit.

local currentPoints = wife3_getCurrentAccuracy()
-- Example: 345.67

wife3_getMaxAccuracy(): Float

Returns maximum Wife3 points earned so far (current performance ceiling).

local maxPoints = wife3_getMaxAccuracy()
-- Example: 350.00

wife3_getTotalAccuracy(): Float

Returns total possible Wife3 points for the entire chart.

local totalPoints = wife3_getTotalAccuracy()
-- Example: 500.00

wife3_getSongScore(): Int

Direct access to song score (same as wife3_getScore()).

local score = wife3_getSongScore()

Utility Functions

wife3_calculateGrade(percent: Float): String

Calculate letter grade for any given percentage value.

local grade = wife3_calculateGrade(99.75)
-- Returns: 'AAAAA'

local grade = wife3_calculateGrade(95.5)
-- Returns: 'A'

wife3_formatPercent(value: Float): String

Format a number to 2 decimal places.

local formatted = wife3_formatPercent(98.456789)
-- Returns: '98.46'

Display Modes

Default Mode

Replaces Psych Engine's scoreTxt entirely with Wife3 display.

wife3_setDisplayMode('default')

Display Format:

Score: 987654 | Acc: 98.45% (AAA) | Combo: 234

Separate Mode (Recommended)

Shows Wife3 display below Psych's default score.

wife3_setDisplayMode('separate')

Display Format:

[Psych's default score line]
Score: 987654 | Acc: 98.45% (AAA)

Custom Mode

Calculates Wife3 but doesn't display anything. Use this for building custom UIs.

wife3_setDisplayMode('custom')

Judge Presets

Judge presets control the timing window difficulty. Lower numbers are easier (wider timing windows), higher numbers are harder (tighter timing windows).

Preset Judge Scale Value Description Typical Use Case
1 J1 4.0 Easiest Casual play, story mode
2 J2 3.0 Very Easy Beginner friendly
3 J3 2.0 Easy Learning new charts
4 J4 1.0 Standard Default/Competitive baseline
5 J5 0.9 Slightly Hard Intermediate challenge
6 J6 0.75 Hard Advanced players
7 J7 0.6 Very Hard Expert challenge
8 J8 0.5 Extremely Hard Mastery testing
9 J9 0.4 JUSTICE Hardest possible

Setting Judge Preset

wife3_setJudgePreset(4)  -- Standard (default)
wife3_setJudgePreset(9)  -- JUSTICE (hardest)

Manual Scale Setting

For fine-tuned control, use wife3_setJudgeScale():

wife3_setJudgeScale(1.0)   -- J4 equivalent
wife3_setJudgeScale(0.6)   -- J7 equivalent
wife3_setJudgeScale(0.85)  -- Custom (between J5 and J6)

Grading System

Wife3 uses Etterna's letter grade system based on accuracy percentage:

Grade Min % Description Tier
AAAAA 99.70% Quadstar Nearly perfect
AAAA 99.50% Quad Exceptional
AAA 99.00% Triple Excellent
AA 98.00% Double Very Good
A 96.50% Single Good
B 93.00% B Tier Above Average
C 90.00% C Tier Average
D 80.00% D Tier Below Average
F < 80.00% Failed Needs Improvement

Grade Calculation

Grades are calculated in real-time based on current accuracy:

local currentGrade = wife3_getGrade()
-- Returns current grade based on accuracy

local hypotheticalGrade = wife3_calculateGrade(97.5)
-- Calculate grade for any percentage

Script by AutisticLulu | Based on Etterna's Wife3 scoring algorithm

Clone this wiki locally