Docs · captcha

captcha

9 captcha commands, generated from the engine's own registry — signatures, parameters and a worked example each. A does something command acts on the game; a needs x() one answers a confident wrong answer when its client hooks are missing.

awaitSleepWord does something returns string?
awaitSleepWord(timeout: int) -> string?

Waits for the next word to come back from the service and answers with it, or none if none arrived in time. Blocks, and stops promptly when the script is stopped.

ParameterTypeWhat it does
timeoutrequired int how long to wait, in milliseconds
Example
let word = awaitSleepWord(15000)
if word != none { typeSleepWord(word) }
captchaOutOfCredits returns bool
captchaOutOfCredits() -> bool

Whether the service last refused for want of credits. Cleared by the next successful read, so it answers "can this account pay for a word right now" rather than "did it ever fail".

Example
if captchaOutOfCredits() { print("top up at botwith.me") stop }
captchaReady returns bool
captchaReady() -> bool

Whether a reading service is installed at all. False means sleep words are never sent and awaitSleepWord can only ever time out.

Example
if not captchaReady() { print("nothing can read a sleep word") }
captchaServer returns string
captchaServer() -> string

Which game server sleep words are being read for. The reader is trained per server and cannot be shared between them.

Example
print("reading words for", captchaServer())
captchasDropped returns int
captchasDropped() -> int

How many were thrown away because the service was already busy with two.

Example
if captchasDropped() > 0 { print("the reader is falling behind") }
captchasSent returns int
captchasSent() -> int

How many sleep words have been sent to be read.

Example
print("sent", captchasSent())
captchasSolved returns int
captchasSolved() -> int

How many came back with a word.

Example
print("solved", captchasSolved())
sleepWord returns string?
sleepWord() -> string?

The last word the service read, or none if it has read none this session. It is the last word rather than the last attempt: a failed read after a good one does not take the word away.

Example
if sleepWord() != none { print("the last word was", str(sleepWord())) }
typeSleepWord does something
typeSleepWord(word: string)

Types a word into the sleep box and presses enter, one character at a time with human gaps. Answers nothing, because the client acknowledges nothing: follow it with 'wait until not isSleeping()' to find out whether it was right.

ParameterTypeWhat it does
wordrequired string the five characters
Example
typeSleepWord("crumb")