Esc to clear, Enter to open the best match, click an export to open it in its page
Interactions & UI

Browser features and tools

FiveM's in-game browser is moving from Chromium 103 to 144. WHIP's detector tells your page and your Lua which features it has, so you can use the new way where it can. Below that: client tools for tests, from reading screens to screenshots and the error log.

In your page

Load the detector before your scripts. It sets window.WhipCaps and a caps-... class on <html> per feature (caps-anchor, caps-game-view...).

<script src="https://cfx-nui-whip_core/html/js/caps.js"></script>
FlagTrue when the browser has
chromeIts Chrome version, a number (0 if unknown)
has:has()
colorMix / relativeColorcolor-mix() / rgb(from var(--x) r g b / 50%)
textBalancetext-wrap: balance and pretty
startingStyle@starting-style, transition-behavior: allow-discrete
heightAutointerpolate-size: allow-keywords
anchorCSS anchor positioning
fieldSizingfield-sizing: content
viewTransitionsdocument.startViewTransition
schedulerYieldscheduler.yield()
webgpunavigator.gpu (the GPU may still be unusable)
zoomScreenPxgetBoundingClientRect in screen pixels inside a CSS zoom (103 returned them unzoomed); measured
gameViewFiveM's new game view (CfxGameViewRenderer, gl.CFX_BIND_GAME_VIEW), to draw or read the game's picture

@supports is safe for what 103 lacks entirely (text-wrap, anchor positioning, field-sizing, interpolate-size, @starting-style). Use the classes for :has(), zoomScreenPx and gameView. In script, WhipCaps.transition(fn) cross-fades where it can and WhipCaps.yieldToBrowser() lets a long job breathe; both fall back by themselves.

.caps-has .panel:has(.slot.selected) { border-color: var(--ui-accent); }
Trust the flags, not CSS.supports. FiveM's Chromium 103 has experimental features on, so @supports selector(:has(a)) is true there, and any test holding var() passes in every Chrome.
GetNuiCaps()CLIENT#

A copy of the flags, as whip_core's page reported them; whip_core:nui:capsDetected fires with them when it does. From a satellite, Whip.core:GetNuiCaps(). /nuicaps prints them in F8; /nuicaps gameview shows the game view live (solid blue: it didn't bind).

Returns: table|false caps, string|nil err: false, 'not_detected_yet' before the page reports
local caps = exports.whip_core:GetNuiCaps()
if caps and caps.gameView then print('the page can have the game picture') end

Reading and pressing screens

For tests, in developer mode only (else false, 'developer mode is off'). They reach whip_core's page and any page that loads https://cfx-nui-whip_core/html/js/page-tools.js in its <head>, which also sends its errors to GetErrorLog. A keyboard-only menu can be pressed if its rows carry data-probe-press and handle a click.

ReadScreen(opts?)CLIENTWAITS#

The words on screen in reading order, and every pressable control with its id, words, kind, near (heading above), row (its row's words), state and position.

ParamTypeDescription
opts.textboolean?false: no words
opts.controlsboolean?false: no controls
opts.understring?Only controls under this heading
opts.pagesboolean?false: not other resources' pages
Returns: { view, focus, text, controls, pages }|false, why
PressScreen(target, opts?)CLIENTWAITS#

Presses one control at its middle. target is an id from the last ReadScreen or its words (exact, then starts-with, then contains), narrowed by near, kind, index or page. Several matches press nothing. Read again after a press: ids change.

ParamTypeDescription
opts.buttonstring?'left' (default), 'right', 'double'
opts.textstring?Type this into the field
opts.enterboolean?With text: then Enter
opts.choosestring?Pick this list choice
Returns: { pressed, kind, chose, typed, covered }, { ambiguous } or false, why
exports.whip_core:PressScreen({ label = 'Change', near = 'Who can open it' })
exports.whip_core:PressScreen('Weather', { choose = 'Rain' })

Screenshots

These replace screenshot-basic, which halved the frame rate on GTA V Enhanced; they cost nothing until asked. A shot is the game alone, with what it draws (DUI screens, 3D prompts). ui = true adds whip_core's screens and HUD, not other resources' pages.

TakeScreenshot(opts?)CLIENTWAITS#

This player's game picture. Waits up to 15 s.

ParamTypeDescription
opts.formatstring?'jpg' (default), 'png', 'webp'
opts.qualitynumber?0 to 1 (0.92)
opts.width, opts.heightnumber?Default the screen's; one alone keeps its shape
opts.uiboolean?Draw WHIP's interface over it
opts.frames, opts.everynumber?A burst of 2-24 frames every 33-1000 ms in one grid, 640 wide each; no ui
opts.uploadtable?{ url, field }: post it to a helper on this PC instead
Returns: dataUrl|false, why (with upload, the answer's text)
RequestScreenshot(source, opts?)SERVERWAITS#

A player's picture, with TakeScreenshot's options but upload. Waits up to 30 s. A game can send a fake picture: for tools, not catching cheats.

Returns: dataUrl|false, why

Errors, frame rate and reviving

GetErrorLog(opts?)SERVERCLIENT#

The last 200 errors on this side: in threads, handlers, NUI callbacks, commands and statebag handlers of whip_core and every satellite (unless its fxmanifest says whip_error_tap 'no': the satellite helper), whip_core's own caught errors, red (^1) warnings, and on the client, pages with the page tools. Repeats are counted; an export's error goes to its caller instead.

Returns: { entries = { { seq, at, side, resource, kind, text, count } }, last, side }; kind: 'error', 'warning', 'page'
local before = exports.whip_core:GetErrorLog().last
-- ... do the thing being tested ...
local after = exports.whip_core:GetErrorLog({ since = before })
MeasureFrames(opts?)CLIENT#

Frame timing over the next seconds (1-30, default 5); waits that long. Compare standing still in one place.

Returns: { seconds, frames, fps, fpsWorst1, medianMs, worstMs, over33, over50 }
RevivePlayer(source, reason?)SERVER#

Revives a downed player where they lie, as /w Restore does: full health, no armour. reason is logged after revive: (default your resource's name).

Returns: true, or false, 'Player not loaded' | 'not down'