Home
Explore games
Help
Log in
Playfic is now in read-only mode.
You can still play existing games, but new signups and game editing is disabled.
Read the announcement.
Log in
Username
Password (
Forgot it?
)
Login
Trick of the Mind
by
Nolan
Played 2,300 times
View game source
(spoilers!)
Download the
.z8 file
Source Code
"Trick of the Mind" To remove stray punctuation: (- PunctuationStripping(); players_command = 100 + WordCount(); -) To remove quotes: (- Quotestripping(); players_command = 100 + WordCount(); -) To remove apostrophes: (- SingleQuotestripping(); players_command = 100 + WordCount(); -) To remove question marks: (- Questionstripping(); players_command = 100 + WordCount(); -) To remove exclamation points: (- ExclamationStripping(); players_command = 100 + WordCount(); -) To remove periods: (- PeriodStripping(); players_command = 100 + WordCount(); -) To resolve punctuated titles: (- DeTitler(); players_command = 100 + WordCount(); -) Include (- [ Detitler i j buffer_length flag; #ifdef TARGET_ZCODE; buffer_length = buffer->1+(WORDSIZE-1); #endif; #ifdef TARGET_GLULX; buffer_length = (buffer-->0)+(WORDSIZE-1); #endif; for (i = WORDSIZE : i <= buffer_length: i++) { if ((buffer->i) == '.' && (i > WORDSIZE + 1)) { if ((buffer->(i-1)=='r') && (buffer->(i-2)=='m') && ((buffer->(i-3)==' ') || ((i-3) < WORDSIZE))) flag = 1; if ((buffer->(i-1)=='r') && (buffer->(i-2)=='d') && ((buffer->(i-3)==' ') || ((i-3) < WORDSIZE))) flag = 1; if ((buffer->(i-1)=='t') && (buffer->(i-2)=='s') && ((buffer->(i-3)==' ') || ((i-3) < WORDSIZE))) flag = 1; if ((buffer->(i-1)=='s') && (buffer->(i-2)=='r') && (buffer->(i-3)=='m') && ((buffer->(i-4)==' ') || ((i-4) < WORDSIZE))) flag = 1; if ((buffer->(i-1)=='v') && (buffer->(i-2)=='e') && (buffer->(i-3)=='r') && ((buffer->(i-4)==' ') || ((i-4) < WORDSIZE))) flag = 1; if ((buffer->(i-1)=='f') && (buffer->(i-2)=='o') && (buffer->(i-3)=='r') && (buffer->(i-4)=='p') && ((buffer->(i-5)==' ') || ((i-5) < WORDSIZE))) flag = 1; if (flag) buffer->i = ' '; } } VM_Tokenise(buffer, parse); ]; -) Include (- [ KeyPause i; i = VM_KeyChar(); rfalse; ]; [ SPACEPause i; while (i ~= 13 or 31 or 32) { i = VM_KeyChar(); } ]; [ GetKey i; i = VM_KeyChar(); return i; ]; -) To clear the/-- screen: (- VM_ClearScreen(0); -) To clear only the/-- main screen: (- VM_ClearScreen(2); -) To clear only the/-- status line: (- VM_ClearScreen(1); -). To wait for any key: (- KeyPause(); -) To wait for the/-- SPACE key: (- SPACEPause(); -) To decide what number is the chosen letter: (- GetKey() -) To pause the/-- game: say "[paragraph break]Please press SPACE to continue."; wait for the SPACE key; clear the screen. To center (quote - text): (- CenterPrintComplex({quote}); -); To center (quote - text) at the/-- row (depth - a number): (- CenterPrint({quote}, {depth}); -); To stop the/-- game abruptly: (- quit; -) To show the/-- current quotation: (- ClearBoxedText(); -); Include (- #ifndef printed_text; Array printed_text --> 64; #endif; [ CenterPrint str depth i j; font off; i = VM_ScreenWidth(); VM_PrintToBuffer(printed_text, 63, str); j = (i-(printed_text-->0))/2; j = j-1; VM_MoveCursorInStatusLine(depth, j); print (I7_string) str; font on; ]; [ CenterPrintComplex str i j; font off; print "^"; i = VM_ScreenWidth(); VM_PrintToBuffer(printed_text, 63, str); j = (i-(printed_text-->0))/2; spaces j-1; print (I7_string) str; font on; ]; -) To decide what number is screen width: (- VM_ScreenWidth() -); To decide what number is screen height: (- I7ScreenHeight() -); Include (- [ I7ScreenHeight i screen_height; i = 0->32; if (screen_height == 0 or 255) screen_height = 18; screen_height = screen_height - 7; return screen_height; ]; -) To deepen the/-- status line to (depth - a number) rows: (- DeepStatus({depth}); -); To move the/-- cursor to (depth - a number): (- I7VM_MoveCursorInStatusLine({depth}); -) To right align the/-- cursor to (depth - a number): (- RightAlign({depth}); -) Include (- [ DeepStatus depth i screen_width; VM_StatusLineHeight(depth); screen_width = VM_ScreenWidth(); #ifdef TARGET_GLULX; VM_ClearScreen(1); #ifnot; style reverse; for (i=1:i<depth+1:i++) { @set_cursor i 1; spaces(screen_width); } #endif; ]; [ I7VM_MoveCursorInStatusLine depth; VM_MoveCursorInStatusLine(depth, 1); ]; [ RightAlign depth screen_width o n; screen_width = VM_ScreenWidth(); n = (+ right alignment depth +); o = screen_width - n; VM_MoveCursorInStatusLine(depth, o); ]; -) Table of Ordinary Status left central right "[location]" "" "[score]/[turn count]" Status bar table is a table-name that varies. Status bar table is the Table of Ordinary Status. To fill the/-- status bar/line with (selected table - a table-name): let __n be the number of rows in the selected table; deepen status line to __n rows; let __index be 1; repeat through selected table begin; move cursor to __index; say "[left entry]"; center central entry at row __index; right align cursor to __index; say "[right entry]"; increase __index by 1; end repeat. To say default letters: (- @set_colour 1 1; -) To say red letters: (- @set_colour 3 0; -) To say green letters: (- @set_colour 4 0; -) To say yellow letters: (- @set_colour 5 0; -) To say blue letters: (- @set_colour 6 0; -) To say magenta letters: (- @set_colour 7 0; -) To say cyan letters: (- @set_colour 8 0; -) To say white letters: (- @set_colour 9 0; -) To say black letters: (- @set_colour 2 0; -) To turn the/-- background black: (- @set_colour 0 2; -); To turn the/-- background red: (- @set_colour 0 3; -); To turn the/-- background green: (- @set_colour 0 4; -); To turn the/-- background yellow: (- @set_colour 0 5; -); To turn the/-- background blue: (- @set_colour 0 6; -); To turn the/-- background magenta: (- @set_colour 0 7; -); To turn the/-- background cyan: (- @set_colour 0 8; -); To turn the/-- background white: (- @set_colour 0 9; -); Right alignment depth is a number that varies. Right alignment depth is 14. Use undo prevention. The maximum score is 2. The thyme count is a number variable. The thyme count is 0. The secondary thyme count is a number variable. The secondary thyme count is 0. The computer count is a number variable. The computer count is 0. The nothing count is a number variable. The nothing count is 0. Understand "weight" as weighting. Weighting is an action applying to nothing. Report weighting: if the thyme count is 0: say "Thyme passes."; now the thyme count is 1; the thymegoing happens in one turn from now; otherwise: say "Thyme passes." At the time when the thymegoing happens: now the thyme count is 0; Understand the command "eat thyme" as something new. Understand the command "eat the thyme" as something new. Understand "eat thyme" or "eat the thyme" as thymeeating. Thymeeating is an action applying to nothing. Report thymeeating: if the thyme count is 0: say "You can't see any such thing."; otherwise: if the secondary thyme count is 1: say "You eat the thyme as it passes. It nourishes your health."; otherwise: say "You eat the thyme as it passes. It nourishes your health."; increase the score by 1; now the secondary thyme count is 1; Understand "type the right combination" or "the right combination" or "right combination" as safeopening. Safeopening is an action applying to nothing. Report safeopening in The Second Room: if the safe is locked: now the safe is unlocked; now the safe is open; say "You open the safe. Inside you find a purple key."; otherwise: say "The safe is already open."; Report safeopening in a room which is not The Second Room: say "I didn't understand that sentence." The The Room Where Play Begins is a room. "You are in a room. This room is a very roomy room. In fact, the roominess of this roomy room is roomier than the roominess of many other roomy rooms." The The Second Room is a room. "This is the second room." The The Third Room is a room. "This is the third room." The The Fourth Room is a room. "This is the fourth room." Your Brain is a room. "This is your brain. Whatever you do in here affects you." The Garden is a room. "You are in the Garden." Storage is a room. There is a thing called your common sense. The description of your common sense is "This is your common sense. It is indescribable except for the fact that it is indescribable.". There is a thing called nothing in Your Brain. "You can see nothing here." The description of nothing is "This nothing seems very absent.". Instead of doing something to nothing while the nothing count is 0: say "You're being crazy. Pull yourself together."; There is a green key in the Garden. The description of the green key is "[if green door is unlocked]A green key used to unlock green doors[otherwise]Yellow keys unlock yellow doors. Purple keys unlock purple doors. Green keys unlock..[end if]." There is a yellow key. "There is a yellow key lying at your feet." The description of the yellow key is "[if yellow door is unlocked]A yellow key used to unlock yellow doors[otherwise]Red keys unlock red doors. Blue keys unlock blue doors. Yellow keys unlock..[end if].". The yellow door is a door. The yellow door is south of The Second Room and north of The Room Where Play Begins. "There is a yellow door leading to the [if the player is in The Room Where Play Begins]north[otherwise]south[end if]." The yellow door is closed and locked. The matching key of the yellow door is the yellow key. There is a purple key. "There is a purple key lying at your feet." The description of the purple key is "[if purple door is unlocked]A purple key used to unlock purple doors[otherwise]Blue keys unlock blue doors. Yellow keys unlock yellow doors. Purple keys unlock..[end if].". The purple door is a door. The purple door is east of The Second Room and west of The Third Room. "There is a purple door leading to the [if the player is in The Second Room]east[otherwise]west[end if]." The purple door is closed and locked. The matching key of the purple door is the purple key. The green door is a door. The green door is south of The Third Room and north of The Fourth Room. "There is a green door leading to the [if the player is in The Third Room]south[otherwise]north[end if]." The green door is closed and locked. The matching key of the green door is the green key. There is a vase in The Room Where Play Begins. The description of the vase is "This is a red ceramic vase. There is something inside, but you can't seem to get to it or see it.". Instead of searching the vase: say "There is something inside, but you can't seem to get to it or see it."; Instead of dropping the vase: if the player carries the vase: say "The vase shatters at your feet from being dropped from a high altitude. A yellow key lies at your feet, presumably the object that was inside the vase."; now the vase is off-stage; now the yellow key is in The Room Where Play Begins; otherwise: say "The vase is already here."; There is a safe in The Second Room. The safe is a container. The safe has carrying capacity 1. The safe is closed, locked and not portable. The purple key is inside the safe. The description of the safe is "[if safe is locked]This safe looks extremely important. You can open the safe by typing the right combination[otherwise]This safe looks extremely important[end if].". Instead of searching the safe: say "[if safe is locked]This safe looks extremely important. You can open the safe by typing the right combination[otherwise]This safe looks extremely important[end if]."; There is a computer in The Third Room. The computer is a device. The computer is not portable. The computer is switched off. Instead of examining the computer: say "[if switched off]This computer is off. You might want to turn it on.[otherwise]A computer with a text-based game running.[end if]". After switching on the computer while the computer count is 0: say "You switch the computer on. It seems to be in the middle of a text-based game. You start playing... "; pause the game; clear only the main screen; now everything carried by the player is in Storage; now the player is in the Garden; now the computer count is 1; After the player taking the green key: say "You take the key in the game as you walk away from the computer. "; pause the game; clear only the main screen; now the player is in The Third Room; now the player carries everything that is in Storage; Every turn: if the player is in The Fourth Room: say "[command prompt]"; wait for any key; say "g"; wait for any key; say "o "; wait for any key; say "t"; wait for any key; say "o "; wait for any key; say "s"; wait for any key; say "l"; wait for any key; say "e"; wait for any key; say "e"; wait for any key; say "p"; wait for any key; say line break; say "Your eyes slowly close..."; pause the game; clear only the main screen; now the player is in Your Brain; the commonsense exists in four turns from now; At the time when the commonsense exists: now your common sense is in Your Brain; Before taking your common sense: now the nothing count is 1; After taking nothing: say "As you pick up nothing, the universe becomes boggled that you have nothing and something simultaneously, and brings you to freedom."; increase the score by 1; now the left hand status line is "Freedom"; end the story finally saying "You have won";