Skip to reading
Error Handling & Debugging

Why exactly two tickets failed

Edition 0.86.4.4 Hotfix 2

Updated through 0.86.4.4 Hotfix 2, with cinematic property, recorded-pose or voice-timing lessons as described in this guide. Earlier examples, screenshots and complete registry figures retain their stated edition context.

Download PDFView PDF page

A LOGIC ERROR, TRACED

The script passed validation. When a player pressed the gate button with two tickets, the output still said Gate stays closed. Here is the decision that produced it.

Code example
function run()
    let price = 2
    if tickets > price
        log "Gate opens"
        return true
    end
    log "Gate stays closed"
    return false
end

The project supplies the shared number tickets. Read the condition aloud. “More than two” excludes two. The design calls for “at least two,” written tickets >= price. Only the comparison needs to change.

Source table from Why exactly two tickets failed, page 10
Player holds 1Before the change: closed. After the change: closed.
Player holds 2Before: closed. After: open. This is the case that exposed the mistake.
Player holds 3Before: open. After: open.

The three counts were run through both versions. The gate button was also checked at the exact fare. For a real gate, verify the character can actually pass, and that a second click behaves as your design intends.

Page 10 of 37Permalink
Go to page