home *** CD-ROM | disk | FTP | other *** search
- -- stack: in
- -- format: 8 (HyperCard 1)
- -- flags: 0x1000 (none)
- -- protect password hash: 0
- -- maximum user level: 5 (scripting)
- -- window: Rect(x1=0, y1=0, x2=0, y2=0)
- -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
- -- card dimensions: w=0 h=0
- -- scroll: x=0 y=0
- -- background count: 3
- -- first background id: 2740
- -- card count: 17
- -- first card id: 4426
- -- list block id: 2365
- -- print block id: 2185
- -- font table block id: 0
- -- style table block id: 0
- -- free block count: 5
- -- free size: 32064 bytes
- -- total size: 124928 bytes
- -- stack block size: 9216 bytes
- -- created by hypercard version: 0x01228000
- -- compacted by hypercard version: 0x01228000
- -- modified by hypercard version: 0x01228000
- -- opened by hypercard version: 0x01258000
- -- patterns[0]: 0x0000000000000000
- -- patterns[1]: 0x8000000008000000
- -- patterns[2]: 0x8800220088002200
- -- patterns[3]: 0x8888222288882222
- -- patterns[4]: 0x88AA22AA88AA22AA
- -- patterns[5]: 0xCCAA33AACCAA33AA
- -- patterns[6]: 0xEEAABBAAEEAABBAA
- -- patterns[7]: 0xEEBBBBEEEEBBBBEE
- -- patterns[8]: 0xFFBBFFEEFFBBFFEE
- -- patterns[9]: 0xFFBBFFFFFFBBFFFF
- -- patterns[10]: 0x8010022001084004
- -- patterns[11]: 0xFFFFFFFFFFFFFFFF
- -- patterns[12]: 0x8822882288228822
- -- patterns[13]: 0x1122448811224488
- -- patterns[14]: 0xC4800C6843023026
- -- patterns[15]: 0xB130031BD8C00C8D
- -- patterns[16]: 0xAA00AA00AA00AA00
- -- patterns[17]: 0x8822552288225522
- -- patterns[18]: 0x8855225588552255
- -- patterns[19]: 0x77DD77DD77DD77DD
- -- patterns[20]: 0x8000000000000000
- -- patterns[21]: 0xAA55AA55AA55AA55
- -- patterns[22]: 0x038448300C020101
- -- patterns[23]: 0x8244394482010101
- -- patterns[24]: 0x8814224188412214
- -- patterns[25]: 0x8080413E080814E3
- -- patterns[26]: 0x22048C7422179810
- -- patterns[27]: 0xBE808808EB088880
- -- patterns[28]: 0x25C8328964244C92
- -- patterns[29]: 0xA29C41BE2AC914EB
- -- patterns[30]: 0x40A00000040A0000
- -- patterns[31]: 0x8040200002040800
- -- patterns[32]: 0xAA00800088008000
- -- patterns[33]: 0xFF80808080808080
- -- patterns[34]: 0x081C22C180010204
- -- patterns[35]: 0xFF808080FF080808
- -- patterns[36]: 0xF87422478F172271
- -- patterns[37]: 0xBF00BFBFB0B0B0B0
- -- patterns[38]: 0xFF7FBE5DA2418000
- -- patterns[39]: 0xFAF5FAF5A050A050
- -- checksum: 0x0
- ----- HyperTalk script -----
- on openStack
- global tileOne
- global tileTwo
- global ShangMenu
- global peekFlag
- hide menubar
- put NewMenu("HyperShanghai"," New Deal"," Restart", " Symbols"," Peek"," Open Game"," Save Game") into ShangMenu
- put empty into tileOne
- put empty into tileTwo
- put false into peekFlag
- end openStack
-
- on closestack
- global peekFlag
- global ShangMenu
- put DeleteMenu(ShangMenu) into ShangMenu
- if peekFlag then send mouseUp to btn "done" of cd game
- end closestack
-
- function shuffle icon
- put cd fld ("icons," & icon) of cd info into theTiles
- repeat with x = 1 to 144
- set the cursor to busy
- put random(144) into theRand
- put line theRand of theTiles into theLine
- put return & line x of theTiles after line theRand of theTiles
- delete line theRand of theTiles
- delete line x of theTiles
- put theLine & return before line x of theTiles
- end repeat
- return theTiles
- end shuffle
-
- on deal
- set cursor to watch
- repeat with x = 1 to 144
- go cd game
- set the icon of btn (line x of cd fld buttons of cd info) to (line x of cd fld Tiles of cd info)
- end repeat
- end deal
-
- on resetOpen
- set cursor to watch
- go cd game
- repeat with x = 1 to 144
- show btn (line x of cd fld buttons of cd info)
- set the icon of btn (line x of cd fld buttons of cd info) to 0
- end repeat
- repeat with x = 1 to 56
- show fld x
- end repeat
- put "144" into cd fld left
- end resetOpen
-
- on subRestart
- go cd game
- repeat with x = 1 to 144
- show btn (line x of cd fld buttons of cd info)
- end repeat
- repeat with x = 1 to 56
- show fld x
- end repeat
- put "144" into cd fld left
- end subRestart
-
- on Restart
- answer "Are you sure you want to restart this hand?" with "Restart!" or "Cancel"
- if it is "Restart!" then
- set cursor to watch
- put empty into cd fld "Undo"
- lock screen
- subRestart
- put "Pick an open tile." into cd fld window
- symbolReset
- unlock screen with visual dissolve slowly
- end if
- end Restart
-
- on newDeal
- answer "Are you sure you want a new deal?" with "Deal um!" or "Cancel"
- if it is "Deal um!" then
- set cursor to watch
- put empty into cd fld "Undo"
- lock screen
- put shuffle("Music") into cd fld tiles of cd info
- go cd game
- deal
- subRestart
- put "Pick an open tile." into cd fld window
- symbolReset
- unlock screen with visual dissolve slowly
- end if
- end newDeal
-
- on Peek
- global peekFlag
- global shangMenu
- set cursor to watch
- lock screen
- go cd game
- hide btn help
- enableMenu shangMenu,4,False
- set the icon of btn "level1" to 0
- set the icon of btn "level2" to 0
- set the icon of btn "level3" to 0
- set the icon of btn "level4" to 0
- put true into peekFlag
- repeat with x = 185 to 190
- show btn x
- end repeat
- show cd fld "Peek"
- unlock screen with visual dissolve
- end Peek
-
- on saveGame
- global tileOne
- global tileTwo
- put FileSave() into fName
- if fName is not empty then
- lock screen
- if tileOne is not empty then
- set the highlite of btn tileOne to false
- put empty into tileOne
- end if
- if tileTwo is not empty then
- set the highlite of btn tileTwo to false
- put empty into tileTwo
- end if
- open file fName
- put empty into saveRecord
- put cd fld left & return into saveRecord
- repeat with x = 1 to the number of lines of cd fld buttons of cd info
- set the cursor to busy
- get line x of cd fld buttons of cd info
- put the visible of btn it into theVis
- put the icon of btn it into theIcon
- put (theVis & "," & theIcon & return) after saveRecord
- end repeat
- repeat with x = 1 to 36
- set the cursor to busy
- put (cd fld x of cd symbols & return) after saveRecord
- end repeat
- put return after saveRecord
- write saveRecord to file fName
- close file fName
- unlock screen with visual dissolve
- end if
- end saveGame
-
- on openGame
- global tileOne
- global tileTwo
- put FileName("TEXT") into fName
- if fName is not empty then
- lock screen
- open file fName
- if tileOne is not empty then
- set the highlite of btn tileOne to false
- put empty into tileOne
- end if
- if tileTwo is not empty then
- set the highlite of btn tileTwo to false
- put empty into tileTwo
- end if
- read from file fName until return
- put it into cd fld left
- repeat with x = 1 to the number of lines of cd fld buttons of cd info
- set the cursor to busy
- put line x of cd fld buttons of cd info into theBtn
- read from file fName until return
- set the visible of btn theBtn to item 1 of it
- set the icon of btn theBtn to item 2 of it
- if theBtn > 102 then
- if item 1 of it then
- show fld ("x" & theBtn)
- else
- hide fld ("x" & theBtn)
- end if
- end if
- end repeat
- repeat with x = 1 to 36
- set the cursor to busy
- read from file fName until return
- put it into cd fld x of cd symbols
- end repeat
- close file fName
- put "Pick and open tile." into cd fld window
- unlock screen with visual dissolve
- end if
- end openGame
-
- function tileOpen theNum
- if theNum is 54 then
- put (the visible of btn 38 of cd game) and (the visible of btn 55 of cd game) into theOpen
- else
- if theNum is 65 then
- put (the visible of btn 64 of cd game) and (the visible of btn 51 of cd game) into theOpen
- else
- if (theNum > 174) and (theNum < 183) then
- put (the visible of btn (theNum - 1) of cd game) and (the visible of btn (theNum + 1)of cd game) into theOpen
- put theOpen or (the visible of btn 183 of cd game) into theOpen
- else
- put (the visible of btn (theNum - 1 )of cd game) and (the visible of btn (theNum + 1) of cd game) into theOpen
- end if
- end if
- end if
- put not theOpen into theOpen
- return theOpen
- end tileOpen
-
- on symbolReset
- repeat with x = 1 to 36
- put 4 into cd fld x of cd symbols
- end repeat
- end symbolReset
-
- on doMenu which
- global tileOne
- global tileTwo
- if first char of which is " " then
- put which into Com
- delete char 1 of Com
- if Com is "New Deal" then
- go cd game
- NewDeal
- end if
- if Com is "Restart" then
- go cd game
- Restart
- end if
- if Com is "Symbols" then
- lock screen
- hide menubar
- go cd Symbols
- unlock screen with visual wipe left slowly
- end if
- if Com is "Peek" then
- Peek
- end if
- if Com is "Open Game" then
- openGame
- end if
- if Com is "Save Game" then
- saveGame
- end if
- -- else
- -- if which is "Undo" then
- -- if cd fld "Undo" is empty then
- -- answer "Can't Undo!" with "Sorry"
- -- else
- -- if tileOne is not empty then
- -- set the hilight of btn tileOne to false
- -- put empty into tileOne
- -- end if
- -- if tileTwo is not empty then
- -- set the hilight of btn tileTwo to false
- -- put empty into tileTwo
- -- end if
- -- put item 1 of line 1 of cd fld "Undo" into firstTile
- -- put item 2 of line 1 of cd fld "Undo" into secondTile
- -- show btn firstTile
- -- show btn secondTile
- -- add 2 to cd fld left
- -- if firstTile > 102 then
- -- show bg fld ("x" & firstTile)
- -- end if
- -- if secondTile > 102 then
- -- show bg fld ("x" & secondTile)
- -- end if
- -- put the icon of btn firstTile into theIcon
- -- subtract 10000 from theIcon
- -- add 2 to cd fld theIcon of cd symbols
- -- put empty into cd fld "Undo"
- -- put "Pick an open tile." into cd fld window
- -- hide bg btn "Remove Tiles"
- -- end if
- else
- pass doMenu
- -- end if
- end if
- end doMenu
-
- on idle
- global ShangMenu,lastTick, sessionStart, prevGame
- if (the ticks-lastTick)>120 then
- put the ticks into lastTick
- showMenu(ShangMenu)
- end if
- end idle
-
-
-