ROOM ID 129 PRIVATE NOPAINTING NOCYBORGS NAME "BattleShip" PICT "bship3.gif" PICTURE ID 1 NAME "bs0.gif" TRANSCOLOR 0 ENDPICTURE PICTURE ID 2 NAME "bs1.gif" TRANSCOLOR 0 ENDPICTURE PICTURE ID 3 NAME "bs2.gif" TRANSCOLOR 0 ENDPICTURE PICTURE ID 4 NAME "bs3.gif" TRANSCOLOR 0 ENDPICTURE PICTURE ID 5 NAME "bs4.gif" TRANSCOLOR 0 ENDPICTURE PICTURE ID 6 NAME "arrowll.gif" TRANSCOLOR 0 ENDPICTURE PICTURE ID 7 NAME "arrowrr.gif" TRANSCOLOR 0 ENDPICTURE DOOR ID 1 DONTMOVEHERE OUTLINE 202,71 507,71 507,377 202,377 LOC 330,167 SCRIPT ON ENTER { buildBrd GLOBAL gameBrd GLOBAL setup GLOBAL XProp GLOBAL YProp GLOBAL bship GLOBAL deadchk GLOBAL [ 211 241 271 301 331 361 391 421 451 481 ] XProp = [ 81 111 141 171 201 231 261 291 321 351 ] YProp = { 10 ARRAY gameBrd = 0 i = { 10 ARRAY gameBrd i PUT i ++ } { i 10 < } WHILE 0 y = { 0 x = { "~" gameBrd y GET x PUT x ++ } { x 10 < } WHILE y ++ } { y 10 < } WHILE } buildBrd DEF { ship = ship 1 + size = "" dir = { 10 RANDOM whereY = 10 RANDOM whereX = 0 n = 0 s = 0 e = 0 w = { 0 a = { { 1 n = } gameBrd whereY a - GET whereX GET "~" != IF a ++ } { a size < } WHILE } { 1 n = } whereY size 1 - >= IFELSE { 0 a = { { 1 s = } gameBrd whereY a + GET whereX GET "~" != IF a ++ } { a size < } WHILE } { 1 s = } whereY 10 size - <= IFELSE { 0 a = { { 1 w = } gameBrd whereY GET whereX a - GET "~" != IF a ++ } { a size < } WHILE } { 1 w = } whereX size 1 - >= IFELSE { 0 a = { { 1 e = } gameBrd whereY GET whereX a + GET "~" != IF a ++ } { a size < } WHILE } { 1 e = } whereX 10 size - <= IFELSE { "N" dir += } 0 n == IF { "S" dir += } 0 s == IF { "W" dir += } 0 w == IF { "E" dir += } 0 e == IF } { dir "" == } WHILE { "S" sh = } size 2 == IF { "D" sh = } size 3 == IF { "B" sh = } size 4 == IF { "A" sh = } size 5 == IF dir STRLEN num = dir num RANDOM 1 SUBSTRING dir = { 0 a = { sh gameBrd whereY a - GET whereX PUT a ++ } { a size < } WHILE } dir "N" == IF { 0 a = { sh gameBrd whereY a + GET whereX PUT a ++ } { a size < } WHILE } dir "S" == IF { 0 a = { sh gameBrd whereY GET whereX a - PUT a ++ } { a size < } WHILE } dir "W" == IF { 0 a = { sh gameBrd whereY GET whereX a + PUT a ++ } { a size < } WHILE } dir "E" == IF } setup DEF { 0 a = 0 b = 0 d = 0 s = 0 cY = { 0 cX = { { 1 a = } gameBrd cY GEt cX GET "A" == IF { 1 b = } gameBrd cY GEt cX GET "B" == IF { 1 d = } gameBrd cY GEt cX GET "D" == IF { 1 s = } gameBrd cY GEt cX GET "S" == IF cX ++ } { cX 10 < } WHILE cY ++ } { cY 10 < } WHILE { "Aircraft Carrier SUNK!" LOCALMSG "SUNK" ships 0 PUT 3 GETSPOTSTATE 1 - 3 SETSPOTSTATE } 0 a == ships 0 GET "SUNK" != AND IF { "Battleship SUNK!" LOCALMSG "SUNK" ships 1 PUT 3 GETSPOTSTATE 1 - 3 SETSPOTSTATE } 0 b == ships 1 GET "SUNK" != AND IF { "Destroyer SUNK!" LOCALMSG "SUNK" ships 2 PUT 3 GETSPOTSTATE 1 - 3 SETSPOTSTATE } 0 d == ships 2 GET "SUNK" != AND IF { "Submarine SUNK!" LOCALMSG "SUNK" ships 3 PUT 3 GETSPOTSTATE 1 - 3 SETSPOTSTATE } 0 s == ships 3 GET "SUNK" != AND IF { "You WIN!" LOCALMSG { "You have the best score!" LOCALMSG "!I HAVE THE BEST SCORE OF: " shots ITOA + SAY shots 4 SETSPOTSTATE } 4 GETSPOTSTATE shots > IF 0 2 SETSPOTSTATE 0 bship = } 0 a == 0 s == AND 0 b == AND 0 d == AND IF } deadchk DEF } ON SELECT { gameBrd GLOBAL bship GLOBAL XProp GLOBAL YProp GLOBAL ships GLOBAL deadchk GLOBAL shots GLOBAL { MOUSEPOS mousY = mousX = { 0 fX = } mousX 205 >= mousX 235 <= AND IF { 1 fX = } mousX 235 >= mousX 265 <= AND IF { 2 fX = } mousX 265 >= mousX 295 <= AND IF { 3 fX = } mousX 295 >= mousX 325 <= AND IF { 4 fX = } mousX 325 >= mousX 355 <= AND IF { 5 fX = } mousX 355 >= mousX 385 <= AND IF { 6 fX = } mousX 385 >= mousX 415 <= AND IF { 7 fX = } mousX 415 >= mousX 445 <= AND IF { 8 fX = } mousX 445 >= mousX 475 <= AND IF { 9 fX = } mousX 475 >= mousX 505 <= AND IF { 0 fY = } mousY 75 >= mousY 105 <= AND IF { 1 fY = } mousY 105 >= mousY 135 <= AND IF { 2 fY = } mousY 135 >= mousY 165 <= AND IF { 3 fY = } mousY 165 >= mousY 195 <= AND IF { 4 fY = } mousY 195 >= mousY 225 <= AND IF { 5 fY = } mousY 225 >= mousY 255 <= AND IF { 6 fY = } mousY 255 >= mousY 285 <= AND IF { 7 fY = } mousY 285 >= mousY 315 <= AND IF { 8 fY = } mousY 315 >= mousY 345 <= AND IF { 9 fY = } mousY 345 >= mousY 375 <= AND IF { { "H" gameBrd fY GET fX PUT "!HIT" LOCALMSG 964026982 XProp fX GET YProp fY GET ADDLOOSEPROP } { "M" gameBrd fY GET fX PUT "!MISS" LOCALMSG 964026918 XProp fX GET YProp fY GET ADDLOOSEPROP } gameBrd fY GET fX GET "~" != IFELSE deadchk EXEC shots ++ { 50 shots - ITOA " shots left" + STATUSMSG } shots 10 % 0 == IF { "You have taken to many shots, you lose" LOCALMSG 0 bship = 0 2 SETSPOTSTATE } shots 50 >= 0 bship != AND IF } { "Can't" STATUSMSG } gamebrd fY GET fX GET "[HM]" GREPSTR ! IFELSE } 1 bship == IF ENDSCRIPT ENDDOOR DOOR ID 2 DONTMOVEHERE OUTLINE 19,70 166,70 166,97 19,97 LOC 147,166 SCRIPT ON SELECT { buildBrd GLOBAL gameBrd GLOBAL setup GLOBAL bship GLOBAL ships GLOBAL shots GLOBAL { "Game is being played" LOCALMSG } { { "Building Board" STATUSMSG 4 3 SETSPOTSTATE 1 ME SETSPOTSTATE 1 bship = [ "Alive" "Alive" "Alive" "Alive " ] ships = 0 shots = buildBrd EXEC "Computer is now setting up its ships. This process can take a second or so, please be patient." LOCALMSG 4 i = { i setup EXEC i -- } { i 0 > } WHILE CLEARLOOSEPROPS } { 0 bship = 0 ME SETSPOTSTATE "Game Over!" STATUSMSG } 0 bship == IFELSE } 1 ME GETSPOTSTATE == 0 bship == AND IFELSE } ON ENTER { bship GLOBAL 0 bship = { 0 ME SETSPOTSTATE } NBRROOMUSERS 1 <= IF } ON LEAVE { bship GLOBAL { 0 ME SETSPOTSTATE } NBRROOMUSERS 1 <= 1 bship == OR IF } ENDSCRIPT ENDDOOR DOOR ID 3 DONTMOVEHERE OUTLINE 98,347 119,347 119,368 98,368 LOC 108,359 PICTS 1,0,0 2,0,0 3,0,0 4,0,0 5,0,0 ENDPICTS ENDDOOR DOOR ID 4 DONTMOVEHERE OUTLINE 19,107 166,107 166,134 19,134 LOC 147,203 SCRIPT ON ENTER { { 50 ME SETSPOTSTATE } ME GETSPOTSTATE 0 == IF 100 RANDOM yaxis = 180 yaxis += 90 yaxis SETPOS "Type \"help\" for instructions" LOCALMSG "Battleship by LoneWolf¿" STATUSMSG [ 964026918 964026982 ] SETPROPS } ON SELECT { "Best Score: " ME GETSPOTSTATE ITOA + LOCALMSG } ON OUTCHAT { { "Look in your Log Window for instructions." LOCALMSG { LOGMSG } [ "" "BATTLESHIP INSTRUCTIONS:" "" "1. Click on Start, and the computer will set up its ships." "2. Click where you would like to fire." "3. Game ends at 50 shots, or when all 4 ships are sunk." "4. Try to beat the highscore of the room!" ] FOREACH "" CHATSTR = } CHATSTR "help" == IF } ENDSCRIPT ENDDOOR DOOR ID 5 DONTMOVEHERE DEST 250 OUTLINE 7,6 63,6 63,28 7,28 LOC 33,17 PICTS 6,0,0 ENDPICTS ENDDOOR DOOR ID 6 DONTMOVEHERE DEST 278 OUTLINE 450,4 505,4 505,24 450,24 LOC 479,14 PICTS 7,0,0 ENDPICTS SCRIPT ON INCHAT { nDoIt GLOBAL nDoIt EXEC } ON ENTER { { CLEARLOOSEPROPS PAINTCLEAR } NBRROOMUSERS 2 < IF } ENDSCRIPT ENDDOOR ENDROOM