BookRequestPage
Asks the shard for the content of a single page of the currently open book.
Most shards send the whole book right after its cover, and then nothing needs to be requested — the pages are already in memory and BookGetPageText returns them. Some shards deliver pages lazily instead: the cover arrives, but a page only follows a request for it. Stealth requests such books on its own when the cover says the content was not delivered, so this method is only needed to re-read a page — for example after the book was edited from another client.
The book must be opened beforehand (e.g. via UseObject or UseType). If no book is open, or Page is 0 or exceeds the book’s page count, the method logs a warning and does nothing — page numbering starts from 1.
The request is asynchronous: the method returns immediately and the page arrives with the shard’s reply, so give it a short wait before reading the text.
Запрашивает у шарда содержимое одной страницы текущей открытой книги.
Большинство шардов присылают книгу целиком сразу за обложкой, и запрашивать ничего не нужно — страницы уже в памяти, и BookGetPageText их возвращает. Некоторые шарды отдают страницы лениво: приходит обложка, а страница — только в ответ на запрос. Такие книги Stealth запрашивает сам, если обложка сообщила, что содержимое не отдано, поэтому метод нужен в основном чтобы перечитать страницу — например, после правки книги из другого клиента.
Книга должна быть предварительно открыта (например, через UseObject или UseType). Если книга не открыта, либо Page равен 0 или превышает количество страниц книги, метод выводит предупреждение и ничего не делает — нумерация страниц начинается с 1.
Запрос асинхронный: метод возвращает управление сразу, а страница приходит с ответом шарда, поэтому перед чтением текста нужна небольшая пауза.
procedure BookRequestPage(Page: Word);
Parameters:
- Page — page number (1-based).
def BookRequestPage(Page: int) -> None: ...
var
PageText: String;
begin
UseObject(FindItem);
Wait(1000);
BookRequestPage(3);
Wait(500);
PageText := BookGetPageText(3);
AddToSystemJournal('Page 3: ' + PageText);
end.
UseObject(FindItem())
Wait(1000)
BookRequestPage(3)
Wait(500)
AddToSystemJournal(f'Page 3: {BookGetPageText(3)}')
BookGetPageText, BookSetPageText, BookSetText, BookClearText, BookSetHeader