> ## Documentation Index
> Fetch the complete documentation index at: https://lua.starline.one/llms.txt
> Use this file to discover all available pages before exploring further.

# Cheat

> Use general Starline utilities for screen state, pattern scanning, interfaces, schema offsets, clipboard access, and logging.

Utility functions.

## GetScreenSize

```lua theme={"dark"}
local w, h = cheat.GetScreenSize()
```

Returns two numbers, the game's resolution.

## GetCursorPos

```lua theme={"dark"}
local x, y = cheat.GetCursorPos()
```

Returns two numbers, in the same screen pixels the renderer draws in. Only moves while the menu is open; in game the cursor is locked.

## GetDpiScale

```lua theme={"dark"}
local scale = cheat.GetDpiScale()
renderer.Text(font, "hi", 20, 20, Color(255, 255, 255), 14 * scale)
```

Returns the user's menu scale. Renderer sizes are raw pixels, so multiply them by this value when matching the menu scale.

## IsInGame

```lua theme={"dark"}
if cheat.IsInGame() then ... end
```

## IsMenuOpen

```lua theme={"dark"}
if cheat.IsMenuOpen() then ... end
```

## GetMapName

```lua theme={"dark"}
local map = cheat.GetMapName()
```

Returns the short map name (`de_dust2`), or `nil` when not in a game.

## FindPattern

```lua theme={"dark"}
local addr = cheat.FindPattern('client.dll', '48 8B 05 ? ? ? ? 48 85 C0 74 ?')
```

`?` is a wildcard byte. Returns the address as a number, or `nil` if not found.

## FindExport

```lua theme={"dark"}
local addr = cheat.FindExport('kernel32.dll', 'VirtualAlloc')
```

Returns the address as a number, or `nil` if the module or export is missing.

## GetModule

```lua theme={"dark"}
local base = cheat.GetModule('client.dll')
```

Returns the module's base address as a number, or `nil` if it is not loaded.

## Interface

```lua theme={"dark"}
local addr = cheat.Interface("engine2.dll::Source2EngineToClient001")
local addr = cheat.Interface("engine2.dll", "Source2EngineToClient001")
```

Accepts either `"module::name"` or separate module and name strings. Returns the interface address, or `nil` if it is unavailable.

The name is prefix-matched, so a versionless `"Source2EngineToClient00"` still resolves.

## SchemaOffset

```lua theme={"dark"}
local off = cheat.SchemaOffset("C_BaseEntity->m_iHealth")
```

| Name  | Type                            |
| ----- | ------------------------------- |
| Field | String, `ClassName->field_name` |

Returns a schema field's runtime offset, or `nil` if unresolved.

## FNV1A

```lua theme={"dark"}
local h = cheat.FNV1A("some_key")
```

32-bit FNV1A hash of the string.

## Murmur2

```lua theme={"dark"}
local tok = cheat.Murmur2("bombPlanted")
local h   = cheat.Murmur2("bombPlanted", 0xDEADBEEF)
```

Returns a 32-bit MurmurHash2. The optional seed defaults to `0x31415926`.

## GetClipboard

```lua theme={"dark"}
local text = cheat.GetClipboard()
```

Returns clipboard text, or `nil` if none is available.

## SetClipboard

```lua theme={"dark"}
cheat.SetClipboard("hi")
```

## GetUsername

```lua theme={"dark"}
local who = cheat.GetUsername()
```

The user's forum username.

## Log output

```lua theme={"dark"}
cheat.LogChat("script loaded")
cheat.LogScreen("config applied")
```

`LogChat` writes to chat. `LogScreen` shows an on-screen log.

<Info>
  Addresses from this page are plain numbers. Wrap one with [`entity.Cast`](/entity#cast) for typed access.
</Info>
