> For the complete documentation index, see [llms.txt](https://docs.punkland.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.punkland.io/punkland-studio/script/client.md).

# Client Script

* The client script must exist in the project folder or in Scripts with a file name like Hello.lua to be read.

<table><thead><tr><th width="355">script</th><th>explanation</th></tr></thead><tbody><tr><td><strong>Client.width</strong></td><td>Gets the width of the screen.</td></tr><tr><td><strong>Client.height</strong></td><td>Gets the vertical size of the screen.</td></tr><tr><td><strong>Client.ShowAlert(text, callback)</strong></td><td>Displays a notification message.</td></tr><tr><td><strong>Client.ShowYesNoAlert(text, callback)</strong></td><td>Displays a Yes/No notification message.</td></tr><tr><td><strong>Client.ShowBuyItem(id, amount, callback)</strong></td><td>Displays a message to purchase a specific item.</td></tr><tr><td><strong>Client.Quit()</strong></td><td>Close the client.</td></tr><tr><td><strong>ScriptEventPublisher Client.GetTopic(topic)</strong></td><td>Register a specific topic to exchange messages with the server.</td></tr><tr><td><strong>Client.FireEvent(topic, args…)</strong></td><td>Sends a message to the server with a specific topic.</td></tr><tr><td><strong>Client.RunLater(callback, t)</strong></td><td>Executes a callback function after t seconds.</td></tr><tr><td><strong>Camera</strong></td><td>Object that controls the camera</td></tr><tr><td><strong>Point</strong></td><td>A class that contains x, y coordinates</td></tr><tr><td><strong>Rect</strong></td><td>A class that contains a rectangle with x, y, width, and height.</td></tr><tr><td><strong>Image</strong></td><td>A class that outputs images</td></tr><tr><td><strong>Text</strong></td><td>A class that prints text</td></tr><tr><td><strong>Slider</strong></td><td>A class that outputs a control controller.</td></tr><tr><td><strong>Button</strong></td><td>Class that outputs the button</td></tr><tr><td><strong>Panel</strong></td><td>A class that outputs a panel.</td></tr><tr><td><strong>ScrollPanel</strong></td><td>A class that outputs a scrolling panel.</td></tr><tr><td><strong>GridPanel</strong></td><td>A class that outputs panels arranged in a grid.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.punkland.io/punkland-studio/script/client.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
