;Alan's Scrabble script. ;Place the following in a "Start New Game" spot. ;Warning: This script will only work with the newest clients. ON ENTER { card GLOBAL 0 card = host GLOBAL "" host = source GLOBAL " ABCDEFGHIJKLMNOPQRSTUVWXYZ#" source = "Say 'help' for room instructions." LOCALMSG } ON INCHAT { { GLOBAL } [ host deck card source letter1 letter2 letter3 letter4 letter5 letter6 letter7 ] FOREACH ; { WHOCHAT WHONAME host = } CHATSTR "I'm starting a new game." == IF ; ; Host issues letters via door states ; { "$1" GREPSUB ATOI i = 0 k = { source deck card GET STRINDEX state = "letter" k 1 + ITOA & spot = state spot STRTOATOM EXEC SETSPOTSTATE i -- k ++ card -- } { i card 1 + AND } WHILE { "There are no more source." ROOMMSG } card 0 < IF ";!@#" WHOCHAT WHONAME & SAY "" CHATSTR = } CHATSTR "^draw ([1234567]+)" GREPSTR host USERNAME == AND IF ; ; Person receives letters via door states and resets them ; { "$1" GREPSUB recipient = { 0 k = "You drew: " message = { "letter" k 1 + ITOA & spot = source spot STRTOATOM EXEC GETSPOTSTATE 1 SUBSTRING UPPERCASE letter = { "blank" letter = } letter "#" == IF message letter & " " & message = k ++ } { k 7 < } WHILE message LOCALMSG { 0 SWAP SETSPOTSTATE } [ letter1 letter2 letter3 letter4 letter5 letter6 letter7 ] FOREACH } USERNAME recipient == IF } CHATSTR ";!@#(.*)" GREPSTR IF } ON OUTCHAT { { "Room instructions have been written in your log." LOCALMSG "\x0dTo start the game one person, only, must select 'Start New Game'." LOGMSG "When it is your turn say 'draw N' where N is the number of letters you want to draw." LOGMSG "There is no way to return letters that you have drawn." LOGMSG "If you draw too many just keep aside them for your next turn(s)." LOGMSG "Click on any of the score digits to advance that digit." LOGMSG "When a score digit rolls over from 9 to 0 the next digit will be automatically incremented. \x0d" LOGMSG "" CHATSTR = } CHATSTR "help" == IF ; ;Prevent cheating ; { "" CHATSTR = } CHATSTR "I'm starting a new game." == CHATSTR ";!@#(.*)" GREPSTR OR IF } ON SELECT { card GLOBAL deck GLOBAL host GLOBAL ; "I'm starting a new game." SAY ;Reset scores { DUP GLOBAL 0 SWAP SETSPOTSTATE } [ s1_1 s1_10 s1_100 s2_1 s2_10 s2_100 s3_1 s3_10 s3_100 s4_1 s4_10 s4_100 s5_1 s5_10 s5_100 ] FOREACH ;Mix letters [ ;*** Define letters (# is a blank tile) *** "A" "A" "A" "A" "A" "A" "A" "A" "A" "B" "B" "C" "C" "D" "D" "D" "D" "E" "E" "E" "E" "E" "E" "E" "E" "E" "E" "E" "E" "F" "F" "G" "G" "G" "H" "H" "I" "I" "I" "I" "I" "I" "I" "I" "I" "J" "K" "L" "L" "L" "L" "M" "M" "N" "N" "N" "N" "N" "N" "O" "O" "O" "O" "O" "O" "O" "O" "P" "P" "Q" "R" "R" "R" "R" "R" "R" "S" "S" "S" "S" "T" "T" "T" "T" "T" "T" "U" "U" "U" "U" "V" "V" "W" "W" "X" "Y" "Y" "Z" "#" "#" ;*** ] cards = cards LENGTH nbrcards = nbrcards ARRAY deck = nbrcards i = 0 card = { i RANDOM k = cards k GET deck card PUT cards i 1 - GET cards k PUT "" cards i 1 - PUT i -- card ++ } { i } WHILE card -- } ;Place the following in 7 new doors: ON ENTER { letter1 GLOBAL ME letter1 = } ON ENTER { letter2 GLOBAL ME letter2 = } ON ENTER { letter3 GLOBAL ME letter3 = } ON ENTER { letter4 GLOBAL ME letter4 = } ON ENTER { letter5 GLOBAL ME letter5 = } ON ENTER { letter6 GLOBAL ME letter6 = } ON ENTER { letter7 GLOBAL ME letter7 = } ;Alan's counter script ;First score counter ;Put this in the 1's spot with number pictures for states 0 through 9. ON ENTER { s1_1 GLOBAL ME s1_1 = } ON SELECT { s1_10 GLOBAL { 0 ME SETSPOTSTATE s1_10 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Put this in the 10's spot with number pictures for states 0 through 9. ON ENTER { s1_10 GLOBAL ME s1_10 = } ON SELECT { s1_100 GLOBAL { 0 ME SETSPOTSTATE s1_100 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Place this in the 100's spot with number pictures for states 0 through 9. ON ENTER { s1_100 GLOBAL ME s1_100 = } ON SELECT { 10 N = ME GETSPOTSTATE 1 + N % ME SETSPOTSTATE } ;Second score counter ;Put this in the 1's spot with number pictures for states 0 through 9. ON ENTER { s2_1 GLOBAL ME s2_1 = } ON SELECT { s2_10 GLOBAL { 0 ME SETSPOTSTATE s2_10 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Put this in the 10's spot with number pictures for states 0 through 9. ON ENTER { s2_10 GLOBAL ME s2_10 = } ON SELECT { s2_100 GLOBAL { 0 ME SETSPOTSTATE s2_100 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Place this in the 100's spot with number pictures for states 0 through 9. ON ENTER { s2_100 GLOBAL ME s2_100 = } ON SELECT { 10 N = ME GETSPOTSTATE 1 + N % ME SETSPOTSTATE } ;Third score counter ;Put this in the 1's spot with number pictures for states 0 through 9. ON ENTER { s3_1 GLOBAL ME s3_1 = } ON SELECT { s3_10 GLOBAL { 0 ME SETSPOTSTATE s3_10 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Put this in the 10's spot with number pictures for states 0 through 9. ON ENTER { s3_10 GLOBAL ME s3_10 = } ON SELECT { s3_100 GLOBAL { 0 ME SETSPOTSTATE s3_100 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Place this in the 100's spot with number pictures for states 0 through 9. ON ENTER { s3_100 GLOBAL ME s3_100 = } ON SELECT { 10 N = ME GETSPOTSTATE 1 + N % ME SETSPOTSTATE } ;Fourth score counter ;Put this in the 1's spot with number pictures for states 0 through 9. ON ENTER { s4_1 GLOBAL ME s4_1 = } ON SELECT { s4_10 GLOBAL { 0 ME SETSPOTSTATE s4_10 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Put this in the 10's spot with number pictures for states 0 through 9. ON ENTER { s4_10 GLOBAL ME s4_10 = } ON SELECT { s4_100 GLOBAL { 0 ME SETSPOTSTATE s4_100 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Place this in the 100's spot with number pictures for states 0 through 9. ON ENTER { s4_100 GLOBAL ME s4_100 = } ON SELECT { 10 N = ME GETSPOTSTATE 1 + N % ME SETSPOTSTATE } ;Fifth score counter ;Put this in the 1's spot with number pictures for states 0 through 9. ON ENTER { s5_1 GLOBAL ME s5_1 = } ON SELECT { s5_10 GLOBAL { 0 ME SETSPOTSTATE s5_10 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Put this in the 10's spot with number pictures for states 0 through 9. ON ENTER { s5_10 GLOBAL ME s5_10 = } ON SELECT { s5_100 GLOBAL { 0 ME SETSPOTSTATE s5_100 SELECT } { ME GETSPOTSTATE 1 + ME SETSPOTSTATE } ME GETSPOTSTATE 9 == IFELSE } ;Place this in the 100's spot with number pictures for states 0 through 9. ON ENTER { s5_100 GLOBAL ME s5_100 = } ON SELECT { 10 N = ME GETSPOTSTATE 1 + N % ME SETSPOTSTATE }