home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Inventor Labs: Technology
/
INVENTORLABS_TECHNOLOGY.BIN
/
mac
/
FILES
/
INVEST.DIR
/
00665_Script_CircuitsParentScript
< prev
next >
Wrap
Text File
|
1997-05-26
|
17KB
|
677 lines
-- Circuits Object
property pSwitchOnCast
property pSwitchOffCast
property pMaxSprite
property pSwitchFlag
property pSwitchFlag1
property pSwitchFlag2
property pSwitchFlag3
property pSwitchFlag4
property pLight1
property pLight2
property pLight3
property pLight4
property pLight5
property pFirstResetSprite
--Circuit 1
property pCircuit1Switch1
property pcircuit1Light1
property pCircuit1Light2
-- Circuit 2
property pCircuit2Switch1
property pCircuit2Switch2
property pCircuit2Light1
property pCircuit2Light2
-- Circuit 3
property pCircuit3Switch1
property pCircuit3Switch2
property pCircuit3Switch3
property pCircuit3Light1
property pCircuit3Light2
property pCircuit3Light3
--Circuit 4
property pCircuit4Switch1
property pCircuit4Switch2
property pCircuit4Switch3
property pCircuit4Switch4
property pCircuit4Light1
property pCircuit4Light2
-- Circuit 5
property pCircuit5Switch1
property pCircuit5Dial1
property pCircuit5Light1
property pCircuit5Light2
property pDial1
property pDial2
property pDial3
-- Circuit 6
property pCircuit6Switch1
property pCircuit6Switch2
property pCircuit6Switch3
property pCircuit6Light1
property pCircuit6Light2
property pCircuit6Light3
property pCircuit6Light4
property pCircuit6Light5
-- DL
property pHighestSprite
property pRolloverList
property pCurrentCircuit
property pFirstRolloverCast
property pFirstRolloverSprite
property pLastRolloverSprite
property pRolloverSprite
on mInit me
set pFirstResetSprite = 4
set pSecontResetSprite = 5
set pHighestSprite = 12
set pRolloverSprite = 4
set pFirstRolloverCast = the number of cast "LABEL -BATTERY"
--Circuit1
set pCircuit1Switch1 = 5
set pCircuit1Light1 = 6
set pCircuit1Light2 = 7
--Circuit 2
set pCircuit2Switch1 = 5
set pCircuit2Switch2 = 6
set pCircuit2Light1 = 7
set pCircuit2Light2 = 8
--Circuit 3
set pCircuit3Switch1 = 5
set pCircuit3Switch2 = 6
set pCircuit3Switch3 = 7
set pCircuit3Light1 = 8
set pCircuit3Light2 = 9
set pCircuit3Light3 = 10
--Circuit 4
set pCircuit4Switch1 = 5
set pCircuit4Switch2 = 6
set pCircuit4Light1 = 7
set pCircuit4Light2 = 8
--Circuit 5
set pCircuit5Switch1 = 5
set pCircuit5Dial1 = 6
set pCircuit5Light1 = 7
set pCircuit5Light2 = 8
set pDial1 = the number of cast "DIAL 1"
set pDial2 = the number of cast "DIAL 2"
set pDial3 = the number of cast "DIAL 3"
--Circuit 6
set pCircuit6Switch1 = 5
set pCircuit6Switch2 = 6
set pCircuit6Switch3 = 7
set pCircuit6Light1 = 8
set pCircuit6Light2 = 9
set pCircuit6Light3 = 10
set pCircuit6Light4 = 11
set pCircuit6Light5 = 12
-- set the castnum of of switch art
set pSwitchOnCast = the number of cast "switch on"
set pSwitchOffCast = the number of cast "switch off"
set pLight1 = the number of cast "light 1.pic"
set pLight2 = the number of cast "light 2.pic"
set pLight3 = the number of cast "light 3.pic"
set pLight4 = the number of cast "light 4.pic"
set pLight5 = the number of cast "light 5.pic"
-- set initial values of switchflags (all off)
set pSwitchFlag1 = 0
set pSwitchFlag2 = 0
set pSwitchFlag3 = 0
set pSwitchFlag4 = 0
-- the program sets the puppetsprite of only those sprites needed for a particular circuit
-- set initial value of pMaxSprite
set pMaxSprite = 4
set pRolloverList = [[3: rect(473, 105, 540, 123), 1: rect(264, 271, 339, 289), 1: rect(467, 271, 542, 289), 0: rect(256, 111, 322, 129)], [3: rect(467, 155, 534, 173), 3: rect(462, 225, 529, 243), 1: rect(311, 289, 386, 307), 1: rect(310, 159, 385, 177), 0: rect(310, 109, 376, 127)], [3: rect(479, 91, 546, 109), 3: rect(386, 213, 453, 231), 3: rect(388, 277, 455, 295), 1: rect(383, 90, 458, 108), 1: rect(470, 213, 545, 231), 1: rect(469, 278, 544, 296), 0: rect(290, 90, 356, 108)], [3: rect(464, 80, 531, 98), 3: rect(452, 215, 519, 233), 1: rect(420, 302, 495, 320), 1: rect(332, 303, 407, 321), 0: rect(312, 150, 378, 168), 0: rect(396, 148, 462, 166), 0: rect(355, 215, 421, 233)], [3: rect(480, 91, 547, 109), 4: rect(360, 233, 472, 251), 1: rect(480, 302, 555, 320), 1: rect(281, 303, 356, 321), 0: rect(377, 88, 443, 106)], [3: rect(553, 157, 620, 175), 3: rect(552, 221, 619, 239), 3: rect(407, 188, 474, 206), 1: rect(452, 126, 527, 144), 1: rect(426, 254, 501, 272), 1: rect(296, 234, 371, 252), 1: rect(239, 126, 314, 144), 1: rect(323, 303, 398, 321), 0: rect(245, 71, 311, 89), 0: rect(516, 70, 582, 88), 2: rect(307, 184, 371, 202), 2: rect(532, 309, 596, 327)]]
return me
end mInit
-----------------
--DL
on mActivate me
mInitCircuit me
end
-----------------
--DL
on mClose me
mDoReset me
--tj&dl
repeat with n = 2 to 20
set the puppet of sprite n = 0
set the visible of sprite n = 1
end repeat
puppetsprite 33, false
end
-----------------
on mSetRollovers me, CircuitNumber, First, Last
set pCurrentCircuit = CircuitNumber
set pFirstRolloverSprite = First
set pLastRolloverSprite = Last
end mSetRollovers
on mDoRollovers me
repeat with n = pFirstRolloverSprite to pLastRolloverSprite
if rollover(n) then
set RolloverIndex = (n - pFirstRolloverSprite + 1)
set CurrentList = getAt(pRolloverList, pCurrentCircuit)
set CastIndex = getPropAt(CurrentList, RolloverIndex)
set RolloverRect = getAt(CurrentList, RolloverIndex)
set the puppet of sprite pRolloverSprite = 1
set the castNum of sprite pRolloverSprite = (pFirstRolloverCast + CastIndex)
set the rect of sprite pRolloverSprite = RolloverRect
exit repeat
end if
end repeat
end mDoRollovers
on mMaxSpriteReset me, MaxSprite
set pMaxSprite = MaxSprite
end
-----------------
-- DL
on mDoReset me
repeat with n = pFirstResetSprite to pHighestSprite
set the puppet of sprite n = 0
end repeat
set pSwitchFlag1 = 0
set pSwitchFlag2 = 0
set pSwitchFlag3 = 0
end mDoReset
---------------------------
--DL
on mInitCircuit me
repeat with n = pFirstResetSprite to pMaxSprite -- second
set the puppet of sprite n = 1
end repeat
end mInitCircuit
-----------------------------
-- DL
on mDoSwitch11 me
-- because this circuit is simple, I do not follow the standard path of setting
-- pSwitchFlag and then updating the lights. I do them both in the same handler
if pSwitchFlag = 0 then
set the castnum of sprite pCircuit1Switch1 to pSwitchOnCast
set the castnum of sprite pCircuit1Light1 to pLight3
set the castnum of sprite pCircuit1Light2 to pLight3
set pSwitchFlag = 1
else
set the castnum of sprite pCircuit1Switch1 to pSwitchOffCast
set the castnum of sprite pCircuit1Light1 to pLight1
set the castnum of sprite pCircuit1Light2 to pLight1
set pSwitchFlag = 0
end if
updateStage
end mDoSwitch11
------------------------------
-- DL
on mDoSwitch21 me
if pSwitchFlag1 = 0 then
set pSwitchFlag1 = 1
set the castNum of sprite pCircuit2Switch2 to pSwitchOnCast
else
set pSwitchFlag1 = 0
set the castNum of sprite pCircuit2Switch2 to pSwitchOffCast
end if
mUpdateLights2
end mDoSwitch21
-------------------------------------
-- DL
on mDoSwitch22 me
if pSwitchFlag2 = 0 then
set pSwitchFlag2 = 1
set the castnum of sprite pCircuit2Switch1 to pSwitchOnCast
else
set pSwitchFlag2 = 0
set the castnum of sprite pCircuit2Switch1 to pSwitchOffCast
end if
mUpdateLights2
end mDoSwitch22
---------------------------------------
-- DL
on mUpdateLights2 me
set testnum = 2*pSwitchFlag2 + pSwitchFlag1
if testnum = 0 then
set the castnum of sprite pCircuit2Light1 to pLight1
set the castnum of sprite pCircuit2Light2 to pLight1
end if
if testnum = 1 then
set the castnum of sprite pCircuit2Light1 to pLight3
set the castnum of sprite pCircuit2Light2 to pLight1
end if
if testnum = 2 then
set the castnum of sprite pCircuit2Light1 to pLight1
set the castnum of sprite pCircuit2Light2 to pLight3
end if
if testnum = 3 then
set the castnum of sprite pCircuit2Light1 to pLight4
set the castnum of sprite pCircuit2Light2 to pLight4
end if
updateStage
end mUpdateLights2
----------------------------------------
-- DL
on mDoSwitch31 me
-- check switch state and toggle
if pSwitchFlag1 = 0 then
set the castnum of sprite pCircuit3Switch1 to pSwitchOnCast --5
set pSwitchFlag1 = 1
else
set the castnum of sprite pCircuit3Switch1 to pSwitchOffCast
set pSwitchFlag1 = 0
end if
-- update lights based on positions of all switches
mUpdateLights3
updateStage
end mDoSwitch31
----------------------------------
-- DL
on mDoSwitch32 me
if pSwitchFlag2 = 0 then
set pSwitchFlag2 = 1
set the castnum of sprite pCircuit3Switch2 to pSwitchOnCast
else
set pSwitchFlag2 = 0
set the castnum of sprite pCircuit3Switch2 to pSwitchOffCast
end if
mUpdateLights3
updateStage
end
-------------------------------------
-- DL
on mDoSwitch33 me
if pSwitchFlag3 = 0 then
set pSwitchFlag3 = 1
set the castnum of sprite pCircuit3Switch3 to pSwitchOnCast
else
set pSwitchFlag3 = 0
set the castnum of sprite pCircuit3Switch3 to pSwitchOffCast
end if
mUpdateLights3
updateStage
end mDoSwitch33
---------------------------------------
-- DL
on mUpdateLights3 me
set testnum = pSwitchFlag3*2+pSwitchFlag2
put "testNum:" && testnum
if pSwitchFlag1 = 1 then
if testnum = 0 then
put "O"
set the castnum of sprite pCircuit3Light1 to pLight1
set the castnum of sprite pCircuit3Light2 to pLight1
set the castnum of sprite pCircuit3Light3 to pLight1
end if
if testnum = 1 then
put "1"
set the castnum of sprite pCircuit3Light1 to pLight3
set the castnum of sprite pCircuit3Light2 to pLight3
set the castnum of sprite pCircuit3Light3 to pLight1
end if
if testnum = 2 then
put "2"
set the castnum of sprite pCircuit3Light1 to pLight3
set the castnum of sprite pCircuit3Light2 to pLight1
set the castnum of sprite pCircuit3Light3 to pLight3
end if
if testnum = 3 then
put "3"
set the castnum of sprite pCircuit3Light1 to pLight4
set the castnum of sprite pCircuit3Light2 to pLight4
set the castnum of sprite pCircuit3Light3 to pLight4
end if
else
put "4"
set the castnum of sprite pCircuit3Light1 to pLight1
set the castnum of sprite pCircuit3Light2 to pLight1
set the castnum of sprite pCircuit3Light3 to pLight1
end if
updateStage
end mUpdateLights3
---------------------------------
-- DL
on mDoSwitch41 me
if pSwitchFlag1 = 0 then
set pSwitchFlag1 = 1
set the castnum of sprite pCircuit4Switch1 to pSwitchOnCast --5
else
set pSwitchFlag1 = 0
set the castnum of sprite pCircuit4Switch1 to pSwitchOffCast
end if
mUpdateLights4
updateStage
end mDoSwitch41
----------------------------------
-- DL
on mDoSwitch42 me
if pSwitchFlag2 = 0 then
set pSwitchFlag2 = 1
set the castnum of sprite pCircuit4Switch2 to pSwitchOnCast --6
else
set pSwitchFlag2 = 0
set the castnum of sprite pCircuit4Switch2 to pSwitchOffCast
end if
mUpdateLights4
updateStage
end mDoSwitch42
------------------------------------
-- DL
on mUpdateLights4
set testnum = 2*pSwitchFlag1 + pSwitchFlag2
if testnum = 0 then
set the castnum of sprite pCircuit4Light1 to pLight1
set the castnum of sprite pCircuit4Light2 to pLight1
end if
if testnum = 1 then
set the castnum of sprite pCircuit4Light1 to pLight3
set the castnum of sprite pCircuit4Light2 to pLight3
end if
if testnum = 2 then
set the castnum of sprite pCircuit4Light1 to pLight5
set the castnum of sprite pCircuit4Light2 to pLight5
end if
if testnum = 3 then
set the castnum of sprite pCircuit4Light1 to pLight5
set the castnum of sprite pCircuit4Light2 to pLight5
end if
end mUpdateLights4
----------------------------------
-- DL
on mDoSwitch51 me
if pSwitchFlag1 = 0 then
set pSwitchFlag1 = 1
set the castnum of sprite pCircuit5Switch1 to pSwitchOnCast --5
else
set pSwitchFlag1 = 0
set the castnum of sprite pCircuit5Switch1 to pSwitchOffCast
end if
mUpdateLights5
updateStage
end mDoSwitch51
--------------------------------
-- DL
on mDoSwitch52 me
-- this switch has three states (low, medium and high)
if pSwitchFlag2 = 0 then
set pSwitchFlag2 = 1
set the castnum of sprite pCircuit5Dial1 to pDial1
else
if pSwitchFlag2 = 1 then
set the castnum of sprite pCircuit5Dial1 to pDial2
set pSwitchFlag2 = 2
else
set the castnum of sprite pCircuit5Dial1 to pDial3
set pSwitchFlag2 = 0
end if
end if
mUpdateLights5
updateStage
end mDoSwitch52
--------------------------------
-- DL
on mUpdateLights5
if pSwitchFlag1 = 0 then
set the castnum of sprite pCircuit5Light1 to pLight1 --7
set the castnum of sprite pCircuit5Light2 to pLight1 --8
else
if pSwitchFlag2 = 0 then
set the castnum of sprite pCircuit5Light1 to pLight5
set the castnum of sprite pCircuit5Light2 to pLight5
else
if pSwitchFlag2 = 1 then
set the castnum of sprite pCircuit5Light1 to pLight3
set the castnum of sprite pCircuit5Light2 to pLight3
else
set the castnum of sprite pCircuit5Light1 to pLight2
set the castnum of sprite pCircuit5Light2 to pLight2
end if
end if
end if
end mUpdateLights5
-----------------------------
-- DL
on mDoSwitch61 me
if pSwitchFlag1 = 0 then
set pSwitchFlag1 = 1
set the castnum of sprite pCircuit6Switch1 to pSwitchOnCast --5
else
set pSwitchFlag1 = 0
set the castnum of sprite pCircuit6Switch1 to pSwitchOffCast
end if
mUpdateLights6
updateStage
end mDoSwitch61
-----------------------------
on mDoSwitch62 me
if pSwitchFlag2 = 0 then
set pSwitchFlag2 = 1
set the castnum of sprite pCircuit6Switch2 to pSwitchOnCast --6
else
set pSwitchFlag2 = 0
set the castnum of sprite pCircuit6Switch2 to pSwitchOffCast
end if
mUpdateLights6
updateStage
end mDoSwitch62
-------------------------------
-- DL
on mDoSwitch63
if pSwitchFlag3 = 0 then
set pSwitchFlag3 = 1
set the castnum of sprite pCircuit6Switch3 to pSwitchOnCast --7
else
set pSwitchFlag3 = 0
set the castnum of sprite pCircuit6Switch3 to pSwitchOffCast
end if
mUpdateLights6
updateStage
end mDoSwitch63
--------------------------------
on mUpdateLights6 me
set testnum = 4*pSwitchFlag3+2*pSwitchFlag2+pSwitchFlag1
-- because there are 8 possible outcomes, I use the temporary values (new8 ... new12)
-- to store the value of the lights. Then I update the lights at the end of the different
-- cases.
put testNum
if testnum = 0 then
set new8 = pLight1
set new9 = pLight1
set new10 = pLight1
set new11 = pLight1
set new12 = pLight1
else if testnum = 1 then
set new8 = pLight3
set new9 = pLight1
set new10 = pLight1
set new11 = pLight3
set new12 = pLight1
else if testnum = 2 then
set new8 = pLight1
set new9 = pLight3
set new10 = pLight1
set new11 = pLight1
set new12 = pLight3
else if testnum = 3 then
set new8 = pLight4
set new9 = pLight4
set new10 = pLight1
set new11 = pLight4
set new12 = pLight4
else if testnum = 4 then
set new8 = pLight1
set new9 = pLight1
set new10 = pLight1
set new11 = pLight1
set new12 = pLight1
else if testnum = 5 then
set new8 = pLight5
set new9 = pLight1
set new10 = pLight5
set new11 = pLight5
set new12 = pLight5
else if testnum = 6 then
set new8 = pLight1
set new9 = pLight4
set new10 = pLight4
set new11 = pLight4
set new12 = pLight4
else if testnum = 7 then
set new8 = pLight3
set new9 = pLight3
set new10 = pLight3
set new11 = pLight3
set new12 = pLight3
end if
set the castNum of sprite pCircuit6Light1 to new8 --8
set the castNum of sprite pCircuit6Light2 to new9 --9
set the castNum of sprite pCircuit6Light3 to new10 -- 10
set the castNum of sprite pCircuit6Light4 to new11 -- 11
set the castNum of sprite pCircuit6Light5 to new12 --12
updateStage
end mUpdateLights6