Hi guys,
I'm trying to get my head around how the SetFlag, TestFlag, ClearFlag and ToggleFlag procedures are working and used in Al's LSL3 source. I'm comparing this to the RE source by sluicebox.
First problem. If I define these procedures in my main.sc they don't seem to be working when I calling them in my rooms scripts, eg: (TestFlag 15). I have to add the procedure to the top of the room script in order for it to work. It does not seem to like being declared in the main.sc Do I have to declare them somewhere else if I want the room scripts to have access to them?
main.sc
(procedure (SetFlag flag)
(= [gFlagArray (/ flag 16)]
(| [gFlagArray (/ flag 16)] (>> $8000 (mod flag 16)))
)
)
(procedure (ClearFlag flag)
(= [gFlagArray (/ flag 16)]
(& [gFlagArray (/ flag 16)] (~ (>> $8000 (mod flag 16))))
)
)
(procedure (ToggleFlag flag) ; UNUSED
(= [gFlagArray (/ flag 16)]
(^ [gFlagArray (/ flag 16)] (>> $8000 (mod flag 16)))
)
)
(procedure (TestFlag flag)
(return
(if (& [gFlagArray (/ flag 16)] (>> $8000 (mod flag 16))) 1 else 0)
)
)
Second question: In Al's LSL3 source he declares the flagArray with enum's in the GAME.SH. I like the way he has defined enum names for these flags as it makes this easier to track when using something similar. Where is the best place to define these so they are accessible to all my rooms scripts? In the main.sc or in the SCI Companion's default template GAME.SH?
flagArray 111 ;** Access only from SetFlg, ClrFlg,
(enum ;** TglFlg and TstFlg Procedures.
logging ;** 111
loadDebugNext
showFrag
cantSave
preventAutoSave
noCursor
drankRiverWater
drankSinkWater
needsShower
seenPatti
needsSoap
scoredTan
lookedInMirror
sawAl&BillPoof
inQA
forceAtest
beenIn206 ;** 112
beenIn200
beenIn203
beenIn210
beenIn216
beenIn220
beenIn250
beenIn350
sawCredits200
sawCredits210
sawCredits213
sawCredits216
sawCredits220
sawCredits250
sawCredits253
sawCredits260
beenIn266 ;** 113
beenIn360
beenIn395
beenIn440
beenIn330
beenIn510
beenIn323
scoredTowel
scoredLocker
scoredSweats
scoredWater ;** filled the bottle with water
scoredDuckPoints
scoredCombination
scoredSuzi
passedSRcopyCheck
tippedMaitreD
seenCherri ;** 114
showerRunning
wetBody
lockerRippedOff
hadBambi
missedBambi
scoredOrchids
madeLei
seenDale
scoredDale
pickedPot
woreGrassSkirt
sprayedDeodorant
saidHiToTawni
needsDeodorant
usedElevator
seenJodiStrip ;** 115
gaveHead
beenIn480
tipsIn450
killedPorky
tookShortcut
missedKeycardPoints
seenBambi
pantyhoseOff
braLess
braLoaded
scoredBraLess
scoredBraLoaded
skippedLogRide
nextFlag
)
Thanks,