Skip to content

API UO BookSetText en

Codex edited this page Sep 23, 2026 · 1 revision

UO.BookSetText

ClassicUO / Basic IDE

Home · API · Books

Writes text starting at page one of the open editable book.

Exact syntax

UO.BookSetText(Text:Any) -> Unit

Parameters

  • Text — Text: Chr(10) separates lines; Chr(13) is removed. At most 10 lines per page and 53 characters per line. NUL is rejected.

Returns

Unit: no returned value. This requests a write; it is neither TRUE/FALSE nor server confirmation. The server may refuse editing.

Behavior

  • First open the intended book through a game action. These commands select the most recently opened book; they do not accept its ID. With several books, check which one is current. Get reads loaded data and does not request a missing page.
  • The manager stores book content in the session, including without graphics. Closing and reopening the game view retains the book and draft. Closing the book itself removes it from open books; disconnecting clears server books.
  • Only editable books accept writes. Invalid pages and excessive text are rejected. BookSetText validates every page before sending any, so an invalid later page causes no partial write.
  • BookSetText uses Chr(12) for explicit page breaks, or groups every 10 lines into a page when there are no form feeds. Remaining old pages are unchanged; explicitly call BookClearText first for a complete replacement. Empty text replaces only page one.

Internal functions: from call to result

The server sends header/page count and then page content. SessionBooks validates each entire packet, retains data and updates its view. Basic selects the last book through the bridge; SessionBook reads local lines or validates a write and sends the book packet. ModernBookGump displays the same data and preserves drafts when graphics detach.

1. GetOpenBook

First open the intended book through a game action. These commands select the most recently opened book; they do not accept its ID. With several books, check which one is current. Get reads loaded data and does not request a missing page.

The manager stores book content in the session, including without graphics. Closing and reopening the game view retains the book and draft. Closing the book itself removes it from open books; disconnecting clears server books.

Project source: src/ClassicUO.Client/Game/Managers/ClassicUOInjectionApiBridge.cs; function GetOpenBook.

2. SessionBooks.ReceiveHeader/ReceivePages; SessionBook.Yoko*

Only editable books accept writes. Invalid pages and excessive text are rejected. BookSetText validates every page before sending any, so an invalid later page causes no partial write.

Unit: no returned value. This requests a write; it is neither TRUE/FALSE nor server confirmation. The server may refuse editing.

Project source: src/ClassicUO.Client/Game/Managers/SessionBooks.cs; function SessionBooks.ReceiveHeader/ReceivePages; SessionBook.Yoko*.

First open the intended book through a game action. These commands select the most recently opened book; they do not accept its ID. With several books, check which one is current. Get reads loaded data and does not request a missing page.

Examples

Direct use

# Direct use
#
# Writes text starting at page one of the open editable book.
#
# Unit: no returned value. This requests a write; it is neither TRUE/FALSE nor server
# confirmation. The server may refuse editing.

SUB Main()
    # All examples assume the intended book is open, required pages are loaded, and writes use an
    # editable book. Numbers 1, 2 and 3 are page numbers; verify those pages exist. Names and text
    # are illustrative.

    UO.BookSetText("Mining route" + Chr(10) + "Start at camp")
END SUB

Parameter and execution notes:

  • All examples assume the intended book is open, required pages are loaded, and writes use an editable book. Numbers 1, 2 and 3 are page numbers; verify those pages exist. Names and text are illustrative.

Practical scenario

# Practical scenario
#
# Writes text starting at page one of the open editable book.
#
# Unit: no returned value. This requests a write; it is neither TRUE/FALSE nor server
# confirmation. The server may refuse editing.

SUB Main()
    # All examples assume the intended book is open, required pages are loaded, and writes use an
    # editable book. Numbers 1, 2 and 3 are page numbers; verify those pages exist. Names and text
    # are illustrative.

    UO.BookSetText("Camp A" + Chr(12) + "Camp B" + Chr(12) + "Return home")
END SUB

Parameter and execution notes:

  • All examples assume the intended book is open, required pages are loaded, and writes use an editable book. Numbers 1, 2 and 3 are page numbers; verify those pages exist. Names and text are illustrative.

Complete helper function

# Complete helper function
#
# Writes text starting at page one of the open editable book.
#
# Unit: no returned value. This requests a write; it is neither TRUE/FALSE nor server
# confirmation. The server may refuse editing.

SUB Main()
    # All examples assume the intended book is open, required pages are loaded, and writes use an
    # editable book. Numbers 1, 2 and 3 are page numbers; verify those pages exist. Names and text
    # are illustrative.

    WriteRoute("Northern mine", "Bring bandages")
END SUB

SUB WriteRoute(destination, supplies)
    VAR firstPage = "Destination" + Chr(10) + destination
    VAR secondPage = "Supplies" + Chr(10) + supplies
    UO.BookSetText(firstPage + Chr(12) + secondPage)
END SUB

Parameter and execution notes:

  • All examples assume the intended book is open, required pages are loaded, and writes use an editable book. Numbers 1, 2 and 3 are page numbers; verify those pages exist. Names and text are illustrative.

Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

Clone this wiki locally