home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
hc
/
gunshy.sit
/
Gunshy
/
background_3736.txt
< prev
next >
Wrap
Text File
|
1988-11-14
|
8KB
|
309 lines
-- background: 3736 from stack: in
-- bmap block id: 4300
-- flags: 4000
-- background id: 0
-- name: GunShy Background
-- part 1 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=1 top=6 right=32 bottom=38
-- title width / last selected line: 0
-- icon id / first selected line: 11045 / 11045
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Go Home
----- HyperTalk script -----
on mouseUp
visual effect iris close
go Home
end mouseUp
-- part 2 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=465 top=5 right=31 bottom=509
-- title width / last selected line: 0
-- icon id / first selected line: 2478 / 2478
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: About
----- HyperTalk script -----
on mouseUp
push card
visual effect zoom open
go to card "About Hyper-GunShy"
end mouseUp
-- part 3 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=0 top=319 right=341 bottom=100
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: New
----- HyperTalk script -----
-- Start a new game
on mouseUp
global icon1, icon2, numicons, sofar, iconlist, changed
put 0 into icon1
put 0 into icon2
put empty into sofar
put true into changed
set cursor to 4 -- watch
put the number of buttons into numicons
-- get initial list of icons
put field 1 of card "Temp Work Storage" into iconlist
put empty into used
repeat with j = 1 to numicons
put false into ok
repeat until ok
put (139 + random(numicons)) into theicon
-- check or make list of icons already used
if offset(theicon,used) = 0 then
put theicon && empty after used
if not geticon(theicon) then put 140 + (theicon mod 36) into theicon
-- such an icon does not exist in the resources
put true into ok
set icon of button j to theicon
set hilite of button j to false
show button j
-- put the new icon no, into list
-- that HyperCard bug again - it can't handle complex things
-- put ((theicon mod 36) + 1) into first item of word j of iconlist
put word j of iconlist into temp
put second item of temp into layer
put third item of temp into row
-- need + 1 since we test for icon = 0
put ((theicon mod 36) + 1) into theicon
put theicon&","&layer&","&row into word j of iconlist
-- add more button attributes here
end if
end repeat
end repeat
-- put iconlist into msg -- debug
set cursor to 1 -- arrow
end mouseUp
-- part 4 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=102 top=319 right=341 bottom=202
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Open
----- HyperTalk script -----
-- Resume an existing game
on mouseUp
global icon1, icon2, numicons, iconlist, sofar, fname, changed
ask "Resume what Game" with fname
if (it is empty) or (the result is "Cancel") then exit mouseUp
put it into fname
set LockMessages to true
set LockScreen to true
go to card fname
if the result <> empty then
answer "No such Game" with "OK"
go to card "Hyper-GunShy Startup"
send mouseUp to me -- try again, recursive ???
exit mouseUp
end if
-- get the state of the game
set cursor to 4 -- watch
put field 1 into iconlist
put field 2 into sofar
put the number of words in iconlist into numicons
subtract the number of words in sofar from numicons
put 0 into icon1
put 0 into icon2
put true into changed
go to card "Hyper-GunShy Startup"
repeat with j = 1 to the number of buttons
set hilite of button j to false
show button j
end repeat
repeat with j = 1 to the number of words in sofar
put word j of sofar into temp
get first item of temp
hide button it
end repeat
set LockScreen to false
set LockMessages to false
end mouseUp
-- part 6 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=306 top=319 right=341 bottom=406
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Save
----- HyperTalk script -----
-- Save the game
on mouseUp
global numicons, sofar, iconlist, fname, changed
ask "Save as what game" with fname
if (it is empty) or (the result is "Cancel") then exit mouseUp
put it into fname
set LockScreen to true
set LockMessages to true
go to card fname
if the result is empty then
answer "OK to replace " & fname with "OK" or "Cancel"
if it is "Cancel" then
go to card "Hyper-GunShy Startup"
send mouseUp to me -- try again, recursive ???
exit mouseUp
end if
else
go to card "Temp Work Storage"
set cursor to 4 -- watch
doMenu "Copy Card"
doMenu "New Card"
doMenu "Paste Card"
set the name of this card to fname
end if
-- save the state of the game
put iconlist into field 1
put sofar into field 2
put false into changed
go to card "Hyper-GunShy Startup"
set LockScreen to false
set LockMessages to false
end mouseUp
-- part 7 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=416 top=316 right=341 bottom=459
-- title width / last selected line: 0
-- icon id / first selected line: 25002 / 25002
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Do Help
----- HyperTalk script -----
on mouseUp
push card
visual effect zoom open
go to card "Hyper-GunShy Help..."
end mouseUp
-- part 8 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=466 top=316 right=341 bottom=503
-- title width / last selected line: 0
-- icon id / first selected line: 1012 / 1012
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Return
----- HyperTalk script -----
-- Quit from game
on mouseUp
-- maybe ask user whether to save game first
visual effect iris close
pop card
end mouseUp
-- part 9 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=204 top=319 right=341 bottom=304
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Restart
----- HyperTalk script -----
-- Restart the current game
on mouseUp
global icon1, icon2, num1, num2, sofar, numicons, changed
put 0 into icon1
put 0 into icon2
put 0 into num1
put 0 into num2
put true into changed
put the number of words of sofar into temp
-- only process icons that have gone
set cursor to 4 -- watch
repeat with j = 1 to temp
get word j of sofar
set hilite of button it to false
show button it
end repeat
set cursor to 1 -- arrow
put empty into sofar
put the number of buttons into numicons
end mouseUp
-- quick & dirty utility routine to tidy up all icons
-- to use, enter in msg : send "tidyup" to background button "Restart"
on tidyup
global icon1, icon2, num1, num2, sofar, numicons, changed
set cursor to 4 -- watch
put 0 into icon1
put 0 into icon2
put 0 into num1
put 0 into num2
put true into changed
put the number of buttons into numicons
put empty into sofar
repeat with j = 1 to numicons
set hilite of button j to false
show button j
end repeat
set cursor to 1 -- arrow
end tidyup