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>| Flag | True when the browser has |
|---|---|
| chrome | Its Chrome version, a number (0 if unknown) |
| has | :has() |
| colorMix / relativeColor | color-mix() / rgb(from var(--x) r g b / 50%) |
| textBalance | text-wrap: balance and pretty |
| startingStyle | @starting-style, transition-behavior: allow-discrete |
| heightAuto | interpolate-size: allow-keywords |
| anchor | CSS anchor positioning |
| fieldSizing | field-sizing: content |
| viewTransitions | document.startViewTransition |
| schedulerYield | scheduler.yield() |
| webgpu | navigator.gpu (the GPU may still be unusable) |
| zoomScreenPx | getBoundingClientRect in screen pixels inside a CSS zoom (103 returned them unzoomed); measured |
| gameView | FiveM'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); }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.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).
table|false caps, string|nil err: false, 'not_detected_yet' before the page reportslocal 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.
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.
| Param | Type | Description |
|---|---|---|
| opts.text | boolean? | false: no words |
| opts.controls | boolean? | false: no controls |
| opts.under | string? | Only controls under this heading |
| opts.pages | boolean? | false: not other resources' pages |
{ view, focus, text, controls, pages }|false, whyPresses 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.
| Param | Type | Description |
|---|---|---|
| opts.button | string? | 'left' (default), 'right', 'double' |
| opts.text | string? | Type this into the field |
| opts.enter | boolean? | With text: then Enter |
| opts.choose | string? | Pick this list choice |
{ pressed, kind, chose, typed, covered }, { ambiguous } or false, whyexports.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.
This player's game picture. Waits up to 15 s.
| Param | Type | Description |
|---|---|---|
| opts.format | string? | 'jpg' (default), 'png', 'webp' |
| opts.quality | number? | 0 to 1 (0.92) |
| opts.width, opts.height | number? | Default the screen's; one alone keeps its shape |
| opts.ui | boolean? | Draw WHIP's interface over it |
| opts.frames, opts.every | number? | A burst of 2-24 frames every 33-1000 ms in one grid, 640 wide each; no ui |
| opts.upload | table? | { url, field }: post it to a helper on this PC instead |
dataUrl|false, why (with upload, the answer's text)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.
dataUrl|false, whyErrors, frame rate and reviving
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.
{ 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 })
Frame timing over the next seconds (1-30, default 5); waits that long. Compare standing still in one place.
{ seconds, frames, fps, fpsWorst1, medianMs, worstMs, over33, over50 }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).
true, or false, 'Player not loaded' | 'not down'