- Learn
- Build a Game
- Chess
- Appendices
- E Troubleshooting
Appendix E — Troubleshooting
Every chapter’s If it didn’t work names the slips most likely in that chapter, and how to find each one. Here they are together, chapter by chapter.
Two checks find most of them. First, names must match exactly: a message, a timer or a table row is matched letter for letter, capitals included. Second, compare with the chapter’s game. Every chapter’s Goal holds the game as it is at the end of that chapter, and its catch-up download is that chapter’s finished project. Play it next to yours.
E.1 Chapter 1: The Board and the Pieces
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block, and what it misses. Hold that block’s boxes up to the card, character by character, and look hardest at the quote marks, the @ signs and the dots.
A White King on every Square? Every Piece was made, but Show Piece never ran for any of them. Perhaps it isn’t attached to the Piece. Or its When bar says something a letter off from boardLaidOut. It must match Lay Out The Board’s Trigger Custom Event exactly, capital L and capital O.
The bottom Rank right, but White Kings on every Rank above it, and every Rank number a 1? Then boardLaidOut went out too early, from inside the second If. Most of the Pieces hadn’t been made yet. Step 16 belongs after the whole Repeat, so right-click it and choose Cut. Right-click the Repeat and choose Paste, and it lands right after the Repeat. Join it with Connect to Sequence.
Only one File letter, the a in the corner? The second If went inside the first one, so it runs only on a1. Right-click the second If and choose Cut. Right-click the first If and choose Paste. It lands right after the first If, and Connect to Sequence joins it there.
The Board and its labels, but no Pieces on it? Look at the Board’s Shared Variables first. If pieceObject still says None, the Board has nothing to make. Press it and pick Piece. Or look below the Board, in the bottom-left corner, where a pile of Pieces means they were all made in one spot. Create Instance’s X and Y should be spot.x and spot.y.
Only the Board, and no labels either? Perhaps nothing made them. Open the Board in Logic mode, and look for Lay Out The Board in its Attached Logic. Then look in Lay Out The Board for a block with no arrow into it, and join it with Connect to Sequence.
The right Squares, but the wrong Pieces? Look at the Kinds table, at each row’s two numbers, and at Set Frame’s Frame.
Every File Label says 1? Its shows still starts at rank. Open the File Label, and type fileLetter over it, under Variables.
Rank numbers 3 to 6 in the middle of their Squares, and no File letters? The rest are there, under the Pieces. The labels’ Position went into the Object’s own Transform, at the top. Put that back to 0 and 0. The card’s Position goes further down, in the Text / UI’s Transform.
E.2 Chapter 2: Select and Move
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses, and most often it’s a quote mark. A Column is a word, so it wants its quote marks: "reachable", "kind", "side". A Row goes bare.
A click on a Piece, and nothing lights at all? If the dots on every Square vanish at your first click, Select and Move is running, but it found no Piece where you clicked. Look at its step 3. Its Value should read other.squareInfo.name, the clicked Square’s name.
The whole Board covered in white before the first click, with the wood gone? Square Marks’ When Created Event isn’t hiding the Squares. Look for it, with its Set Alpha of 0, and for a block with no arrow into it.
The Squares light, but the Pawn stays on e2 after its Move? Show Piece isn’t hearing positionChanged yet. Perhaps it has no second Event, or its When bar says something a letter off. It must match Select and Move’s Trigger Custom Event, capital C.
The Pawn on e4, but another Pawn still on e2? The old Square wasn’t emptied. Look at Select and Move’s steps 8 and 9, the two Set Data Cells whose Row is selectedSquare.
A Rook’s dots run up the File, right past its own Pawn? The walk never learns to stop. Look at Follow Direction’s last step, keepGoing set from squareLook.value, and check that it’s joined inside the While.
The gold, but no dots anywhere? Look at the Directions table: its kind column must spell each Kind as Position does, King or Pawn, with a capital. Perhaps Look At Square’s Row has quote marks around it. Typed so, it names a row called square, and Targets has none. It should read square, bare.
White’s Pawns marked toward their own side? Look at the Sides table: forward is 1 for White and -1 for Black.
E.3 Chapter 3: Turns and Check
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. Hold that block up to the card, quote marks, @ and $ included.
Nothing under the Board at all? Perhaps the Status Line’s Text isn’t {$status}, braces and all. Perhaps Start Turn isn’t attached to the Game Rules. Or its When Created Event’s call to Look For Check has no self picked in gameRules.
Dots all over the Board at the start? Start Turn’s When Created isn’t sending positionChanged, so look for its step 2, and check that it’s joined.
Your move, but either Side still moves? Select and Move’s step 13 still asks whether the Square has a kind. Its condition should start by comparing the clicked Square’s side with self.boardState.sideToMove.
Only White ever moves? Then the Turn never passes. Perhaps moveMade isn’t sent, or Start Turn’s second Event says something a letter off. Both must read moveMade, capital M. Or Sides’ opponent column is still empty, with no Side to pass the Turn to.
A Piece turns gold, but no dots ever show? Keep Safe Moves is dropping every Move, as if your own Pieces were the attackers. Look at its step 5. The enemy comes from Sides: data('Sides', side, 'opponent').
Click a Piece, and it vanishes from its Square while its dots appear? Its Move was tried and never taken back, and the last two steps then emptied the Square it was tried on. Look for Drop Move If Unsafe’s step 13, the Move Piece with to in from and from in to.
Check under the Board when no King is attacked? Find Attacker Along’s walk may be going forward instead of back. Steps 14 and 15 use -=.
The red shows, but under the gold or the yellow? Square Marks’ three Ifs are in the wrong order, and they should run last Move, then selected, then Check.
E.4 Chapter 4: Special Moves
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. Hold that block up to the card, quote marks, @ and $ included.
Castling never shows its dot? Start with the Castling table, where four rows of Squares were typed by hand. Perhaps a Square is typed a little off, or isAllowed says false. Next, look at Try Castling’s step 12. Each test compares with an empty text, and && joins them. Or look at Find Legal Moves’ step 8: both tests have to hold.
The King castles, but the Rook stays home? Update Castling’s step 7 moves the Rook, from the row’s rookFrom to its rookTo, when step 6’s If says it should. Look for a test in that condition that doesn’t match the card.
A strange Piece is left behind on d5 after an en passant capture? Make Move’s step 17 needs 'kind', with its quote marks.
The dot on d6 never shows? Make Move may never write the skipped Square, so look at its steps 21 to 24. Or Select and Move’s Find Legal Moves is missing its enPassantSquare, self.boardState.enPassantSquare, in the second box.
An enemy Piece vanishes the moment you click one of yours? Drop Move If Unsafe’s steps 6 and 7 may have landed at the end of the line, where they empty the Square after the Move is put back. They belong before Move Piece. Use the round handles to join them after step 5, and try the Move again.
The panel never shows? Each of the four Objects needs the Group Promotion in its UI Interaction, spelled the same as in Select and Move’s step 10.
The panel shows, but pressing a Piece does nothing? Report Choice may be missing from that Object. Or Choose Promotion isn’t attached to the Game Rules, or its step 1 asks about Playing instead of Promotion.
The Board still answers clicks while the panel is open? Look at Report Click’s Check Game State, which should name Playing, the only state where a click counts.
E.5 Chapter 5: The End of the Game
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. Compare it with the card.
The game says Check after the Queen reaches h4, but never Checkmate? Look For Game End may not be hearing turnStarted. Perhaps it isn’t attached to the Game Rules. Perhaps Start Turn’s new steps say something a letter off: both must read turnStarted, with a capital S.
The game ends after the very first Move? Look first at Look For Game End’s step 7, which belongs inside the If, right under Show Result. Next, Is Out Of Moves may never find a dot. Look at its step 10: && joins both tests. Or step 12’s If may sit inside step 10’s If instead of after it.
You lose · Checkmate when you won? Show Result’s step 5 asks three things, and the last compares side with gameRules.boardState.playerSide. Perhaps playerSide in Board State has no default, White.
The words say a result, but the Board still answers clicks? Look at Look For Game End’s step 7, and the Game State list in the Set up. Game Over has to be there to be picked.
The Knights dance back and forth, and no Draw comes? Look at Record Position. Its Control Data Row adds a row only when the Row is dataCount('Position History'), one past the end. Or look at Is Position Repeated’s step 5, which divides by dataCount('Position'). Are its Table names spelled the same as yours?
After an en passant capture, is a strange Piece left behind on the Board again? Look at Update En Passant’s step 16, whose Column needs 'kind' with its quote marks, as Make Move’s did.
E.6 Chapter 6: New Game, Side and Flip
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. Compare that one block with its card, including the quote marks around every text.
Flip does nothing at all? Perhaps its placement still picks Tool Button instead of Flip Button. Or Report Flip’s step has no arrow into it. Join it to its Mode.
The Board turns, but the Pieces stay where they were? Place On Board may not be attached to the Piece. Or Flip Board’s boardFlipped is spelled differently, so Place On Board never hears it.
Every Piece and Square piles up in one spot as the game starts? Look at Square Position’s steps 10 and 11. Do they still have arrows into them, after the If on the line from Start? If not, join step 10 after the If with the round handles. The Function works out x and y again, then returns them.
Labels show on all four edges? Look at Show Label’s new Event, and its If, edgeLine == 1. Perhaps the File Label’s edge is still file, when it should be rank, bare.
The panel opens, but nothing turns green? Show Option may be missing from the Option Button. Or a placement’s option is empty, so that button stands for nothing at all.
The panel won’t close? Cancel’s placement needs Close New Game Button as its Object. That variant adds Close New Game, whose Menu Element names the New Game Panel.
The panel opens white, not cream? Its Object’s Tint is still white. Give New Game Panel #EFE6CF, and Option Button and Panel Button #E2D5B4.
E.7 Chapter 7: The Computer
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. New Game may still show Chapter 6’s two false Number errors for its saved words. Keep those Values as the card shows. For another error, compare its block with the card, including each quote mark and prefix.
It says Thinking… and stays there, and nothing moves? Stockfish may never have heard the question, so look at Ask The Computer’s Run Code line, letter by letter, and the Library’s Alias, stockfishBridge. Or the answer came, and nobody listened. Is Make Computer Move attached to the Game Rules?
Opponent disconnected shows under the Board, twenty seconds or more after your Move? That’s the clock from Ask The Computer, ringing. Perhaps the Library’s file didn’t import whole, so import stockfish-bridge.js again from the zip.
The Computer’s Piece jumps, and doesn’t glide? Perhaps your computer asks for less motion, and that’s the game being kind to it. If not, look at the two Tween steps.
The Piece glides, but the Move never happens? Only the first Moving Piece says when it lands, so its saysWhenLanded must be Yes, and the Rook’s Off.
You see two of the same Piece during a slide? Look at Show Piece’s new Event, and its != -1.
Undo stays faded? Report Undo’s On Position Changed may have no arrow into Can Undo or Show Button On Or Off. Its isOn must read canUse.value. Undo wakes, but a press does nothing? Then look at the Game Rules, and whether Undo is attached to them. Undo answers, but takes back too much or too little? Look at its step 3 If, and its two tests, joined with &&: your Turn now, and a Move left to keep.
E.8 Chapter 8: The Hint
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. Compare that one block with its card.
Hint stays faded on your Turn, even with nothing else going on? Look at Report Hint’s On Position Changed. Both calls need joining, with canUse.value in Show Button On Or Off’s isOn.
Hint lights up, but a press does nothing? Is Give A Hint attached to the Game Rules? Or perhaps the placement’s Object still picks Undo Button instead of Hint Button.
It says Finding a hint… and stays there? Look at step 8’s Run Code line, letter by letter. If it’s right, the Library may still be Chapter 7’s file, which has no Hint in it. Import stockfish-bridge.js again, from Chapter 8’s zip. After 20 seconds or so, A hint could not be found. shows instead, and the game goes on.
The bar shows, but no Square turns blue-green? Look at the new If in Square Marks, where either of those two Squares should match. Its two tests read from and to, joined with ||.
The bar says Try to .? Show Hint Message’s self may have no Hint Words, or its slot isn’t named hintWords.
The blue-green never goes away? Select and Move’s step 3 may still have no arrow into it, and every click needs to run Forget The Hint first.
E.9 Chapter 9: Threats
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. Compare that block with its card.
A King in Check no longer turns red, after the first part? Look at Find Attacker Along’s If. Its three tests ask about piece, and piece must be declared as Text.
Threats stays faded on your Turn? Look at Report Threats’ On Position Changed. Both calls need joining, with canUse.value in Show Button On Or Off’s isOn. Threats lights up, but a press does nothing? Check Show Threats on the Game Rules, where it needs to be attached. Perhaps the placement still picks Hint Button instead of Threats Button.
The legend never shows? Each Legend Key’s Group must be Threats Legend, the same words Show Threats names.
Dots appear for a Piece you didn’t select? Find Threats’ last step, Clear Targets, may be missing or Unattached.
Pieces jump to the wrong Squares, or vanish, when Threats is on? Can Recapture didn’t put everything back. Look at its last three steps. Move Piece there carries the Piece back, so its from and to are swapped from the first Move Piece’s.
No outline, ring or bar anywhere, though the red shows? Look at Lay Out The Board’s four new steps, and at the Board, where its two new Shared Variables need Threat Mark and Pin Mark. A ring never shows? Find Threats’ step 18 may still be missing.
The marks stay behind when you press Flip, while every Piece moves to its new Square? Place On Board may not be attached to that mark’s Object.
E.10 Chapter 10: Pin Lines and Arrows
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. Compare that block with its card.
No lines or arrows at all, though the red marks show? Is Draw Threat Lines attached? Perhaps the Draw Event starts on Draw Nothing, when the card’s Draw The Lines is the one it should start with.
The lines show once, then never again after the Computer moves? Look at On Position Changed. Its Else needs its own Switch Mode, back to Draw The Lines.
Arrows land in the wrong spot, or off the Board? Look at Square Screen Point, and the Board’s Shared Variables. squareMeters, boardLeft and boardBottom must match Place On Board’s, and pixelsPerMeter is 32. Perhaps x is multiplied by pixelsPerMeter and y isn’t.
An arrow’s head looks bent, with both strokes leaning one way? Look at Draw Arrow’s last two Draw Lines, and the signs on sideX and sideY. One head stroke takes minus sideX and plus sideY, the other the other way round.
The lines are solid, not dashed? Look at Draw Dashed Line’s step 18. Its along should move on by dashSpacing, and dashSpacing must be more than dashLength.
The game freezes when Threats is on? A While that never ends looks like that, so look at Draw Dashed Line’s step 18. Is it inside the While, at the end of its line?
Dots appear for a Piece you didn’t select? Find Arrows’ last If may be missing, or its Clear Targets Unattached.
The teal never shows? Look at Square Marks’ step 8, and whether it comes before the selected Square’s If. Is Inspect Piece on the outer Else’s line in Select and Move?
The button never turns pale green? Look at Threats Button’s Logic. It needs Show Threats Button Pressed alongside Report Threats. Its If reads other.boardState, the Game Rules that sent the message.
E.11 Chapter 11: Settings and Saving
The panel opens white, or a button stays white? A Tint is missing. Select that placement, open its Sprite part, and give Tint the cream #EFE6CF for the panel, or the tan #E2D5B4 for a button.
A block drawn in red, with a number on the Errors bar? Open the bar. It names the block and what it misses. Compare that block with its card. Perhaps a newGameOption is left in a Value that now needs panelOption.
Settings opens, but pressing Slate changes nothing? Look at that button’s placement. It should pick Board Finish Option, whose Logic includes Report Board Finish. Is Show Board Finish attached to the Board?
The Board changes, but the Pieces don’t? Open On Look Changed. Its first call needs other.boardState.pieceSet, from the Game Rules that sent the message.
The labels are hard to read on Slate? Show Label’s On Look Changed may be missing, or the old coloring steps still sit in On Board Laid Out.
A choice comes back wrong after you close the window? Compare the two Keys. Save Persistent Value’s 'boardFinish' and Load Persistent Value’s must be the same word, letter for letter.
The game always opens at the start, though you played on? Look at every Save Game, Load Game and Check Save Exists. Each Slot must say "auto", not "default". Then look at Continue The Game’s step 3. Left on Enable, it lets the new game’s first Turn be saved over yours.
The Computer never answers after the game comes back? Perhaps On Load:succeeded is missing its last If, and its gameContinues.
New Game’s Play brings back your old game? On Play Pressed needs its Delete Save, with auto, before Restart Game.
