phigros.tools

Playing

Chart

A song's chart as it starts.

FieldType
idstring
namestring
difficultyDifficulty
levelstring"15"
composerstring
charterstring
illustratorstring
mirrorboolean
notesinteger

Hit

A judged note.

FieldType
judgementJudgement
offsetnumber?in ms, nil for a miss
combointeger
note"tap"|"drag"|"hold"|"flick"
xnumber?screen pixels, nil while a replay is sought
ynumber?

Stats

The play so far.

FieldType
scoreinteger
accuracynumberover the notes judged so far
combointeger
maxcombointeger
fcboolean
apboolean
perfectinteger
goodinteger
badinteger
missinteger
earlyinteger
lateinteger

Touch

FieldType
idinteger
phaseinteger
xnumberscreen pixels
ynumber

playing()

The chart being played, or nil.

local chart = playing()
if chart then print(chart.name, chart.difficulty, chart.level) end --> Glaciaxion	IN	12

Returns Chart?

stats()

The play so far, nil outside of a song.

on("hit", function()
  local s = stats()
  print(s.combo, s.score, ("%.2f"):format(s.accuracy)) --> 412	874120	99.31
end)

Returns Stats?

touches()

This frame's fingers, replayed ones while watching (none while paused).

on("update", function()
  for _, touch in ipairs(touches()) do print(touch.id, touch.x, touch.y) end --> 0	1520	860
end)

Returns Touch[]

replaying()

True while a replay plays.

on("hit", function(hit)
  if replaying() then return end -- only the player's own plays
  count(hit)
end)

Returns boolean

phigrospp.jump(t, to?, from?)

Puts the song being played t seconds into its chart, with its music: going forward the game misses the notes jumped over, going back the notes from there on come back unjudged, the score stays as it is. The one way to steer a song, a replay makes the same jumps. Given to, leaves only the notes from t to to on the field, whichever way it goes and with none missed: a section to practise. Given from, the music starts there: a lead-in before the notes.

phigrospp.jump(42.5)
phigrospp.jump(42.5, 60)
phigrospp.jump(40.5, 60, 42.5)
ParameterType
tnumber
to?number
from?number

phigrospp.restart()

Puts the song being played back at its start in place, every note unjudged and nothing scored, the music waiting like a fresh start.

button("Restart", phigrospp.restart)
on("restart", function() print("again") end)

phigrospp.pausing(allowed?)

Given false, the song being played can't be paused from its button nor started again until it's left, for a play others wait on. Returns whether it can.

on("song", function() phigrospp.pausing(false) end)
print(phigrospp.pausing()) --> false
ParameterType
allowed?boolean

Returns boolean

phigrospp.speed(x?)

How fast the song being played runs until it's left: its music, whose pitch follows, and its notes. Returns it.

phigrospp.speed(0.75)
print(phigrospp.speed()) --> 0.75
ParameterType
x?number

Returns number

phigrospp.pauseButton(x, y)

Whether a point of the screen (pixels) is on the pause button.

for _, touch in ipairs(touches()) do
  if phigrospp.pauseButton(touch.x, touch.y) then print("on pause") end
end
ParameterType
xnumber
ynumber

Returns boolean

phigrospp.counts(value?)

Whether the song being played counts, false for a replay. A play with modifiers counts: it's recorded, and saves nothing either. Given false, it doesn't: not recorded, its result shows without saving.

on("song", function() phigrospp.counts(false) end) -- a practice play saves nothing
print(phigrospp.counts()) --> false
ParameterType
value?false

Returns boolean

Modifier

FieldType
idstring"HR"
bitinteger
namestring
percentnumber
colourColour
iconstringits picture, an svg's paths: <path d="M9 7 4 12l5 5..."/>

phigrospp.modifiers.play()

The modifiers of the song being played as their bits, 0 for none (Modifiers), and the seed Random shuffled its chart from.

local mods, seed = phigrospp.modifiers.play()
print(mods, seed) --> 16	83612

Returns integer (mods)

Returns integer (seed)

phigrospp.modifiers.pick(mask?)

The ones the player picked for the next song, sets them when given.

print(phigrospp.modifiers.pick()) --> 0
phigrospp.modifiers.pick(16 | 8) -- HR and HD for the next song
ParameterType
mask?integer

Returns integer

phigrospp.modifiers.list

Modifier[]

Every modifier.

phigrospp.modifiers.total(score, mods)

The score a play counts for with its modifiers.

print(phigrospp.modifiers.total(1000000, 16)) --> 1060000
ParameterType
scoreinteger
modsinteger

Returns integer

phigrospp.modifiers.fits(id, difficulty)

Whether a chart plays with modifiers: one with effects of its own doesn't.

print(phigrospp.modifiers.fits("Glaciaxion.SunsetRay.0", "IN")) --> true
ParameterType
idstring
difficultyDifficulty

Returns boolean

phigrospp.modifiers.strip(parent, mods, pos, width)

Their plates in a row under parent, each width wide.

phigrospp.modifiers.strip(row, 16 | 8, { 20, 30 }, 48)
ParameterType
parentUnity
modsinteger
posVector
widthnumber