home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / game / hyperbat.sit / HyperBattleship! / background_2788.xml next >
Encoding:
Extensible Markup Language  |  1991-06-21  |  70.0 KB  |  1,327 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE background PUBLIC "-//Apple, Inc.//DTD background V 2.0//EN" "" >
  3. <background>
  4.     <id>2788</id>
  5.     <filler1>0</filler1>
  6.     <bitmap>BMAP_3694.pbm</bitmap>
  7.     <cantDelete> <true /> </cantDelete>
  8.     <showPict> <true /> </showPict>
  9.     <dontSearch> <false /> </dontSearch>
  10.     <link rel="stylesheet" type="text/css" href="stylesheet_3183.css" />
  11.     <part>
  12.         <id>1</id>
  13.         <type>field</type>
  14.         <visible> <true /> </visible>
  15.         <dontWrap> <false /> </dontWrap>
  16.         <dontSearch> <false /> </dontSearch>
  17.         <sharedText> <false /> </sharedText>
  18.         <fixedLineHeight> <true /> </fixedLineHeight>
  19.         <autoTab> <false /> </autoTab>
  20.         <lockText> <true /> </lockText>
  21.         <rect>
  22.             <left>11</left>
  23.             <top>9</top>
  24.             <right>317</right>
  25.             <bottom>309</bottom>
  26.         </rect>
  27.         <style>transparent</style>
  28.         <autoSelect> <false /> </autoSelect>
  29.         <showLines> <false /> </showLines>
  30.         <wideMargins> <false /> </wideMargins>
  31.         <multipleLines> <false /> </multipleLines>
  32.         <reservedFamily> 0 </reservedFamily>
  33.         <titleWidth>0</titleWidth>
  34.         <icon>0</icon>
  35.         <textAlign>left</textAlign>
  36.         <font>Monaco</font>
  37.         <textSize>16</textSize>
  38.         <textStyle>plain</textStyle>
  39.         <textHeight>30</textHeight>
  40.         <name>Ours</name>
  41.         <script></script>
  42.     </part>
  43.     <part>
  44.         <id>2</id>
  45.         <type>field</type>
  46.         <visible> <true /> </visible>
  47.         <dontWrap> <false /> </dontWrap>
  48.         <dontSearch> <true /> </dontSearch>
  49.         <sharedText> <false /> </sharedText>
  50.         <fixedLineHeight> <true /> </fixedLineHeight>
  51.         <autoTab> <false /> </autoTab>
  52.         <lockText> <true /> </lockText>
  53.         <rect>
  54.             <left>11</left>
  55.             <top>329</top>
  56.             <right>318</right>
  57.             <bottom>630</bottom>
  58.         </rect>
  59.         <style>transparent</style>
  60.         <autoSelect> <false /> </autoSelect>
  61.         <showLines> <false /> </showLines>
  62.         <wideMargins> <false /> </wideMargins>
  63.         <multipleLines> <false /> </multipleLines>
  64.         <reservedFamily> 0 </reservedFamily>
  65.         <titleWidth>0</titleWidth>
  66.         <icon>0</icon>
  67.         <textAlign>left</textAlign>
  68.         <font>Monaco</font>
  69.         <textSize>16</textSize>
  70.         <textStyle>plain</textStyle>
  71.         <textHeight>30</textHeight>
  72.         <name>Enemy</name>
  73.         <script>-----------------------------------------------------------------------
  74. --
  75. -- STACK: HyperBattleship  2.1   7/25/91
  76. -- ┬⌐ Copyright 1991 by Claris Corporation, All Rights Reserved
  77. -- By The HyperCard Development Team
  78. --
  79. -- HANDLERS USED IN THIS SCRIPT:
  80. -- mouseUp
  81. --
  82. -- LEGEND:
  83. -- "--Γêå" indicates strings which would need localization
  84. -----------------------------------------------------------------------
  85.  
  86. on mouseUp
  87. -- If it is our turn to make a move, fire a shot at our opponent.
  88. -- Note: A shot is fired by sending the ΓÇ£hbsMoveΓÇ¥ message to our
  89. --  opponent with AppleEvents.
  90. put hbsStatus() into curStatus
  91.  
  92. if curStatus is "Ready" then
  93. put gridItem(the clickLoc,rect of me) into gridClick
  94.  
  95. -- Compute the row and column for this grid.
  96. put gridCharLocation(gridClick) into RowColumn
  97. --
  98. -- Verify that we have not already selected this grid item.
  99. put char item 1 of RowColumn of line item 2 of RowColumn of me ┬¼
  100. into CurChar
  101. if CurChar Γëá " " and CurChar Γëá numToChar(215) then
  102. beep
  103. status "This square has already been played." --Γêå
  104. pass mouseUp
  105. end if
  106.  
  107. -- Fire shot - put temporary marker.
  108. play "ShellIncoming"
  109. put numToChar(215) into ┬¼
  110. char item 1 of RowColumn of line item 2 of RowColumn of me
  111. put myID() into SaveID
  112. --
  113. status "Shot fired. Waiting for reconnaissance." --Γêå
  114. send "hbsMove " ┬¼
  115. & quote & gridClick & quote & ", " ┬¼
  116. & quote & challengerID() & quote ┬¼
  117. & "" to program challenger()
  118. put the result into sendResult
  119. --
  120. -- In case we went somewhere, go back to where we were.
  121. showOpponentMap
  122. --
  123. -- Respond to all possible results.
  124. if sendResult is "Hit" ┬¼
  125. or sendResult is "Sunk" then
  126. animateHit gridClick, empty, "Enemy"
  127. put numToChar(165) into ┬¼
  128. char item 1 of RowColumn of line item 2 of RowColumn of me
  129. if sendResult is "Sunk" then
  130. repeat for 30 -- Play a sunk sound.
  131. play (any item of "Sunk 1,Sunk 2,Sunk 3")┬¼
  132. (any item of "rt,rt,g2s,c3t,g3x")
  133. end repeat
  134. status "You have sunk a ship." --Γêå
  135. else
  136. status "You have hit a ship." --Γêå
  137. end if
  138. if the address Γëá challenger() then
  139. status "Waiting for opponent to move.", "Status" --Γêå
  140. end if
  141.  
  142. else if sendResult is "Miss" then
  143. animateMiss gridClick, "Enemy"
  144. put numToChar(219) into ┬¼
  145. char item 1 of RowColumn of line item 2 of RowColumn of me
  146. status "You have missed." --Γêå
  147. if the address Γëá challenger() then
  148. status "Waiting for opponent to move.", "Status" --Γêå
  149. end if
  150.  
  151. else if sendResult is "End" then
  152. animateHit gridClick, empty, "Enemy"
  153. put numToChar(165) into ┬¼
  154. char item 1 of RowColumn of line item 2 of RowColumn of me
  155. repeat for 30 -- Play a sunk sound.
  156. play (any item of "Sunk 1,Sunk 2,Sunk 3") ┬¼
  157. (any item of "rt,rt,s,t,x")
  158. end repeat
  159. status "End of game.", "Status" --Γêå
  160. status "You have sunk all your opponent's ships!" --Γêå
  161. play flute tempo 190 "Bb3h D4q F Gq. De Gh Bbh C5q F4q" && ┬¼
  162. "Bbw G4h Bbq G F G A Bb4 D5e. Bb4s Fe Bb C5e. A4s Fe A Bbw"
  163. answer line random(9) of bg fld "Win"
  164. send "hbsMove " ┬¼
  165. & quote & "End" & quote & ", " ┬¼
  166. & quote & challengerID() & quote & ", " ┬¼
  167. & quote & shipLoc() & quote ┬¼
  168. & "" to program challenger()
  169. put the result into sendResult
  170.  
  171. else -- We have a problem otherwise.
  172. put " " into ┬¼
  173. char item 1 of RowColumn of line item 2 of RowColumn of me
  174. if sendResult is "Busy" then
  175. status "Opponent is not ready. They might still be placing their" ┬¼
  176. && "ships. Try again." --Γêå
  177. else --if sendResult is "Timeout" then
  178. status "The opponent did not respond. They might have quit" && ┬¼
  179. "without telling you. Try again or quit and start over." --Γêå
  180. end if
  181. pass mouseUp
  182. end if
  183.  
  184. else if curStatus is "Waiting" then
  185. status "Message: It is not your turn." --Γêå
  186. play "Ping"
  187. else if curStatus is "End" then
  188. status "The game is over." & " " ┬¼
  189. & "Click the ΓÇ£QuitΓÇ¥ button game options." --Γêå
  190. end if
  191. pass mouseUp
  192. end mouseUp
  193.  
  194. </script>
  195.     </part>
  196.     <part>
  197.         <id>3</id>
  198.         <type>field</type>
  199.         <visible> <true /> </visible>
  200.         <dontWrap> <false /> </dontWrap>
  201.         <dontSearch> <false /> </dontSearch>
  202.         <sharedText> <false /> </sharedText>
  203.         <fixedLineHeight> <false /> </fixedLineHeight>
  204.         <autoTab> <false /> </autoTab>
  205.         <lockText> <true /> </lockText>
  206.         <rect>
  207.             <left>339</left>
  208.             <top>28</top>
  209.             <right>492</right>
  210.             <bottom>126</bottom>
  211.         </rect>
  212.         <style>rectangle</style>
  213.         <autoSelect> <false /> </autoSelect>
  214.         <showLines> <false /> </showLines>
  215.         <wideMargins> <false /> </wideMargins>
  216.         <multipleLines> <false /> </multipleLines>
  217.         <reservedFamily> 0 </reservedFamily>
  218.         <titleWidth>0</titleWidth>
  219.         <icon>0</icon>
  220.         <textAlign>left</textAlign>
  221.         <font>Geneva</font>
  222.         <textSize>12</textSize>
  223.         <textStyle>plain</textStyle>
  224.         <textHeight>16</textHeight>
  225.         <name>Status</name>
  226.         <script></script>
  227.     </part>
  228.     <part>
  229.         <id>4</id>
  230.         <type>button</type>
  231.         <visible> <true /> </visible>
  232.         <reserved5> 0 </reserved5>
  233.         <reserved4> 0 </reserved4>
  234.         <reserved3> 0 </reserved3>
  235.         <reserved2> 0 </reserved2>
  236.         <reserved1> 0 </reserved1>
  237.         <enabled> <true /> </enabled>
  238.         <rect>
  239.             <left>334</left>
  240.             <top>279</top>
  241.             <right>365</right>
  242.             <bottom>310</bottom>
  243.         </rect>
  244.         <style>transparent</style>
  245.         <showName> <false /> </showName>
  246.         <highlight> <false /> </highlight>
  247.         <autoHighlight> <true /> </autoHighlight>
  248.         <sharedHighlight> <false /> </sharedHighlight>
  249.         <family>0</family>
  250.         <titleWidth>0</titleWidth>
  251.         <icon>2335</icon>
  252.         <textAlign>center</textAlign>
  253.         <font>Chicago</font>
  254.         <textSize>12</textSize>
  255.         <textStyle>plain</textStyle>
  256.         <name>Down</name>
  257.         <script>on mouseUp
  258. showOpponentMap
  259. end mouseUp</script>
  260.     </part>
  261.     <part>
  262.         <id>7</id>
  263.         <type>button</type>
  264.         <visible> <false /> </visible>
  265.         <reserved5> 0 </reserved5>
  266.         <reserved4> 0 </reserved4>
  267.         <reserved3> 0 </reserved3>
  268.         <reserved2> 0 </reserved2>
  269.         <reserved1> 0 </reserved1>
  270.         <enabled> <true /> </enabled>
  271.         <rect>
  272.             <left>134</left>
  273.             <top>249</top>
  274.             <right>164</right>
  275.             <bottom>279</bottom>
  276.         </rect>
  277.         <style>transparent</style>
  278.         <showName> <false /> </showName>
  279.         <highlight> <false /> </highlight>
  280.         <autoHighlight> <false /> </autoHighlight>
  281.         <sharedHighlight> <true /> </sharedHighlight>
  282.         <family>0</family>
  283.         <titleWidth>0</titleWidth>
  284.         <icon>5018</icon>
  285.         <textAlign>center</textAlign>
  286.         <font>Chicago</font>
  287.         <textSize>12</textSize>
  288.         <textStyle>plain</textStyle>
  289.         <name>Carrier 1 H</name>
  290.         <script>on mouseDown
  291. dragShip 1, "7,9,10,11,12", topleft of bg btn id 7 & "," ┬¼
  292. & bottomRight of bg btn id 12
  293. pass mouseDown
  294. end mouseDown</script>
  295.     </part>
  296.     <part>
  297.         <id>9</id>
  298.         <type>button</type>
  299.         <visible> <false /> </visible>
  300.         <reserved5> 0 </reserved5>
  301.         <reserved4> 0 </reserved4>
  302.         <reserved3> 0 </reserved3>
  303.         <reserved2> 0 </reserved2>
  304.         <reserved1> 0 </reserved1>
  305.         <enabled> <true /> </enabled>
  306.         <rect>
  307.             <left>164</left>
  308.             <top>249</top>
  309.             <right>194</right>
  310.             <bottom>279</bottom>
  311.         </rect>
  312.         <style>transparent</style>
  313.         <showName> <false /> </showName>
  314.         <highlight> <false /> </highlight>
  315.         <autoHighlight> <false /> </autoHighlight>
  316.         <sharedHighlight> <true /> </sharedHighlight>
  317.         <family>0</family>
  318.         <titleWidth>0</titleWidth>
  319.         <icon>5019</icon>
  320.         <textAlign>center</textAlign>
  321.         <font>Chicago</font>
  322.         <textSize>12</textSize>
  323.         <textStyle>plain</textStyle>
  324.         <name>Carrier 2</name>
  325.         <script>on mouseDown
  326. dragShip 1, "7,9,10,11,12", topleft of bg btn id 7 & "," ┬¼
  327. & bottomRight of bg btn id 12
  328. pass mouseDown
  329. end mouseDown</script>
  330.     </part>
  331.     <part>
  332.         <id>10</id>
  333.         <type>button</type>
  334.         <visible> <false /> </visible>
  335.         <reserved5> 0 </reserved5>
  336.         <reserved4> 0 </reserved4>
  337.         <reserved3> 0 </reserved3>
  338.         <reserved2> 0 </reserved2>
  339.         <reserved1> 0 </reserved1>
  340.         <enabled> <true /> </enabled>
  341.         <rect>
  342.             <left>194</left>
  343.             <top>249</top>
  344.             <right>224</right>
  345.             <bottom>279</bottom>
  346.         </rect>
  347.         <style>transparent</style>
  348.         <showName> <false /> </showName>
  349.         <highlight> <false /> </highlight>
  350.         <autoHighlight> <false /> </autoHighlight>
  351.         <sharedHighlight> <true /> </sharedHighlight>
  352.         <family>0</family>
  353.         <titleWidth>0</titleWidth>
  354.         <icon>5020</icon>
  355.         <textAlign>center</textAlign>
  356.         <font>Chicago</font>
  357.         <textSize>12</textSize>
  358.         <textStyle>plain</textStyle>
  359.         <name>Carrier 3</name>
  360.         <script>on mouseDown
  361. dragShip 1, "7,9,10,11,12", topleft of bg btn id 7 & "," ┬¼
  362. & bottomRight of bg btn id 12
  363. pass mouseDown
  364. end mouseDown</script>
  365.     </part>
  366.     <part>
  367.         <id>11</id>
  368.         <type>button</type>
  369.         <visible> <false /> </visible>
  370.         <reserved5> 0 </reserved5>
  371.         <reserved4> 0 </reserved4>
  372.         <reserved3> 0 </reserved3>
  373.         <reserved2> 0 </reserved2>
  374.         <reserved1> 0 </reserved1>
  375.         <enabled> <true /> </enabled>
  376.         <rect>
  377.             <left>224</left>
  378.             <top>249</top>
  379.             <right>254</right>
  380.             <bottom>279</bottom>
  381.         </rect>
  382.         <style>transparent</style>
  383.         <showName> <false /> </showName>
  384.         <highlight> <false /> </highlight>
  385.         <autoHighlight> <false /> </autoHighlight>
  386.         <sharedHighlight> <true /> </sharedHighlight>
  387.         <family>0</family>
  388.         <titleWidth>0</titleWidth>
  389.         <icon>5021</icon>
  390.         <textAlign>center</textAlign>
  391.         <font>Chicago</font>
  392.         <textSize>12</textSize>
  393.         <textStyle>plain</textStyle>
  394.         <name>Carrier 4</name>
  395.         <script>on mouseDown
  396. dragShip 1, "7,9,10,11,12", topleft of bg btn id 7 & "," ┬¼
  397. & bottomRight of bg btn id 12
  398. pass mouseDown
  399. end mouseDown</script>
  400.     </part>
  401.     <part>
  402.         <id>12</id>
  403.         <type>button</type>
  404.         <visible> <false /> </visible>
  405.         <reserved5> 0 </reserved5>
  406.         <reserved4> 0 </reserved4>
  407.         <reserved3> 0 </reserved3>
  408.         <reserved2> 0 </reserved2>
  409.         <reserved1> 0 </reserved1>
  410.         <enabled> <true /> </enabled>
  411.         <rect>
  412.             <left>254</left>
  413.             <top>249</top>
  414.             <right>284</right>
  415.             <bottom>279</bottom>
  416.         </rect>
  417.         <style>transparent</style>
  418.         <showName> <false /> </showName>
  419.         <highlight> <false /> </highlight>
  420.         <autoHighlight> <false /> </autoHighlight>
  421.         <sharedHighlight> <true /> </sharedHighlight>
  422.         <family>0</family>
  423.         <titleWidth>0</titleWidth>
  424.         <icon>5022</icon>
  425.         <textAlign>center</textAlign>
  426.         <font>Chicago</font>
  427.         <textSize>12</textSize>
  428.         <textStyle>plain</textStyle>
  429.         <name>Carrier 5</name>
  430.         <script>on mouseDown
  431. dragShip 1, "7,9,10,11,12", topleft of bg btn id 7 & "," ┬¼
  432. & bottomRight of bg btn id 12
  433. pass mouseDown
  434. end mouseDown</script>
  435.     </part>
  436.     <part>
  437.         <id>13</id>
  438.         <type>button</type>
  439.         <visible> <false /> </visible>
  440.         <reserved5> 0 </reserved5>
  441.         <reserved4> 0 </reserved4>
  442.         <reserved3> 0 </reserved3>
  443.         <reserved2> 0 </reserved2>
  444.         <reserved1> 0 </reserved1>
  445.         <enabled> <true /> </enabled>
  446.         <rect>
  447.             <left>44</left>
  448.             <top>159</top>
  449.             <right>74</right>
  450.             <bottom>189</bottom>
  451.         </rect>
  452.         <style>transparent</style>
  453.         <showName> <false /> </showName>
  454.         <highlight> <false /> </highlight>
  455.         <autoHighlight> <false /> </autoHighlight>
  456.         <sharedHighlight> <true /> </sharedHighlight>
  457.         <family>0</family>
  458.         <titleWidth>0</titleWidth>
  459.         <icon>5023</icon>
  460.         <textAlign>center</textAlign>
  461.         <font>Chicago</font>
  462.         <textSize>12</textSize>
  463.         <textStyle>plain</textStyle>
  464.         <name>Battleship 1 H</name>
  465.         <script>on mouseDown
  466. dragShip 2, "13,14,15,16", topleft of bg btn id 13 & "," ┬¼
  467. & bottomRight of bg btn id 16
  468. pass mouseDown
  469. end mouseDown</script>
  470.     </part>
  471.     <part>
  472.         <id>14</id>
  473.         <type>button</type>
  474.         <visible> <false /> </visible>
  475.         <reserved5> 0 </reserved5>
  476.         <reserved4> 0 </reserved4>
  477.         <reserved3> 0 </reserved3>
  478.         <reserved2> 0 </reserved2>
  479.         <reserved1> 0 </reserved1>
  480.         <enabled> <true /> </enabled>
  481.         <rect>
  482.             <left>74</left>
  483.             <top>159</top>
  484.             <right>104</right>
  485.             <bottom>189</bottom>
  486.         </rect>
  487.         <style>transparent</style>
  488.         <showName> <false /> </showName>
  489.         <highlight> <false /> </highlight>
  490.         <autoHighlight> <false /> </autoHighlight>
  491.         <sharedHighlight> <true /> </sharedHighlight>
  492.         <family>0</family>
  493.         <titleWidth>0</titleWidth>
  494.         <icon>5024</icon>
  495.         <textAlign>center</textAlign>
  496.         <font>Chicago</font>
  497.         <textSize>12</textSize>
  498.         <textStyle>plain</textStyle>
  499.         <name>Battleship 2</name>
  500.         <script>on mouseDown
  501. dragShip 2, "13,14,15,16", topleft of bg btn id 13 & "," ┬¼
  502. & bottomRight of bg btn id 16
  503. pass mouseDown
  504. end mouseDown</script>
  505.     </part>
  506.     <part>
  507.         <id>15</id>
  508.         <type>button</type>
  509.         <visible> <false /> </visible>
  510.         <reserved5> 0 </reserved5>
  511.         <reserved4> 0 </reserved4>
  512.         <reserved3> 0 </reserved3>
  513.         <reserved2> 0 </reserved2>
  514.         <reserved1> 0 </reserved1>
  515.         <enabled> <true /> </enabled>
  516.         <rect>
  517.             <left>104</left>
  518.             <top>159</top>
  519.             <right>134</right>
  520.             <bottom>189</bottom>
  521.         </rect>
  522.         <style>transparent</style>
  523.         <showName> <false /> </showName>
  524.         <highlight> <false /> </highlight>
  525.         <autoHighlight> <false /> </autoHighlight>
  526.         <sharedHighlight> <true /> </sharedHighlight>
  527.         <family>0</family>
  528.         <titleWidth>0</titleWidth>
  529.         <icon>5025</icon>
  530.         <textAlign>center</textAlign>
  531.         <font>Chicago</font>
  532.         <textSize>12</textSize>
  533.         <textStyle>plain</textStyle>
  534.         <name>Battleship 3</name>
  535.         <script>on mouseDown
  536. dragShip 2, "13,14,15,16", topleft of bg btn id 13 & "," ┬¼
  537. & bottomRight of bg btn id 16
  538. pass mouseDown
  539. end mouseDown</script>
  540.     </part>
  541.     <part>
  542.         <id>16</id>
  543.         <type>button</type>
  544.         <visible> <false /> </visible>
  545.         <reserved5> 0 </reserved5>
  546.         <reserved4> 0 </reserved4>
  547.         <reserved3> 0 </reserved3>
  548.         <reserved2> 0 </reserved2>
  549.         <reserved1> 0 </reserved1>
  550.         <enabled> <true /> </enabled>
  551.         <rect>
  552.             <left>134</left>
  553.             <top>159</top>
  554.             <right>164</right>
  555.             <bottom>189</bottom>
  556.         </rect>
  557.         <style>transparent</style>
  558.         <showName> <false /> </showName>
  559.         <highlight> <false /> </highlight>
  560.         <autoHighlight> <false /> </autoHighlight>
  561.         <sharedHighlight> <true /> </sharedHighlight>
  562.         <family>0</family>
  563.         <titleWidth>0</titleWidth>
  564.         <icon>5026</icon>
  565.         <textAlign>center</textAlign>
  566.         <font>Chicago</font>
  567.         <textSize>12</textSize>
  568.         <textStyle>plain</textStyle>
  569.         <name>Battleship 4</name>
  570.         <script>on mouseDown
  571. dragShip 2, "13,14,15,16", topleft of bg btn id 13 & "," ┬¼
  572. & bottomRight of bg btn id 16
  573. pass mouseDown
  574. end mouseDown</script>
  575.     </part>
  576.     <part>
  577.         <id>17</id>
  578.         <type>button</type>
  579.         <visible> <false /> </visible>
  580.         <reserved5> 0 </reserved5>
  581.         <reserved4> 0 </reserved4>
  582.         <reserved3> 0 </reserved3>
  583.         <reserved2> 0 </reserved2>
  584.         <reserved1> 0 </reserved1>
  585.         <enabled> <true /> </enabled>
  586.         <rect>
  587.             <left>194</left>
  588.             <top>159</top>
  589.             <right>224</right>
  590.             <bottom>189</bottom>
  591.         </rect>
  592.         <style>transparent</style>
  593.         <showName> <false /> </showName>
  594.         <highlight> <false /> </highlight>
  595.         <autoHighlight> <false /> </autoHighlight>
  596.         <sharedHighlight> <true /> </sharedHighlight>
  597.         <family>0</family>
  598.         <titleWidth>0</titleWidth>
  599.         <icon>5027</icon>
  600.         <textAlign>center</textAlign>
  601.         <font>Chicago</font>
  602.         <textSize>12</textSize>
  603.         <textStyle>plain</textStyle>
  604.         <name>Destroyer 1 H</name>
  605.         <script>on mouseDown
  606. dragShip 3, "17,19,20", topleft of bg btn id 17 & "," ┬¼
  607. & bottomRight of bg btn id 20
  608. pass mouseDown
  609. end mouseDown</script>
  610.     </part>
  611.     <part>
  612.         <id>19</id>
  613.         <type>button</type>
  614.         <visible> <false /> </visible>
  615.         <reserved5> 0 </reserved5>
  616.         <reserved4> 0 </reserved4>
  617.         <reserved3> 0 </reserved3>
  618.         <reserved2> 0 </reserved2>
  619.         <reserved1> 0 </reserved1>
  620.         <enabled> <true /> </enabled>
  621.         <rect>
  622.             <left>224</left>
  623.             <top>159</top>
  624.             <right>254</right>
  625.             <bottom>189</bottom>
  626.         </rect>
  627.         <style>transparent</style>
  628.         <showName> <false /> </showName>
  629.         <highlight> <false /> </highlight>
  630.         <autoHighlight> <false /> </autoHighlight>
  631.         <sharedHighlight> <true /> </sharedHighlight>
  632.         <family>0</family>
  633.         <titleWidth>0</titleWidth>
  634.         <icon>5028</icon>
  635.         <textAlign>center</textAlign>
  636.         <font>Chicago</font>
  637.         <textSize>12</textSize>
  638.         <textStyle>plain</textStyle>
  639.         <name>Destroyer 2</name>
  640.         <script>on mouseDown
  641. dragShip 3, "17,19,20", topleft of bg btn id 17 & "," ┬¼
  642. & bottomRight of bg btn id 20
  643. pass mouseDown
  644. end mouseDown</script>
  645.     </part>
  646.     <part>
  647.         <id>20</id>
  648.         <type>button</type>
  649.         <visible> <false /> </visible>
  650.         <reserved5> 0 </reserved5>
  651.         <reserved4> 0 </reserved4>
  652.         <reserved3> 0 </reserved3>
  653.         <reserved2> 0 </reserved2>
  654.         <reserved1> 0 </reserved1>
  655.         <enabled> <true /> </enabled>
  656.         <rect>
  657.             <left>254</left>
  658.             <top>159</top>
  659.             <right>284</right>
  660.             <bottom>189</bottom>
  661.         </rect>
  662.         <style>transparent</style>
  663.         <showName> <false /> </showName>
  664.         <highlight> <false /> </highlight>
  665.         <autoHighlight> <false /> </autoHighlight>
  666.         <sharedHighlight> <true /> </sharedHighlight>
  667.         <family>0</family>
  668.         <titleWidth>0</titleWidth>
  669.         <icon>5029</icon>
  670.         <textAlign>center</textAlign>
  671.         <font>Chicago</font>
  672.         <textSize>12</textSize>
  673.         <textStyle>plain</textStyle>
  674.         <name>Destroyer 3</name>
  675.         <script>on mouseDown
  676. dragShip 3, "17,19,20", topleft of bg btn id 17 & "," ┬¼
  677. & bottomRight of bg btn id 20
  678. pass mouseDown
  679. end mouseDown</script>
  680.     </part>
  681.     <part>
  682.         <id>21</id>
  683.         <type>button</type>
  684.         <visible> <false /> </visible>
  685.         <reserved5> 0 </reserved5>
  686.         <reserved4> 0 </reserved4>
  687.         <reserved3> 0 </reserved3>
  688.         <reserved2> 0 </reserved2>
  689.         <reserved1> 0 </reserved1>
  690.         <enabled> <true /> </enabled>
  691.         <rect>
  692.             <left>194</left>
  693.             <top>99</top>
  694.             <right>224</right>
  695.             <bottom>129</bottom>
  696.         </rect>
  697.         <style>transparent</style>
  698.         <showName> <false /> </showName>
  699.         <highlight> <false /> </highlight>
  700.         <autoHighlight> <false /> </autoHighlight>
  701.         <sharedHighlight> <true /> </sharedHighlight>
  702.         <family>0</family>
  703.         <titleWidth>0</titleWidth>
  704.         <icon>5030</icon>
  705.         <textAlign>center</textAlign>
  706.         <font>Chicago</font>
  707.         <textSize>12</textSize>
  708.         <textStyle>plain</textStyle>
  709.         <name>Submarine 1 H</name>
  710.         <script>on mouseDown
  711. dragShip 4, "21,22,23", topleft of bg btn id 21 & "," ┬¼
  712. & bottomRight of bg btn id 23
  713. pass mouseDown
  714. end mouseDown</script>
  715.     </part>
  716.     <part>
  717.         <id>22</id>
  718.         <type>button</type>
  719.         <visible> <false /> </visible>
  720.         <reserved5> 0 </reserved5>
  721.         <reserved4> 0 </reserved4>
  722.         <reserved3> 0 </reserved3>
  723.         <reserved2> 0 </reserved2>
  724.         <reserved1> 0 </reserved1>
  725.         <enabled> <true /> </enabled>
  726.         <rect>
  727.             <left>224</left>
  728.             <top>99</top>
  729.             <right>254</right>
  730.             <bottom>129</bottom>
  731.         </rect>
  732.         <style>transparent</style>
  733.         <showName> <false /> </showName>
  734.         <highlight> <false /> </highlight>
  735.         <autoHighlight> <false /> </autoHighlight>
  736.         <sharedHighlight> <true /> </sharedHighlight>
  737.         <family>0</family>
  738.         <titleWidth>0</titleWidth>
  739.         <icon>5031</icon>
  740.         <textAlign>center</textAlign>
  741.         <font>Chicago</font>
  742.         <textSize>12</textSize>
  743.         <textStyle>plain</textStyle>
  744.         <name>Submarine 2</name>
  745.         <script>on mouseDown
  746. dragShip 4, "21,22,23", topleft of bg btn id 21 & "," ┬¼
  747. & bottomRight of bg btn id 23
  748. pass mouseDown
  749. end mouseDown</script>
  750.     </part>
  751.     <part>
  752.         <id>23</id>
  753.         <type>button</type>
  754.         <visible> <false /> </visible>
  755.         <reserved5> 0 </reserved5>
  756.         <reserved4> 0 </reserved4>
  757.         <reserved3> 0 </reserved3>
  758.         <reserved2> 0 </reserved2>
  759.         <reserved1> 0 </reserved1>
  760.         <enabled> <true /> </enabled>
  761.         <rect>
  762.             <left>254</left>
  763.             <top>99</top>
  764.             <right>284</right>
  765.             <bottom>129</bottom>
  766.         </rect>
  767.         <style>transparent</style>
  768.         <showName> <false /> </showName>
  769.         <highlight> <false /> </highlight>
  770.         <autoHighlight> <false /> </autoHighlight>
  771.         <sharedHighlight> <true /> </sharedHighlight>
  772.         <family>0</family>
  773.         <titleWidth>0</titleWidth>
  774.         <icon>5032</icon>
  775.         <textAlign>center</textAlign>
  776.         <font>Chicago</font>
  777.         <textSize>12</textSize>
  778.         <textStyle>plain</textStyle>
  779.         <name>Submarine 3</name>
  780.         <script>on mouseDown
  781. dragShip 4, "21,22,23", topleft of bg btn id 21 & "," ┬¼
  782. & bottomRight of bg btn id 23
  783. pass mouseDown
  784. end mouseDown</script>
  785.     </part>
  786.     <part>
  787.         <id>26</id>
  788.         <type>button</type>
  789.         <visible> <false /> </visible>
  790.         <reserved5> 0 </reserved5>
  791.         <reserved4> 0 </reserved4>
  792.         <reserved3> 0 </reserved3>
  793.         <reserved2> 0 </reserved2>
  794.         <reserved1> 0 </reserved1>
  795.         <enabled> <true /> </enabled>
  796.         <rect>
  797.             <left>134</left>
  798.             <top>69</top>
  799.             <right>164</right>
  800.             <bottom>99</bottom>
  801.         </rect>
  802.         <style>transparent</style>
  803.         <showName> <false /> </showName>
  804.         <highlight> <false /> </highlight>
  805.         <autoHighlight> <false /> </autoHighlight>
  806.         <sharedHighlight> <true /> </sharedHighlight>
  807.         <family>0</family>
  808.         <titleWidth>0</titleWidth>
  809.         <icon>5033</icon>
  810.         <textAlign>center</textAlign>
  811.         <font>Chicago</font>
  812.         <textSize>12</textSize>
  813.         <textStyle>plain</textStyle>
  814.         <name>Patrol 1 H</name>
  815.         <script>on mouseDown
  816. dragShip 5, "26,27", topleft of bg btn id 26 & "," ┬¼
  817. & bottomRight of bg btn id 27
  818. pass mouseDown
  819. end mouseDown</script>
  820.     </part>
  821.     <part>
  822.         <id>27</id>
  823.         <type>button</type>
  824.         <visible> <false /> </visible>
  825.         <reserved5> 0 </reserved5>
  826.         <reserved4> 0 </reserved4>
  827.         <reserved3> 0 </reserved3>
  828.         <reserved2> 0 </reserved2>
  829.         <reserved1> 0 </reserved1>
  830.         <enabled> <true /> </enabled>
  831.         <rect>
  832.             <left>164</left>
  833.             <top>69</top>
  834.             <right>194</right>
  835.             <bottom>99</bottom>
  836.         </rect>
  837.         <style>transparent</style>
  838.         <showName> <false /> </showName>
  839.         <highlight> <false /> </highlight>
  840.         <autoHighlight> <false /> </autoHighlight>
  841.         <sharedHighlight> <true /> </sharedHighlight>
  842.         <family>0</family>
  843.         <titleWidth>0</titleWidth>
  844.         <icon>5034</icon>
  845.         <textAlign>center</textAlign>
  846.         <font>Chicago</font>
  847.         <textSize>12</textSize>
  848.         <textStyle>plain</textStyle>
  849.         <name>Patrol 2</name>
  850.         <script>on mouseDown
  851. dragShip 5, "26,27", topleft of bg btn id 26 & "," ┬¼
  852. & bottomRight of bg btn id 27
  853. pass mouseDown
  854. end mouseDown</script>
  855.     </part>
  856.     <part>
  857.         <id>28</id>
  858.         <type>field</type>
  859.         <visible> <true /> </visible>
  860.         <dontWrap> <false /> </dontWrap>
  861.         <dontSearch> <true /> </dontSearch>
  862.         <sharedText> <false /> </sharedText>
  863.         <fixedLineHeight> <false /> </fixedLineHeight>
  864.         <autoTab> <false /> </autoTab>
  865.         <lockText> <true /> </lockText>
  866.         <rect>
  867.             <left>339</left>
  868.             <top>547</top>
  869.             <right>492</right>
  870.             <bottom>597</bottom>
  871.         </rect>
  872.         <style>rectangle</style>
  873.         <autoSelect> <false /> </autoSelect>
  874.         <showLines> <false /> </showLines>
  875.         <wideMargins> <false /> </wideMargins>
  876.         <multipleLines> <false /> </multipleLines>
  877.         <reservedFamily> 0 </reservedFamily>
  878.         <titleWidth>0</titleWidth>
  879.         <icon>0</icon>
  880.         <textAlign>left</textAlign>
  881.         <font>Geneva</font>
  882.         <textSize>12</textSize>
  883.         <textStyle>plain</textStyle>
  884.         <textHeight>16</textHeight>
  885.         <name>Challenger</name>
  886.         <script>
  887. </script>
  888.     </part>
  889.     <part>
  890.         <id>29</id>
  891.         <type>field</type>
  892.         <visible> <false /> </visible>
  893.         <dontWrap> <false /> </dontWrap>
  894.         <dontSearch> <false /> </dontSearch>
  895.         <sharedText> <false /> </sharedText>
  896.         <fixedLineHeight> <false /> </fixedLineHeight>
  897.         <autoTab> <false /> </autoTab>
  898.         <lockText> <true /> </lockText>
  899.         <rect>
  900.             <left>467</left>
  901.             <top>635</top>
  902.             <right>512</right>
  903.             <bottom>640</bottom>
  904.         </rect>
  905.         <style>transparent</style>
  906.         <autoSelect> <false /> </autoSelect>
  907.         <showLines> <false /> </showLines>
  908.         <wideMargins> <false /> </wideMargins>
  909.         <multipleLines> <false /> </multipleLines>
  910.         <reservedFamily> 0 </reservedFamily>
  911.         <titleWidth>0</titleWidth>
  912.         <icon>0</icon>
  913.         <textAlign>left</textAlign>
  914.         <font>Geneva</font>
  915.         <textSize>4</textSize>
  916.         <textStyle>plain</textStyle>
  917.         <textHeight>5</textHeight>
  918.         <name>Challenger ID</name>
  919.         <script></script>
  920.     </part>
  921.     <part>
  922.         <id>30</id>
  923.         <type>field</type>
  924.         <visible> <true /> </visible>
  925.         <dontWrap> <false /> </dontWrap>
  926.         <dontSearch> <true /> </dontSearch>
  927.         <sharedText> <false /> </sharedText>
  928.         <fixedLineHeight> <false /> </fixedLineHeight>
  929.         <autoTab> <false /> </autoTab>
  930.         <lockText> <true /> </lockText>
  931.         <rect>
  932.             <left>339</left>
  933.             <top>348</top>
  934.             <right>492</right>
  935.             <bottom>446</bottom>
  936.         </rect>
  937.         <style>rectangle</style>
  938.         <autoSelect> <false /> </autoSelect>
  939.         <showLines> <false /> </showLines>
  940.         <wideMargins> <false /> </wideMargins>
  941.         <multipleLines> <false /> </multipleLines>
  942.         <reservedFamily> 0 </reservedFamily>
  943.         <titleWidth>0</titleWidth>
  944.         <icon>0</icon>
  945.         <textAlign>left</textAlign>
  946.         <font>Geneva</font>
  947.         <textSize>12</textSize>
  948.         <textStyle>plain</textStyle>
  949.         <textHeight>16</textHeight>
  950.         <name>Status 2</name>
  951.         <script></script>
  952.     </part>
  953.     <part>
  954.         <id>31</id>
  955.         <type>field</type>
  956.         <visible> <false /> </visible>
  957.         <dontWrap> <false /> </dontWrap>
  958.         <dontSearch> <false /> </dontSearch>
  959.         <sharedText> <false /> </sharedText>
  960.         <fixedLineHeight> <false /> </fixedLineHeight>
  961.         <autoTab> <false /> </autoTab>
  962.         <lockText> <true /> </lockText>
  963.         <rect>
  964.             <left>447</left>
  965.             <top>0</top>
  966.             <right>512</right>
  967.             <bottom>5</bottom>
  968.         </rect>
  969.         <style>transparent</style>
  970.         <autoSelect> <false /> </autoSelect>
  971.         <showLines> <false /> </showLines>
  972.         <wideMargins> <false /> </wideMargins>
  973.         <multipleLines> <false /> </multipleLines>
  974.         <reservedFamily> 0 </reservedFamily>
  975.         <titleWidth>0</titleWidth>
  976.         <icon>0</icon>
  977.         <textAlign>right</textAlign>
  978.         <font>Geneva</font>
  979.         <textSize>4</textSize>
  980.         <textStyle>plain</textStyle>
  981.         <textHeight>5</textHeight>
  982.         <name>Date</name>
  983.         <script></script>
  984.     </part>
  985.     <part>
  986.         <id>33</id>
  987.         <type>button</type>
  988.         <visible> <false /> </visible>
  989.         <reserved5> 0 </reserved5>
  990.         <reserved4> 0 </reserved4>
  991.         <reserved3> 0 </reserved3>
  992.         <reserved2> 0 </reserved2>
  993.         <reserved1> 0 </reserved1>
  994.         <enabled> <true /> </enabled>
  995.         <rect>
  996.             <left>164</left>
  997.             <top>479</top>
  998.             <right>194</right>
  999.             <bottom>509</bottom>
  1000.         </rect>
  1001.         <style>transparent</style>
  1002.         <showName> <false /> </showName>
  1003.         <highlight> <false /> </highlight>
  1004.         <autoHighlight> <false /> </autoHighlight>
  1005.         <sharedHighlight> <false /> </sharedHighlight>
  1006.         <family>0</family>
  1007.         <titleWidth>0</titleWidth>
  1008.         <icon>7004</icon>
  1009.         <textAlign>center</textAlign>
  1010.         <font>Chicago</font>
  1011.         <textSize>12</textSize>
  1012.         <textStyle>plain</textStyle>
  1013.         <name>Animation</name>
  1014.         <script></script>
  1015.     </part>
  1016.     <part>
  1017.         <id>34</id>
  1018.         <type>button</type>
  1019.         <visible> <true /> </visible>
  1020.         <reserved5> 0 </reserved5>
  1021.         <reserved4> 0 </reserved4>
  1022.         <reserved3> 0 </reserved3>
  1023.         <reserved2> 0 </reserved2>
  1024.         <reserved1> 0 </reserved1>
  1025.         <enabled> <true /> </enabled>
  1026.         <rect>
  1027.             <left>339</left>
  1028.             <top>159</top>
  1029.             <right>493</right>
  1030.             <bottom>181</bottom>
  1031.         </rect>
  1032.         <style>shadow</style>
  1033.         <showName> <true /> </showName>
  1034.         <highlight> <false /> </highlight>
  1035.         <autoHighlight> <true /> </autoHighlight>
  1036.         <sharedHighlight> <false /> </sharedHighlight>
  1037.         <family>0</family>
  1038.         <titleWidth>0</titleWidth>
  1039.         <icon>0</icon>
  1040.         <textAlign>center</textAlign>
  1041.         <font>Chicago</font>
  1042.         <textSize>12</textSize>
  1043.         <textStyle>plain</textStyle>
  1044.         <name>Choose Opponent</name>
  1045.         <script>on mouseUp
  1046. chooseOpponent
  1047. end mouseUp</script>
  1048.     </part>
  1049.     <part>
  1050.         <id>35</id>
  1051.         <type>field</type>
  1052.         <visible> <true /> </visible>
  1053.         <dontWrap> <false /> </dontWrap>
  1054.         <dontSearch> <false /> </dontSearch>
  1055.         <sharedText> <true /> </sharedText>
  1056.         <fixedLineHeight> <false /> </fixedLineHeight>
  1057.         <autoTab> <false /> </autoTab>
  1058.         <lockText> <true /> </lockText>
  1059.         <rect>
  1060.             <left>335</left>
  1061.             <top>11</top>
  1062.             <right>409</right>
  1063.             <bottom>26</bottom>
  1064.         </rect>
  1065.         <style>transparent</style>
  1066.         <autoSelect> <false /> </autoSelect>
  1067.         <showLines> <false /> </showLines>
  1068.         <wideMargins> <false /> </wideMargins>
  1069.         <multipleLines> <false /> </multipleLines>
  1070.         <reservedFamily> 0 </reservedFamily>
  1071.         <titleWidth>0</titleWidth>
  1072.         <icon>0</icon>
  1073.         <textAlign>left</textAlign>
  1074.         <font>Chicago</font>
  1075.         <textSize>12</textSize>
  1076.         <textStyle>plain</textStyle>
  1077.         <textHeight>16</textHeight>
  1078.         <name>Status Title</name>
  1079.         <script></script>
  1080.     </part>
  1081.     <part>
  1082.         <id>36</id>
  1083.         <type>field</type>
  1084.         <visible> <true /> </visible>
  1085.         <dontWrap> <false /> </dontWrap>
  1086.         <dontSearch> <false /> </dontSearch>
  1087.         <sharedText> <true /> </sharedText>
  1088.         <fixedLineHeight> <false /> </fixedLineHeight>
  1089.         <autoTab> <false /> </autoTab>
  1090.         <lockText> <true /> </lockText>
  1091.         <rect>
  1092.             <left>354</left>
  1093.             <top>236</top>
  1094.             <right>470</right>
  1095.             <bottom>256</bottom>
  1096.         </rect>
  1097.         <style>opaque</style>
  1098.         <autoSelect> <false /> </autoSelect>
  1099.         <showLines> <false /> </showLines>
  1100.         <wideMargins> <false /> </wideMargins>
  1101.         <multipleLines> <false /> </multipleLines>
  1102.         <reservedFamily> 0 </reservedFamily>
  1103.         <titleWidth>0</titleWidth>
  1104.         <icon>0</icon>
  1105.         <textAlign>left</textAlign>
  1106.         <font>Times</font>
  1107.         <textSize>18</textSize>
  1108.         <textStyle>italic</textStyle>
  1109.         <textStyle>bold</textStyle>
  1110.         <textHeight>24</textHeight>
  1111.         <name>Our Screen Title</name>
  1112.         <script></script>
  1113.     </part>
  1114.     <part>
  1115.         <id>37</id>
  1116.         <type>button</type>
  1117.         <visible> <true /> </visible>
  1118.         <reserved5> 0 </reserved5>
  1119.         <reserved4> 0 </reserved4>
  1120.         <reserved3> 0 </reserved3>
  1121.         <reserved2> 0 </reserved2>
  1122.         <reserved1> 0 </reserved1>
  1123.         <enabled> <true /> </enabled>
  1124.         <rect>
  1125.             <left>466</left>
  1126.             <top>279</top>
  1127.             <right>496</right>
  1128.             <bottom>311</bottom>
  1129.         </rect>
  1130.         <style>opaque</style>
  1131.         <showName> <false /> </showName>
  1132.         <highlight> <false /> </highlight>
  1133.         <autoHighlight> <true /> </autoHighlight>
  1134.         <sharedHighlight> <true /> </sharedHighlight>
  1135.         <family>0</family>
  1136.         <titleWidth>0</titleWidth>
  1137.         <icon>17264</icon>
  1138.         <textAlign>center</textAlign>
  1139.         <font>Chicago</font>
  1140.         <textSize>12</textSize>
  1141.         <textStyle>plain</textStyle>
  1142.         <name>Help!</name>
  1143.         <script>on mouseUp
  1144. help
  1145. end mouseUp</script>
  1146.     </part>
  1147.     <part>
  1148.         <id>38</id>
  1149.         <type>button</type>
  1150.         <visible> <false /> </visible>
  1151.         <reserved5> 0 </reserved5>
  1152.         <reserved4> 0 </reserved4>
  1153.         <reserved3> 0 </reserved3>
  1154.         <reserved2> 0 </reserved2>
  1155.         <reserved1> 0 </reserved1>
  1156.         <enabled> <true /> </enabled>
  1157.         <rect>
  1158.             <left>339</left>
  1159.             <top>186</top>
  1160.             <right>493</right>
  1161.             <bottom>208</bottom>
  1162.         </rect>
  1163.         <style>shadow</style>
  1164.         <showName> <true /> </showName>
  1165.         <highlight> <false /> </highlight>
  1166.         <autoHighlight> <true /> </autoHighlight>
  1167.         <sharedHighlight> <false /> </sharedHighlight>
  1168.         <family>0</family>
  1169.         <titleWidth>0</titleWidth>
  1170.         <icon>0</icon>
  1171.         <textAlign>center</textAlign>
  1172.         <font>Chicago</font>
  1173.         <textSize>12</textSize>
  1174.         <textStyle>plain</textStyle>
  1175.         <name>Place Ships</name>
  1176.         <script>on mouseUp
  1177. placeShips
  1178. end mouseUp</script>
  1179.     </part>
  1180.     <part>
  1181.         <id>40</id>
  1182.         <type>button</type>
  1183.         <visible> <true /> </visible>
  1184.         <reserved5> 0 </reserved5>
  1185.         <reserved4> 0 </reserved4>
  1186.         <reserved3> 0 </reserved3>
  1187.         <reserved2> 0 </reserved2>
  1188.         <reserved1> 0 </reserved1>
  1189.         <enabled> <true /> </enabled>
  1190.         <rect>
  1191.             <left>333</left>
  1192.             <top>598</top>
  1193.             <right>366</right>
  1194.             <bottom>630</bottom>
  1195.         </rect>
  1196.         <style>transparent</style>
  1197.         <showName> <false /> </showName>
  1198.         <highlight> <false /> </highlight>
  1199.         <autoHighlight> <true /> </autoHighlight>
  1200.         <sharedHighlight> <true /> </sharedHighlight>
  1201.         <family>0</family>
  1202.         <titleWidth>0</titleWidth>
  1203.         <icon>32488</icon>
  1204.         <textAlign>center</textAlign>
  1205.         <font>Chicago</font>
  1206.         <textSize>12</textSize>
  1207.         <textStyle>plain</textStyle>
  1208.         <name>Up</name>
  1209.         <script>on mouseUp
  1210. showYourMap
  1211. pass mouseUp
  1212. end mouseUp</script>
  1213.     </part>
  1214.     <part>
  1215.         <id>41</id>
  1216.         <type>button</type>
  1217.         <visible> <true /> </visible>
  1218.         <reserved5> 0 </reserved5>
  1219.         <reserved4> 0 </reserved4>
  1220.         <reserved3> 0 </reserved3>
  1221.         <reserved2> 0 </reserved2>
  1222.         <reserved1> 0 </reserved1>
  1223.         <enabled> <true /> </enabled>
  1224.         <rect>
  1225.             <left>465</left>
  1226.             <top>598</top>
  1227.             <right>495</right>
  1228.             <bottom>629</bottom>
  1229.         </rect>
  1230.         <style>opaque</style>
  1231.         <showName> <false /> </showName>
  1232.         <highlight> <false /> </highlight>
  1233.         <autoHighlight> <true /> </autoHighlight>
  1234.         <sharedHighlight> <true /> </sharedHighlight>
  1235.         <family>0</family>
  1236.         <titleWidth>0</titleWidth>
  1237.         <icon>17264</icon>
  1238.         <textAlign>center</textAlign>
  1239.         <font>Chicago</font>
  1240.         <textSize>12</textSize>
  1241.         <textStyle>plain</textStyle>
  1242.         <name>Help!</name>
  1243.         <script>on mouseUp
  1244. help
  1245. end mouseUp</script>
  1246.     </part>
  1247.     <part>
  1248.         <id>32</id>
  1249.         <type>button</type>
  1250.         <visible> <false /> </visible>
  1251.         <reserved5> 0 </reserved5>
  1252.         <reserved4> 0 </reserved4>
  1253.         <reserved3> 0 </reserved3>
  1254.         <reserved2> 0 </reserved2>
  1255.         <reserved1> 0 </reserved1>
  1256.         <enabled> <true /> </enabled>
  1257.         <rect>
  1258.             <left>335</left>
  1259.             <top>282</top>
  1260.             <right>496</right>
  1261.             <bottom>311</bottom>
  1262.         </rect>
  1263.         <style>shadow</style>
  1264.         <showName> <true /> </showName>
  1265.         <highlight> <false /> </highlight>
  1266.         <autoHighlight> <true /> </autoHighlight>
  1267.         <sharedHighlight> <true /> </sharedHighlight>
  1268.         <family>0</family>
  1269.         <titleWidth>0</titleWidth>
  1270.         <icon>0</icon>
  1271.         <textAlign>center</textAlign>
  1272.         <font>Geneva</font>
  1273.         <textSize>18</textSize>
  1274.         <textStyle>condense</textStyle>
  1275.         <textStyle>bold</textStyle>
  1276.         <name>Ready!</name>
  1277.         <script>-----------------------------------------------------------------------
  1278. --
  1279. -- STACK: HyperBattleship  2.1   7/25/91
  1280. -- ┬⌐ Copyright 1991 by Claris Corporation, All Rights Reserved
  1281. -- By The HyperCard Development Team
  1282. --
  1283. -- HANDLERS USED IN THIS SCRIPT:
  1284. -- mouseUp, saveLocations
  1285. --
  1286. -- LEGEND:
  1287. -- "--Γêå" indicates strings which would need localization
  1288. -----------------------------------------------------------------------
  1289.  
  1290. on mouseUp
  1291. -- If all the ships are placed upon the board.
  1292. --  save their locations to be compared later.
  1293. if there is a window "Your Ships" then hide window "Your Ships"
  1294. --
  1295. saveLocations -- Attempt to save the ship locations.
  1296. if the result is empty then -- We have successfully saved locations.
  1297. hide bg btn "Place Ships"
  1298. hide me
  1299. status "Ships placed correctly." --Γêå
  1300. setStatus
  1301. disable menuItem 1 of menu "HyperBattleship!"
  1302. disable menuItem 2 of menu "HyperBattleship!"
  1303. if there is a window "Your Ships"
  1304. then
  1305. close window "Your Ships"
  1306. end if
  1307. else
  1308. if there is a window "Your Ships" then show window "Your Ships"
  1309. end if
  1310. pass mouseUp
  1311. end mouseUp
  1312.  
  1313. on saveLocations
  1314. -- Save all the ship locations so that we can play a game.
  1315. -- Notes: The format of the SaveList is:
  1316. --  "┬½Grid Loc┬╗ ┬½Btn ID┬╗ ┬½Btn TopLeft┬╗ ┬½Btn Icon ID┬╗ ┬½Btn ID List┬╗ ;"
  1317. --  This list is current stored in line 11 of the bg fld "Ours".
  1318. --
  1319. put empty into SaveList -- Reset current values.
  1320. --
  1321. put rect of bg fld "Ours" into BoardRect -- Get the current board rect.
  1322. --
  1323. -- Step through the list of ships and save all the ship information.
  1324. repeat with ShipNum = 1 to 5
  1325. -- Get the list of all ships and save their locations.
  1326. do "put ship" & ShipNum & "() into ShipList"
  1327. repeat with ShipPart = 1 to number of items in ShipList
  1328. set cursor to busy
  1329. put "bg btn id " & item ShipPart of ShipList into CurrentShip
  1330. put loc of CurrentShip into CurShipLoc
  1331. --
  1332. -- Verify that the ship is placed correctly.
  1333. if CurShipLoc is not within BoardRect ┬¼
  1334. or not visible of CurrentShip then
  1335. status "Place all ships completely within game board before continuing.", "Alert" --Γêå
  1336. return "Ship not placed."
  1337. end if
  1338. put gridItem(CurShipLoc, BoardRect) into CurItem
  1339. if offset(CurItem & " ",SaveList) Γëá 0 then
  1340. status "Ships can not be placed on top of other ships.", "Alert" --Γêå
  1341. return "Ship incorrectly placed."
  1342. end if
  1343. -- Save the formatted list of ship information.
  1344. put CurItem && short id of CurrentShip && topLeft of CurrentShip ┬¼
  1345. && icon of CurrentShip && ShipList & " ;" after SaveList
  1346. end repeat
  1347. end repeat
  1348. -- Save these lists into the currently defined location.
  1349. put SaveList into line 11 of bg fld "Ours"
  1350. end saveLocations
  1351. </script>
  1352.     </part>
  1353.     <part>
  1354.         <id>43</id>
  1355.         <type>field</type>
  1356.         <visible> <true /> </visible>
  1357.         <dontWrap> <false /> </dontWrap>
  1358.         <dontSearch> <false /> </dontSearch>
  1359.         <sharedText> <true /> </sharedText>
  1360.         <fixedLineHeight> <false /> </fixedLineHeight>
  1361.         <autoTab> <false /> </autoTab>
  1362.         <lockText> <true /> </lockText>
  1363.         <rect>
  1364.             <left>334</left>
  1365.             <top>530</top>
  1366.             <right>455</right>
  1367.             <bottom>547</bottom>
  1368.         </rect>
  1369.         <style>transparent</style>
  1370.         <autoSelect> <false /> </autoSelect>
  1371.         <showLines> <false /> </showLines>
  1372.         <wideMargins> <false /> </wideMargins>
  1373.         <multipleLines> <false /> </multipleLines>
  1374.         <reservedFamily> 0 </reservedFamily>
  1375.         <titleWidth>0</titleWidth>
  1376.         <icon>0</icon>
  1377.         <textAlign>left</textAlign>
  1378.         <font>Chicago</font>
  1379.         <textSize>12</textSize>
  1380.         <textStyle>plain</textStyle>
  1381.         <textHeight>16</textHeight>
  1382.         <name></name>
  1383.         <script></script>
  1384.     </part>
  1385.     <part>
  1386.         <id>44</id>
  1387.         <type>field</type>
  1388.         <visible> <true /> </visible>
  1389.         <dontWrap> <false /> </dontWrap>
  1390.         <dontSearch> <true /> </dontSearch>
  1391.         <sharedText> <true /> </sharedText>
  1392.         <fixedLineHeight> <false /> </fixedLineHeight>
  1393.         <autoTab> <false /> </autoTab>
  1394.         <lockText> <true /> </lockText>
  1395.         <rect>
  1396.             <left>335</left>
  1397.             <top>331</top>
  1398.             <right>409</right>
  1399.             <bottom>346</bottom>
  1400.         </rect>
  1401.         <style>transparent</style>
  1402.         <autoSelect> <false /> </autoSelect>
  1403.         <showLines> <false /> </showLines>
  1404.         <wideMargins> <false /> </wideMargins>
  1405.         <multipleLines> <false /> </multipleLines>
  1406.         <reservedFamily> 0 </reservedFamily>
  1407.         <titleWidth>0</titleWidth>
  1408.         <icon>0</icon>
  1409.         <textAlign>left</textAlign>
  1410.         <font>Chicago</font>
  1411.         <textSize>12</textSize>
  1412.         <textStyle>plain</textStyle>
  1413.         <textHeight>16</textHeight>
  1414.         <name>Status Title</name>
  1415.         <script></script>
  1416.     </part>
  1417.     <part>
  1418.         <id>45</id>
  1419.         <type>field</type>
  1420.         <visible> <false /> </visible>
  1421.         <dontWrap> <true /> </dontWrap>
  1422.         <dontSearch> <false /> </dontSearch>
  1423.         <sharedText> <false /> </sharedText>
  1424.         <fixedLineHeight> <false /> </fixedLineHeight>
  1425.         <autoTab> <false /> </autoTab>
  1426.         <lockText> <true /> </lockText>
  1427.         <rect>
  1428.             <left>52</left>
  1429.             <top>32</top>
  1430.             <right>276</right>
  1431.             <bottom>149</bottom>
  1432.         </rect>
  1433.         <style>scrolling</style>
  1434.         <autoSelect> <false /> </autoSelect>
  1435.         <showLines> <false /> </showLines>
  1436.         <wideMargins> <false /> </wideMargins>
  1437.         <multipleLines> <false /> </multipleLines>
  1438.         <reservedFamily> 0 </reservedFamily>
  1439.         <titleWidth>0</titleWidth>
  1440.         <icon>0</icon>
  1441.         <textAlign>left</textAlign>
  1442.         <font>Geneva</font>
  1443.         <textSize>9</textSize>
  1444.         <textStyle>plain</textStyle>
  1445.         <textHeight>12</textHeight>
  1446.         <name>win</name>
  1447.         <script></script>
  1448.     </part>
  1449.     <part>
  1450.         <id>46</id>
  1451.         <type>field</type>
  1452.         <visible> <false /> </visible>
  1453.         <dontWrap> <true /> </dontWrap>
  1454.         <dontSearch> <false /> </dontSearch>
  1455.         <sharedText> <false /> </sharedText>
  1456.         <fixedLineHeight> <false /> </fixedLineHeight>
  1457.         <autoTab> <false /> </autoTab>
  1458.         <lockText> <true /> </lockText>
  1459.         <rect>
  1460.             <left>51</left>
  1461.             <top>172</top>
  1462.             <right>275</right>
  1463.             <bottom>285</bottom>
  1464.         </rect>
  1465.         <style>scrolling</style>
  1466.         <autoSelect> <false /> </autoSelect>
  1467.         <showLines> <false /> </showLines>
  1468.         <wideMargins> <false /> </wideMargins>
  1469.         <multipleLines> <false /> </multipleLines>
  1470.         <reservedFamily> 0 </reservedFamily>
  1471.         <titleWidth>0</titleWidth>
  1472.         <icon>0</icon>
  1473.         <textAlign>left</textAlign>
  1474.         <font>Geneva</font>
  1475.         <textSize>9</textSize>
  1476.         <textStyle>plain</textStyle>
  1477.         <textHeight>12</textHeight>
  1478.         <name>lose</name>
  1479.         <script></script>
  1480.     </part>
  1481.     <part>
  1482.         <id>47</id>
  1483.         <type>button</type>
  1484.         <visible> <true /> </visible>
  1485.         <reserved5> 0 </reserved5>
  1486.         <reserved4> 0 </reserved4>
  1487.         <reserved3> 0 </reserved3>
  1488.         <reserved2> 0 </reserved2>
  1489.         <reserved1> 0 </reserved1>
  1490.         <enabled> <true /> </enabled>
  1491.         <rect>
  1492.             <left>339</left>
  1493.             <top>452</top>
  1494.             <right>493</right>
  1495.             <bottom>474</bottom>
  1496.         </rect>
  1497.         <style>shadow</style>
  1498.         <showName> <true /> </showName>
  1499.         <highlight> <false /> </highlight>
  1500.         <autoHighlight> <true /> </autoHighlight>
  1501.         <sharedHighlight> <false /> </sharedHighlight>
  1502.         <family>0</family>
  1503.         <titleWidth>0</titleWidth>
  1504.         <icon>0</icon>
  1505.         <textAlign>center</textAlign>
  1506.         <font>Chicago</font>
  1507.         <textSize>12</textSize>
  1508.         <textStyle>plain</textStyle>
  1509.         <name>Quit</name>
  1510.         <script>on mouseUp
  1511. quitGame
  1512. end mouseUp</script>
  1513.     </part>
  1514.     <part>
  1515.         <id>48</id>
  1516.         <type>button</type>
  1517.         <visible> <true /> </visible>
  1518.         <reserved5> 0 </reserved5>
  1519.         <reserved4> 0 </reserved4>
  1520.         <reserved3> 0 </reserved3>
  1521.         <reserved2> 0 </reserved2>
  1522.         <reserved1> 0 </reserved1>
  1523.         <enabled> <true /> </enabled>
  1524.         <rect>
  1525.             <left>339</left>
  1526.             <top>132</top>
  1527.             <right>493</right>
  1528.             <bottom>154</bottom>
  1529.         </rect>
  1530.         <style>shadow</style>
  1531.         <showName> <true /> </showName>
  1532.         <highlight> <false /> </highlight>
  1533.         <autoHighlight> <true /> </autoHighlight>
  1534.         <sharedHighlight> <false /> </sharedHighlight>
  1535.         <family>0</family>
  1536.         <titleWidth>0</titleWidth>
  1537.         <icon>0</icon>
  1538.         <textAlign>center</textAlign>
  1539.         <font>Chicago</font>
  1540.         <textSize>12</textSize>
  1541.         <textStyle>plain</textStyle>
  1542.         <name>Quit</name>
  1543.         <script>on mouseUp
  1544. quitGame
  1545. end mouseUp</script>
  1546.     </part>
  1547.     <part>
  1548.         <id>49</id>
  1549.         <type>field</type>
  1550.         <visible> <true /> </visible>
  1551.         <dontWrap> <false /> </dontWrap>
  1552.         <dontSearch> <true /> </dontSearch>
  1553.         <sharedText> <true /> </sharedText>
  1554.         <fixedLineHeight> <false /> </fixedLineHeight>
  1555.         <autoTab> <false /> </autoTab>
  1556.         <lockText> <true /> </lockText>
  1557.         <rect>
  1558.             <left>333</left>
  1559.             <top>497</top>
  1560.             <right>492</right>
  1561.             <bottom>517</bottom>
  1562.         </rect>
  1563.         <style>opaque</style>
  1564.         <autoSelect> <false /> </autoSelect>
  1565.         <showLines> <false /> </showLines>
  1566.         <wideMargins> <false /> </wideMargins>
  1567.         <multipleLines> <false /> </multipleLines>
  1568.         <reservedFamily> 0 </reservedFamily>
  1569.         <titleWidth>0</titleWidth>
  1570.         <icon>0</icon>
  1571.         <textAlign>left</textAlign>
  1572.         <font>Times</font>
  1573.         <textSize>18</textSize>
  1574.         <textStyle>italic</textStyle>
  1575.         <textStyle>bold</textStyle>
  1576.         <textHeight>24</textHeight>
  1577.         <name>Our Screen Title</name>
  1578.         <script></script>
  1579.     </part>
  1580.     <content>
  1581.         <layer>background</layer>
  1582.         <id>35</id>
  1583.         <text>Status:</text>
  1584.     </content>
  1585.     <content>
  1586.         <layer>background</layer>
  1587.         <id>36</id>
  1588.         <text>Your Screen</text>
  1589.     </content>
  1590.     <content>
  1591.         <layer>background</layer>
  1592.         <id>49</id>
  1593.         <text>Opponent  Screen</text>
  1594.     </content>
  1595.     <content>
  1596.         <layer>background</layer>
  1597.         <id>44</id>
  1598.         <text>Status:</text>
  1599.     </content>
  1600.     <content>
  1601.         <layer>background</layer>
  1602.         <id>43</id>
  1603.         <text>Opponent:</text>
  1604.     </content>
  1605.     <name>Battleship</name>
  1606.     <script>--------------------------------------------------------------------------------
  1607. --
  1608. -- STACK: HyperBattleship  2.1   7/28/91
  1609. -- ┬⌐ Copyright 1991 by Claris Corporation, All Rights Reserved
  1610. -- By The HyperCard Development Team
  1611. --
  1612. -- HANDLERS USED IN THIS SCRIPT:
  1613. -- acceptIncoming, animateHit, animateMiss, appleEvent, challenger(),
  1614. -- challengerID(), chooseOpponent, closeShip, closeShips, closeStack,
  1615. -- continueChoose, dragAShip, dragShip, hbsCleanup, hbsInit, hbsMessage,
  1616. -- hbsMove, hbsRequest, hbsSetup, hbsStatus(), help, idle, moveShip,
  1617. -- moveWindow, myID(), offsetRect(), openCard, openStack, playerPause,
  1618. -- playerUnPause, quitGame, resume, resumeStack, sendMessage, setStatus,
  1619. -- setWindowSize, shipCondition(), shipLoc(), shipLocations(),
  1620. -- shipOrient, showLocations, sizeWindow, status, suspend, suspendStack,
  1621. --
  1622. -- LEGEND:
  1623. -- "--Γêå" indicates strings which would need localization
  1624. --------------------------------------------------------------------------------
  1625.  
  1626. --------------------------------------------------------------------------------
  1627. -- System Message Handlers
  1628. --------------------------------------------------------------------------------
  1629.  
  1630. on openStack
  1631. -- Check for Apple┬« Event support.
  1632. check4aeSupport
  1633. if the result is not "OK" then
  1634. if the enabled of menuItem "Close Stack" of menu "File" then
  1635. doMenu "Close Stack"
  1636. else
  1637. go Home
  1638. end if
  1639. exit to HyperCard
  1640. end if
  1641. -- Resize this stack
  1642. set width of card window to 512
  1643. set height of card window to 320
  1644. -- get rid of the scroll window
  1645. hide window scroll
  1646. -- If it's a standard Mac screen position the stack window correctly
  1647. if the screenRect = "0,0,512,342"
  1648. then set the rect of card window to 0,20,512,340
  1649. createMenu
  1650. playerUnPause
  1651. pass openStack
  1652. end openStack
  1653.  
  1654. on closeStack
  1655. removeMenu
  1656. if ((char 1 to 3 of the version) >= 2.1 ┬¼
  1657. and value("the systemVersion") >= 7 )
  1658. then playerPause
  1659. pass closeStack
  1660. end closeStack
  1661.  
  1662. on resume
  1663. createMenu
  1664. playerUnPause
  1665. pass resume
  1666. end resume
  1667.  
  1668. on suspend
  1669. removeMenu
  1670. playerPause
  1671. pass suspend
  1672. end suspend
  1673.  
  1674. on resumeStack
  1675. createMenu
  1676. playerUnPause
  1677. pass resumeStack
  1678. end resumeStack
  1679.  
  1680. on suspendStack
  1681. removeMenu
  1682. playerPause
  1683. pass suspendStack
  1684. end suspendStack
  1685.  
  1686. on openCard
  1687. setCheckMark
  1688. pass openCard
  1689. end openCard
  1690.  
  1691. on help
  1692. -- Show the help information.
  1693. global gBeforeHelpCard, gBeforeHelpScroll
  1694. if item 2 of the scroll of cd window < 170 then
  1695. put "0,0" into gBeforeHelpScroll
  1696. else put "0,320" into gBeforeHelpScroll
  1697. put the long name of this cd into gBeforeHelpCard
  1698. set scroll of cd window to "0,320"
  1699. go cd "Stack Help"
  1700. -- Update the menu.
  1701. checkMarkChange 7
  1702. end help
  1703.  
  1704. on quit
  1705. put hbsStatus() into CurStatus
  1706. -- If the game is not completed, ask if we should quit this game.
  1707. if CurStatus is not in "Choose,End" then
  1708. answer "Save current game before quitting?" with "Yes" or "No"
  1709. if it is "Yes" then pass quit
  1710. else if it is "No" then
  1711. lock screen
  1712. hbsInit
  1713. end if
  1714. end if
  1715. pass quit
  1716. end quit
  1717.  
  1718. --------------------------------------------------------------------------------
  1719. -- Standard HyperBattleship Handlers
  1720. --------------------------------------------------------------------------------
  1721.  
  1722. on appleEvent Class, EventID
  1723. -- Allow only ΓÇ£hbsΓÇ¥ events to occur while we are playing the game.
  1724. -- Note: This is a simple method to prevent another application
  1725. --  from sending just any Apple event.
  1726. if Class = "misc" and (EventID = "dosc" or EventID = "eval") then
  1727. request AppleEvent data
  1728. put it into EventData
  1729. if number of lines in EventData > 1 ┬¼
  1730. or char 1 to 3 of EventData Γëá "hbs" ┬¼
  1731. then reply error "Event not accepted."
  1732. end if
  1733. pass appleEvent
  1734. end appleEvent
  1735.  
  1736. on hbsRequest
  1737. -- Allow the requested opponent to respond to invitation to play.
  1738. --
  1739. -- Make sure that we are not asking applications on the same machine
  1740. --  to play. If we did we might never get a response because one
  1741. --  application may not continue while the other is waiting.
  1742. global gChoosing
  1743. request appleEvent sender
  1744. put it into AESender
  1745. put the itemDelimiter into SaveDelim
  1746. set the itemDelimiter to ":"
  1747. put (item 1 to 2 of AESender is item 1 to 2 of the address) into IsLocal
  1748. set the itemDelimiter to SaveDelim
  1749. if IsLocal then
  1750. put "Play" into GameAnswer -- Same machine, automatically approve.
  1751. else
  1752. if hbsStatus() is in "Place,Waiting,Ready" then
  1753. return "Busy"
  1754. else
  1755. answer AESender & " asks, ΓÇ£Do you want to play HyperBattleship?ΓÇ¥" ┬¼
  1756. with "No" or "Play"
  1757. put it into GameAnswer
  1758. if GameAnswer is "Play" ┬¼
  1759. and gChoosing is not empty then
  1760. status "Canceling your game selection in order to play a game " ┬¼
  1761. & "with " & AESender --Γêå
  1762. put empty into gChoosing
  1763. end if
  1764. if GameAnswer is "Play" then hbsInit
  1765. end if
  1766. end if
  1767. --
  1768. return GameAnswer
  1769. end hbsRequest
  1770.  
  1771. on hbsInit
  1772. -- Create a new game of HyperBattleship.
  1773. -- Note: Init provides a parameterless initialization.
  1774. if hbsStatus() is not in "Choose,End,Setup" then
  1775. -- Let the other player know that we are going away.
  1776. sendMessage "Your opponent has quit this game." --Γêå
  1777. send "hbsMove " ┬¼
  1778. & quote & "End" & quote & ", " ┬¼
  1779. & quote & challengerID() & quote & ", " ┬¼
  1780. & quote & shipLoc() & quote ┬¼
  1781. & "" to program challenger() without reply
  1782. end if
  1783. hbsCleanup myID()
  1784. end hbsInit
  1785.  
  1786. on hbsSetup NewPlayer, NewPlayerID, OurID
  1787. -- Create a HyperBattleship with the specified parameters.
  1788. --
  1789. if OurID is empty then
  1790. go to last card in this bg -- There should be only one card.
  1791. put myID() into OurID
  1792. end if
  1793. --
  1794. -- Since we asked to play, let challenger know our id.
  1795. if NewPlayer is not empty ┬¼
  1796. and NewPlayerID is not empty then
  1797. send "hbsMove " ┬¼
  1798. & quote & "Challenger ID" & quote & ", " ┬¼
  1799. & quote & NewPlayerID & quote & ", " ┬¼
  1800. & quote & OurID & quote ┬¼
  1801. to program NewPlayer
  1802. put the result into SendResult
  1803. if SendResult is not in "Setup,Busy" then
  1804. if SendResult is not "Cancel" then status SendResult
  1805. exit hbsSetup
  1806. end if
  1807. go to card id OurID
  1808. end if
  1809. --
  1810. -- Set all the parameters that we have, and wait for any other
  1811. --  parameters to be returned from the challenger.
  1812. put NewPlayer into bg fld "Challenger" of card id OurID
  1813. put NewPlayerID into bg fld "Challenger ID" of card id OurID
  1814. put the date && the time into bg fld "Date" of card id OurID
  1815. --
  1816. setStatus
  1817. status ""
  1818. end hbsSetup
  1819.  
  1820. on hbsCleanup OurGameID
  1821. -- Remove everything from the current game.
  1822. if (short id of this card) Γëá OurGameID ┬¼
  1823. and OurGameID is not empty then
  1824. hide bg btn "Ready!"
  1825. push this card
  1826. go to card id OurGameID
  1827. send "hbsCleanup" && OurGameID to this card
  1828. pop card
  1829. else
  1830. -- Clean up this game.
  1831. lock screen
  1832. if short name of this stack is "Home" then pass hbsCleanup
  1833. set cursor to busy
  1834. put empty into bg fld "Status"
  1835. set cursor to busy
  1836. put empty into bg fld "Status 2"
  1837. set cursor to busy
  1838. put fieldEmptyData() into bg fld "Ours"
  1839. set cursor to busy
  1840. put fieldEmptyData() into bg fld "Enemy"
  1841. set cursor to busy
  1842. put empty into bg fld "Challenger"
  1843. set cursor to busy
  1844. put empty into bg fld "Date"
  1845. set cursor to busy
  1846. put empty into bg fld "Challenger ID"
  1847. set cursor to busy
  1848. closeShips
  1849. set cursor to busy
  1850. status "Waiting to be configured.", "Status"  --Γêå
  1851. setStatus
  1852. set cursor to busy
  1853. showYourMap
  1854. unlock screen with visual dissolve fast
  1855. end if
  1856. end hbsCleanup
  1857.  
  1858. on hbsMessage Message
  1859. -- Display a message from someone out on the network.
  1860. request appleEvent sender
  1861. put it into AESender
  1862. status "ΓÇ£" & Message & "ΓÇ¥" && AESender, "Message"
  1863. end hbsMessage
  1864.  
  1865. on hbsMove MoveLocation, OurID, Value
  1866. -- A game move has been made. Determine the type of
  1867. -- move based upon our current status and any move information.
  1868. --
  1869. if OurID is empty then put short id of this card into OurID
  1870. if OurID Γëá short id of this card then
  1871. go to card id OurID
  1872. end if
  1873. --
  1874. -- Verify this hbsMove.
  1875. if MoveLocation is empty then exit hbsMove
  1876. --
  1877. -- Based upon the current game status, perform a move.
  1878. put hbsStatus() into CurStatus
  1879. if CurStatus = "End" ┬¼
  1880. or MoveLocation = "End" then
  1881. if Value is not empty then showLocations Value
  1882. status "End of game. Opponent has quit.", "Status"  --Γêå
  1883. put empty into bg fld "Challenger" of card "Game"
  1884. put empty into bg fld "Challenger ID" of card "Game"
  1885. hide bg btn "Place Ships"
  1886. hide bg btn "Ready!"
  1887. menuStatus
  1888. placeShipsCheck
  1889. else if CurStatus = "Setup" then
  1890. put Value into bg fld MoveLocation
  1891. setStatus
  1892. return "Setup"
  1893. else if CurStatus = "Place" ┬¼
  1894. or CurStatus = "Choose" then
  1895. return "Busy"
  1896. else
  1897. -- If a shot has been fired at our ships, determine if
  1898. --  there is a hit and respond accordingly.
  1899. acceptIncoming MoveLocation
  1900. return the result
  1901. end if
  1902. end hbsMove
  1903.  
  1904. function hbsStatus
  1905. -- Return the current status.
  1906. put empty into returnValue
  1907. -- Determine the current status of this game.
  1908. if challenger() is empty then
  1909. put "Choose" into returnValue -- A challenger has not been selected.
  1910. else if challengerID() is empty then
  1911. put "Setup" into returnValue -- Waiting for configuration information
  1912. --  from the challenger.
  1913. else if shipLocations() is empty then
  1914. put "Place" into returnValue -- Ships have not yet been placed.
  1915. else if word 1 of bg fld "Status" of card "Game" is "End" then
  1916. put "End" into returnValue -- The game is over.
  1917. else if word 1 of bg fld "Status" of card "Game" is "Waiting" then
  1918. put "Waiting" into returnValue
  1919. else
  1920. put "Ready" into returnValue
  1921. end if
  1922. return returnValue
  1923. end hbsStatus
  1924.  
  1925. --------------------------------------------------------------------------------
  1926. -- General HyperBattleship Handlers
  1927. --------------------------------------------------------------------------------
  1928.  
  1929. on quitGame
  1930. -- Quit this game and be polite about letting everyone know.
  1931. put hbsStatus() into CurStatus
  1932. --
  1933. -- If the game is not completed, verify that we really want
  1934. -- to start over or go Home.
  1935. if CurStatus is not "End" then
  1936. answer "Clear everything and then exit to Home or start a new game?" ┬¼
  1937. with "Cancel" or "Home" or "New Game"
  1938. if it is "Cancel" then exit quitGame
  1939. else if it is "Home" then
  1940. lock screen
  1941. hbsInit
  1942. go home
  1943. else if it is "New Game" then
  1944. hbsInit
  1945. end if
  1946. else
  1947. hbsInit
  1948. end if
  1949. end quitGame
  1950.  
  1951. on chooseOpponent
  1952. -- Get a challenger if we donΓÇÖt already have one.
  1953. global gChoosing
  1954. --
  1955. go to cd "Game"
  1956. put PlayerRequest() into NewChallenger
  1957. set cursor to busy
  1958. if NewChallenger is not empty then
  1959. put NewChallenger into bg fld "Challenger"
  1960. else -- Otherwise the user has selected cancel so exit.
  1961. exit chooseOpponent
  1962. end if
  1963. set cursor to busy
  1964. --
  1965. -- Since choosing an opponent may take awhile, there is a strong
  1966. --  possibility that the opponent is trying to choose us. Thus,
  1967. --  before we go any further we should allow a pending AppleEvent
  1968. --  to arrive. To make this happen we have to let one idle event
  1969. --  occur before continuing the chooseOpponent process.
  1970. --
  1971. put "Wait" into gChoosing
  1972. end chooseOpponent
  1973.  
  1974. on idle
  1975. global gChoosing
  1976. if gChoosing is not empty then
  1977. -- The first time through gChoosing is "Wait". We set the global
  1978. --  to "Now" and let one idle to be trapped. Pending AppleEvents
  1979. --  will occur at this point.
  1980. set cursor to busy
  1981. if gChoosing is "Wait"
  1982. then put "Now" into gChoosing -- Allow one idle.
  1983. else if gChoosing is "Now" then
  1984. put empty into gChoosing
  1985. continueChoose -- Continue with choosing opponent.
  1986. end if
  1987. exit idle
  1988. end if
  1989. pass idle
  1990. end idle
  1991.  
  1992. on continueChoose
  1993. set cursor to busy
  1994. -- Ask them if they want to play a game.
  1995. -- We are about to send an event to the program, we must inform
  1996. --  the user just before we send the event.
  1997. status "Waiting for opponent to respond." --Γêå
  1998. set cursor to busy
  1999. put challenger() into TheChallenger
  2000. send "hbsRequest" to program TheChallenger
  2001. put the result into SendResult
  2002. set cursor to busy
  2003. if SendResult is not "Play" then
  2004. -- They donΓÇÖt want to play, but describe the problem in detail.
  2005. set cursor to busy
  2006. if SendResult is "Timeout" then
  2007. status "The application you selected is not responding." && ┬¼
  2008. "Please try again and make sure you're selecting HyperCard" && ┬¼
  2009. "2.1 or greater.","Alert" --Γêå
  2010. else if SendResult is "Busy" then
  2011. status "The selected opponent is already busy playing a game.", ┬¼
  2012. "Alert" --Γêå
  2013. else if SendResult is "No" then
  2014. status "The selected opponent does not want to play a game.", ┬¼
  2015. "Alert" --Γêå
  2016. else if SendResult is "Can't understand " & quote & "hbsRequest" ┬¼
  2017. & quote & "." then
  2018. status "The selected opponent does not have HyperBattleship open.",┬¼
  2019. "Alert" --Γêå
  2020. else if SendResult is "Cancel" then exit continueChoose
  2021. else
  2022. status "Could not connect with chosen opponent." && ┬¼
  2023. "Received error message:" && "ΓÇ£" & SendResult & ┬¼
  2024. "ΓÇ¥. Please try again.","Alert" --Γêå
  2025. end if
  2026. exit continueChoose
  2027. end if
  2028. --
  2029. -- We should now have a challenger name (and perhaps an ID)
  2030. --  so let us start/setup a game.
  2031. status "Making a game of HyperBattleship with " ┬¼
  2032. & TheChallenger & ".", "Status" --Γêå
  2033. set cursor to busy
  2034. --
  2035. -- Prepare the challenger to play the game!
  2036. send "hbsSetup " ┬¼
  2037. & quote & the address & quote & ", " ┬¼
  2038. & quote & myID() & quote & ", " ┬¼
  2039. & quote & challengerID() & quote ┬¼
  2040. to program TheChallenger without reply
  2041. put the result into SendResult
  2042. set cursor to busy
  2043. -- If the send to program command works correctly it will
  2044. --  either return the empty or the name of the program.
  2045. if SendResult is not TheChallenger ┬¼
  2046. and SendResult is not empty then
  2047. status SendResult -- We have a problem.
  2048. exit continueChoose
  2049. end if
  2050. set cursor to busy
  2051. --
  2052. -- And, prepare ourselves to play this game.
  2053. send "hbsSetup " ┬¼
  2054. & quote & TheChallenger & quote & ", " ┬¼
  2055. & quote & challengerID() & quote & ", " ┬¼
  2056. & quote & myID() & quote & ", " ┬¼
  2057. to this card
  2058. set cursor to busy
  2059. --
  2060. setStatus
  2061. end continueChoose
  2062.  
  2063. on sendMessage TheMessage
  2064. -- Send the message to an opponent.
  2065. if TheMessage is empty then
  2066. ask "Enter message to send to opponent." with return & return  --Γêå
  2067. put the Result into AskResult
  2068. if AskResult is "Cancel" then exit sendMessage
  2069. put it into TheMessage
  2070. end if
  2071. --
  2072. send "hbsMessage " ┬¼
  2073. & unValue(TheMessage) & ", " ┬¼
  2074. to program challenger() without reply
  2075. end sendMessage
  2076.  
  2077. --------------------------------------------------------------------------------
  2078. -- Other HyperBattleship specific handlers.
  2079. --------------------------------------------------------------------------------
  2080.  
  2081. on playerPause
  2082. if hbsStatus() is in "Ready,Waiting,Place" then
  2083. sendMessage "PAUSE: Your opponent has left this game temporarily." --Γêå
  2084. end if
  2085. placeShipsCheck FALSE
  2086. end playerPause
  2087.  
  2088. on playerUnPause
  2089. if hbsStatus() is in "Ready,Waiting,Place" then
  2090. sendMessage "Your opponent has returned to this game." --Γêå
  2091. end if
  2092. placeShipsCheck
  2093. end playerUnPause
  2094.  
  2095. on acceptIncoming MoveLocation
  2096. -- Accept an incoming shot and display animation graphics.
  2097. --
  2098. -- Show the incoming shot.
  2099. showYourMap
  2100. -- Determine if we are hit.
  2101. put shipLocations() into ShipList
  2102. -- If the move location is in the shiplist, there is a hit.
  2103. put offset(MoveLocation & " ", ShipList) into ShipLoc
  2104. if ShipLoc Γëá 0 then
  2105. -- Set the icon of my ship at specified location to hit.
  2106. --  Specify the point of the hit and the ship button id.
  2107. play "ShellIncoming"
  2108. animateHit MoveLocation, ┬¼
  2109. word 2 of char ShipLoc to (ShipLoc + 50) of ShipList
  2110. --
  2111. -- Check if the entire ship is.
  2112. if shipCondition(word 5 of char ShipLoc to (ShipLoc + 50) of ShipList) ┬¼
  2113. is "Sunk" then
  2114. repeat for 30 -- Play a sunk sound.
  2115. play (any item of "Sunk 1,Sunk 2,Sunk 3")┬¼
  2116. (any item of "rt,rt,g2s,c3t,g3x")
  2117. end repeat
  2118. if shipCondition(allShips()) is "Sunk" then
  2119. status "End of game.", "Status"  --Γêå
  2120. status "All your ships are sunk." --Γêå
  2121. play flute tempo 160 "c4e a3 d4q a3h c4e a3 d4q a3h c4q f ee fs es " ┬¼
  2122. & "dq c4e a3 d4q a3h"
  2123. answer line random(9) of bg fld "Lose"
  2124. return "End"
  2125. end if
  2126. status "Ready for your move.", "Status" --Γêå
  2127. status "One of your ships sunk!" --Γêå
  2128. showOpponentMap
  2129. return "Sunk"
  2130. else
  2131. status "Ready for your move.", "Status" --Γêå
  2132. status "Your ship has been hit!" --Γêå
  2133. showOpponentMap
  2134. return "Hit"
  2135. end if
  2136. else
  2137. -- Set character in field to missed shot.
  2138. play "ShellIncoming"
  2139. animateMiss MoveLocation
  2140. -- Put the miss character into our map.
  2141. put gridCharLocation(MoveLocation) into RowColumn
  2142. put numToChar(219) into ┬¼
  2143. char item 1 of RowColumn of line item 2 of RowColumn ┬¼
  2144. of bg fld "Ours"
  2145. status "Ready for your move.", "Status" --Γêå
  2146. status "Incoming shot missed!" --Γêå
  2147. showOpponentMap
  2148. return "Miss"
  2149. end if
  2150. end acceptIncoming
  2151.  
  2152. on showLocations ShipList
  2153. -- Show the location of all the opponent ships.
  2154. showOpponentMap
  2155. --
  2156. -- Show all the locations of the unhit ships.
  2157. repeat with PartNum = 1 to number of items in ShipList
  2158. put item PartNum of ShipList into PartLocation
  2159. put gridCharLocation(PartLocation) into RowColumn
  2160. put char (item 1 of RowColumn) of line (item 2 of RowColumn) ┬¼
  2161. of bg fld "Enemy" into CurChar
  2162. if CurChar = " " or CurChar = numToChar(215) then
  2163. put "+" into ┬¼
  2164. char item 1 of RowColumn of line item 2 of RowColumn ┬¼
  2165. of bg fld "Enemy"
  2166. end if
  2167. end repeat
  2168. end showLocations
  2169.  
  2170. on setStatus
  2171. -- Configure possible actions based upon the current status.
  2172. put challengerID() into CurChallenger
  2173. --
  2174. if CurChallenger is empty ┬¼
  2175. and challenger() is empty then
  2176. status "Choose an opponent.","Status" --Γêå
  2177. show bg btn "Choose Opponent"
  2178. set cursor to busy
  2179. hide bg btn "Place Ships"
  2180. set cursor to busy
  2181. if there is a menu "HyperBattleship!" then
  2182. enable menuItem 1 of menu "HyperBattleship!"
  2183. disable menuItem 2 of menu "HyperBattleship!"
  2184. end if
  2185. set cursor to busy
  2186. hide bg btn "Ready!"
  2187. placeShipsCheck
  2188. else if CurChallenger is empty then
  2189. status "Waiting for opponent confirmation.", "Status" --Γêå
  2190. enable menuItem 9 of menu "HyperBattleship!"
  2191. else if shipLocations() is empty then
  2192. hide bg btn "Choose Opponent"
  2193. status "Place ships onto playing area.", "Status" --Γêå
  2194. show bg btn "Place Ships"
  2195. set cursor to busy
  2196. disable menuItem 1 of menu "HyperBattleship!"
  2197. enable menuItem 2 of menu "HyperBattleship!"
  2198. enable menuItem 9 of menu "HyperBattleship!"
  2199. placeShipsCheck
  2200. set cursor to busy
  2201. else
  2202. hide bg btn "Place Ships"
  2203. disable menuItem 1 of menu "HyperBattleship!"
  2204. disable menuItem 2 of menu "HyperBattleship!"
  2205. enable menuItem 9 of menu "HyperBattleship!"
  2206. play "Ship's Alarm"
  2207. play "Ship's Alarm"
  2208. play "Ship's Alarm"
  2209. play "All Hands"
  2210. status "Ready to play game.","Status" --Γêå
  2211. showOpponentMap
  2212. set cursor to busy
  2213. hide bg btn "Ready!"
  2214. placeShipsCheck
  2215. end if
  2216. end setStatus
  2217.  
  2218. function shipLoc
  2219. -- Return a list of all ship grid locations.
  2220. put empty into ReturnValue
  2221. put shipLocations() into ShipList
  2222. --
  2223. -- Show all the locations of the unhit ships.
  2224. put the itemDelimiter into SaveDelim
  2225. set the itemDelimiter to ";"
  2226. repeat with PartNum = 1 to number of items in ShipList
  2227. put word 1 of item PartNum of ShipList & "," after ReturnValue
  2228. end repeat
  2229. delete last char of ReturnValue
  2230. set the itemDelimiter to SaveDelim
  2231. return ReturnValue
  2232. end shipLoc
  2233.  
  2234. on animateHit MoveLocation, ButtonID, FieldName
  2235. -- Show the animation for a shot that hit our ship.
  2236. if FieldName is empty then put "Ours" into FieldName
  2237. -- Determine the location to show the animation.
  2238. if MoveLocation is not empty then
  2239. put gridItemLocation(MoveLocation, topLeft of bg fld FieldName) ┬¼
  2240. into MovePoint
  2241. if MovePoint is not empty
  2242. then set topLeft of bg btn "Animation" to MovePoint
  2243. end if
  2244. -- Show the hidden animation button, do icon animation, and play sounds.
  2245. set icon of bg btn "Animation" to 7001
  2246. wait until the sound is "Done"
  2247. show bg btn "Animation"
  2248. play "Explosion"
  2249. repeat with iconCnt = 7001 to 7004
  2250. set icon of bg btn "Animation" to iconCnt
  2251. wait 5
  2252. end repeat
  2253. -- Make a hole in our ship.
  2254. if ButtonID is not empty
  2255. then set icon of bg btn id ButtonID ┬¼
  2256. to ("6" & char 2 to 4 of icon of bg btn id ButtonID)
  2257. -- Hide the animation button.
  2258. hide bg btn "Animation"
  2259. end animateHit
  2260.  
  2261. on animateMiss MoveLocation, FieldName
  2262. -- Show the animation for a missed shot.
  2263. if FieldName is empty then put "Ours" into FieldName
  2264. -- Determine the location to show the animation.
  2265. if MoveLocation is not empty then
  2266. put gridItemLocation(MoveLocation, topLeft of bg fld FieldName) ┬¼
  2267. into MovePoint
  2268. if MovePoint is not empty
  2269. then set topLeft of bg btn "Animation" to MovePoint
  2270. end if
  2271. -- Show the hidden animation button, do icon animation, and play sounds.
  2272. set icon of bg btn "Animation" to "Miss 1"
  2273. wait until the sound is "Done"
  2274. play "Splash/Explosion"
  2275. show bg btn "Animation"
  2276. repeat with iconCnt = 8001 to 8012
  2277. set icon of bg btn "Animation" to iconCnt
  2278. wait 7
  2279. end repeat
  2280. hide bg btn "Animation"
  2281. end animateMiss
  2282.  
  2283. on setWindowSize
  2284. -- Set the window size to a visually appealing size.
  2285. put 320 into HalfHeight
  2286. --
  2287. put rect of card window into CurRect
  2288. -- Our current size is smaller than the full size of this card.
  2289. if height of card window < height of this card ┬¼
  2290. and height of card window > HalfHeight then
  2291. -- Show only a visually pleasing portion of this card.
  2292. put (item 2 of curRect + HalfHeight) into item 4 of CurRect -- L,T,R,B
  2293. set rect of card window to CurRect
  2294. end if
  2295. end setWindowSize
  2296.  
  2297. --------------------------------------------------------------------------------
  2298. -- System handlers specific to stack.
  2299. --------------------------------------------------------------------------------
  2300.  
  2301. on sizeWindow
  2302. setWindowSize
  2303. pass sizeWindow
  2304. end sizeWindow
  2305.  
  2306. on moveWindow
  2307. setWindowSize
  2308. pass moveWindow
  2309. end moveWindow
  2310.  
  2311. --------------------------------------------------------------------------------
  2312. -- Ship Action Handlers.
  2313. --------------------------------------------------------------------------------
  2314.  
  2315. on dragShip ShipNum, ShipList, ShipRect
  2316. -- Drag a ship from a current location on the game board.
  2317. if hbsStatus() is not "Place" then exit dragShip
  2318. --
  2319. put DragRect(ShipRect) into MoveLoc
  2320. set cursor to watch
  2321. put round((item 1 of MoveLoc)/30) * 30 into item 1 of MoveLoc
  2322. put round((item 2 of MoveLoc)/30) * 30 into item 2 of MoveLoc
  2323. --
  2324. if MoveLoc Γëá "0,0" then
  2325. -- Compute the final mouse location (used to determine object placement).
  2326. put the clickLoc into MovePoint
  2327. put offsetRect(shipRect,item 1 of MoveLoc,item 2 of MoveLoc) into MoveRect
  2328. -- If the point moved to is still within the rect of container continue.
  2329. put rect of bg fld "Ours" into ContainerRect
  2330. if item 1 to 2 of MoveRect is not within ContainerRect ┬¼
  2331. or item 3 to 4 of MoveRect is not within ContainerRect then
  2332. closeShip ShipNum, ShipList -- Close a specified ship.
  2333. else
  2334. moveShip ShipList, item 1 of MoveLoc, item 2 of MoveLoc
  2335. end if
  2336. end if
  2337. end dragShip
  2338.  
  2339. on moveShip ShipList, DeltaHorz, DeltaVert
  2340. -- Move an entire ship.
  2341. lock screen
  2342. -- Move all the parts of this ship.
  2343. repeat with PartNumber = 1 to (number of items in ShipList)
  2344. set cursor to busy
  2345. put item PartNumber of ShipList into TargetShip
  2346. -- Move the ship.
  2347. set loc of bg btn id TargetShip to ┬¼
  2348. (item 1 of loc of bg btn id TargetShip + DeltaHorz & "," & ┬¼
  2349. item 2 of loc of bg btn id TargetShip + DeltaVert)
  2350. show bg btn id TargetShip
  2351. end repeat
  2352. end moveShip
  2353.  
  2354. on closeShip ShipNum, ShipList
  2355. -- Close a single ship.
  2356. lock screen
  2357. repeat with ItemNum = 1 to number of items in ShipList
  2358. hide bg btn id (item ItemNum of ShipList)
  2359. end repeat
  2360. -- Update the palette.
  2361. do "set the enabledButton_" & ShipNum & " of window " & quote & "your ships" ┬¼
  2362. & quote & " to true"
  2363. do "set the enabledButton_" & (ShipNum + 5) & " of window " & quote ┬¼
  2364. & "your ships" ┬¼
  2365. & quote & " to true"
  2366. end closeShip
  2367.  
  2368. on closeShips
  2369. -- Hide all the ships.
  2370. lock screen
  2371. put allShips() into ShipList
  2372. repeat with ShipNum = 1 to number of items in ShipList
  2373. hide bg btn id (item ShipNum of ShipList)
  2374. end repeat
  2375. -- Update the palette.
  2376. if there is a window "Your Ships" then
  2377. close window "Your Ships"
  2378. end if
  2379. end closeShips
  2380.  
  2381. function offsetRect currRect, XZero, YZero
  2382. add XZero to item 1 of currRect
  2383. add YZero to item 2 of currRect
  2384. add XZero to item 3 of currRect
  2385. add YZero to item 4 of currRect
  2386. return currRect
  2387. end offsetRect
  2388.  
  2389. on dragAShip ShipRect, ShipNumber
  2390. -- Drag an outline of the ship from a palette, and place the ship.
  2391. --
  2392. -- Grab the rect of the palette,
  2393. put the rect of window "Your Ships" into PaletteRect
  2394. --  and convert the rect of the button in the palette to global coordinates
  2395. --  to pass to the XFCN
  2396. put offsetRect(ShipRect, item 1 of PaletteRect, ┬¼
  2397. item 2 of PaletteRect) into RectToDrag
  2398. --
  2399. -- Drag the outline around until the mouse button is released.  This version
  2400. --  of dragrect returns the offset from the start rect (delta X, delta Y).
  2401. put dragRect(RectToDrag) into MoveLoc
  2402. --
  2403. set cursor to watch
  2404. -- Compute the final mouse location (used to determine object placement).
  2405. put item 1 to 2 of RectToDrag into MovePoint
  2406. add item 1 of MoveLoc to item 1 of MovePoint
  2407. add item 2 of MoveLoc to item 2 of MovePoint
  2408. -- Get the bottom of the ship, so we can verify its location.
  2409. put item 3 to 4 of RectToDrag into ExtentPoint
  2410. add (item 1 of MoveLoc) - 5 to item 1 of ExtentPoint
  2411. add (item 2 of MoveLoc) - 5 to item 2 of ExtentPoint
  2412. --
  2413. -- If the point moved to is still within the rect of container continue.
  2414. put rect of bg fld "Ours" into ContainerRect
  2415. if MovePoint is not within ContainerRect ┬¼
  2416. or ExtentPoint is not within ContainerRect then
  2417. -- Do nothing, they did not specify a location on the board
  2418. beep 1
  2419. status "Ships must be placed entirely within your game board boundries." --Γêå
  2420. else
  2421. -- Determine the orientation of the ship being dragged.
  2422. put char 1 + ((ShipNumber - 1) div 5) of "VH" into Direction
  2423. -- Determine the type of ship being placed.
  2424. put (((ShipNumber - 1) mod 5) + 1) into ShipType
  2425. --
  2426. do "put ship" & ShipType & "() into ShipList"
  2427. --
  2428. put GridLocation(MovePoint,ContainerRect) into NewGrid
  2429. shipOrient NewGrid, Direction, ShipList, ShipType
  2430. end if
  2431. -- Clean up the palette.
  2432. set the hilitedButton of window "Your Ships" to 0
  2433. end dragAShip
  2434.  
  2435. on shipOrient Location, Direction, ShipList, ShipType
  2436. -- Place all ship parts into their correct location.
  2437. --
  2438. lock screen
  2439. -- Get name of ship.
  2440. put (word 1 of short name of bg btn id (item 1 of ShipList)) into MainName
  2441. --
  2442. -- For each ship part set the location and icon.
  2443. repeat with PartNumber = 1 to (number of items in ShipList)
  2444. set cursor to busy
  2445. put item PartNumber of ShipList into CurPart
  2446. set icon of bg btn id CurPart to ┬¼
  2447. (MainName && PartNumber && Direction && "OK")
  2448. if Direction is "h" then
  2449. set topLeft of bg btn id CurPart to ┬¼
  2450. ((item 1 of Location + ((PartNumber - 1) * 30)) ┬¼
  2451. & "," & item 2 of Location)
  2452. else
  2453. set topLeft of bg btn id CurPart to ┬¼
  2454. (item 1 of Location & "," ┬¼
  2455. & (item 2 of Location + ((PartNumber - 1) * 30)))
  2456. end if
  2457. show bg btn id CurPart
  2458. end repeat
  2459. --
  2460. -- Update the palette.
  2461. if there is a window "Your Ships" then
  2462. do "set the enabledButton_" & ShipType & " of window " ┬¼
  2463. & quote & "your ships" & quote & " to false"
  2464. do "set the enabledButton_" & (ShipType + 5) & " of window " ┬¼
  2465. & quote & "your ships" & quote & " to false"
  2466. end if
  2467. end shipOrient
  2468.  
  2469. on status Message, Type
  2470. -- Tell the player the current game status.
  2471. if Type is "Status" then -- Information message from almost anywhere.
  2472. put Message into line 1 of bg fld "Status"
  2473. put Message into line 1 of bg fld "Status 2"
  2474. else if Type is "Message" then -- Communications from other player.
  2475. play "Ping"
  2476. answer Message
  2477. else if Type is "Alert" then -- A more important message.
  2478. beep
  2479. answer Message
  2480. else
  2481. put Message into line 2 of bg fld "Status"
  2482. put Message into line 2 of bg fld "Status 2"
  2483. end if
  2484. end status
  2485.  
  2486. --------------------------------------------------------------------------------
  2487. -- HyperBattleship! information function handlers.
  2488. --------------------------------------------------------------------------------
  2489.  
  2490. function myID
  2491. return short id of card "Game"
  2492. end myID
  2493.  
  2494. function challenger
  2495. return bg fld "Challenger" of card "Game"
  2496. end challenger
  2497.  
  2498. function challengerID
  2499. return bg fld "Challenger ID" of card "Game"
  2500. end challengerID
  2501.  
  2502. function shipLocations
  2503. -- The placed ships locations are listed location format.
  2504. -- Notes: The format of the ship location is:
  2505. --  "┬½Grid Loc┬╗ ┬½Btn ID┬╗ ┬½Btn TopLeft┬╗ ┬½Btn Icon ID┬╗ ┬½Btn ID List┬╗ ;"
  2506. return line 11 of bg fld "Ours" of card "Game"
  2507. end shipLocations
  2508.  
  2509. function shipCondition ShipList
  2510. -- Determine if ship parts (buttons) in list are sunk.
  2511. put "Sunk" into ReturnValue
  2512. repeat with Index = 1 to number of items in ShipList
  2513. if icon of bg btn id (item Index of ShipList) < 6000 ┬¼
  2514. then return "OK"
  2515. end repeat
  2516. return ReturnValue
  2517. end shipCondition
  2518. </script>
  2519. </background>
  2520.