Skip to content

API UO BookSetPageText en

Codex edited this page Sep 23, 2026 · 1 revision

UO.BookSetPageText

ClassicUO / Basic IDE

Home · API · Books

Replaces one page of the open editable book.

Exact syntax

UO.BookSetPageText(Page:Any, Text:Any) -> Unit

Parameters

  • Page — One-based page number, not a book serial. The server supplies the page count.
  • 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.

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*.

The helper is fully included. Its TRUE only reports that its local check and call ran; it does not confirm server storage.

Examples

Direct use

# Direct use
#
# Replaces one page 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.BookSetPageText(2, "Camp A")
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
#
# Replaces one page 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.BookSetPageText(1, "Supplies" + Chr(10) + "Bandages" + Chr(10) + "Food")
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
#
# Replaces one page 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.
    # The helper is fully included. Its TRUE only reports that its local check and call ran; it does
    # not confirm server storage.

    VAR requested = AppendNote(1, "Return before night")
END SUB

FUNCTION AppendNote(page, line)
    IF Len(line) > 53 THEN
        RETURN FALSE
    END IF
    VAR previous = UO.BookGetPageText(page)
    IF previous = "" THEN
        UO.BookSetPageText(page, line)
        RETURN TRUE
    END IF
    VAR lineCount = 1
    FOR VAR index = 1 TO Len(previous)
        IF Mid(previous, index, 1) = Chr(10) THEN
            lineCount = lineCount + 1
        END IF
    NEXT
    IF lineCount >= 10 THEN
        RETURN FALSE
    END IF
    UO.BookSetPageText(page, previous + Chr(10) + line)
    RETURN TRUE
END FUNCTION

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.
  • The helper is fully included. Its TRUE only reports that its local check and call ran; it does not confirm server storage.

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

Clone this wiki locally