home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 2006 April
/
Gamestar_83_2006-04_dvd.iso
/
Dema
/
keepsake_demo_en.exe
/
res
/
scripts
/
tools.tcl
< prev
next >
Wrap
Text File
|
2005-12-07
|
13KB
|
610 lines
proc checkConversation { name code } {
if { [ozGet $name] != "ok" } {
ozSet $name "ok"
eval $code
}
}
proc checkPreReq { name } {
if { [ozGet $name] != "ok" } {
return break
}
return continue
}
proc checkTime { time } {
if { [ozGet "sysTimeSinceLastEvent"] < $time } {
return queue
}
return continue
}
proc standardFadeout { } {
cameraFadeout 500
delay 500
}
proc standardFadein { } {
cameraFadein 500
delay 500
}
## ===================================================== ##
## Set the Event Priority ##
## ===================================================== ##
proc setEventPriority { event priority } {
set list [ozGet "$priority"]
append list " $event"
ozSet "$priority" $list
}
## ===================================================== ##
## Check the Event Priority ##
## ===================================================== ##
proc checkEventPriority { } {
set emergencyList [ozGet "emergency"]
set shortList [ozGet "short"]
set mediumList [ozGet "medium"]
set longList [ozGet "long"]
if { [ozGet "emergencyTime"] == "" } {ozSet "emergencyTime" [expr 1500 + [random 15000]]}
if { [ozGet "shortTime"] == "" } {ozSet "shortTime" [expr 30000 + [random 30000]]}
if { [ozGet "mediumTime"] == "" } {ozSet "mediumTime" [expr 60000 + [random 60000]]}
if { [ozGet "longTime"] == "" } {ozSet "longTime" [expr 90000 + [random 90000]]}
if { [llength $emergencyList] > 0 && [ozGet "sysTimeSinceLastClose"] > [ozGet "emergencyTime"] } {
ozSet "emergencyTime" ""
set index [ random [llength $emergencyList] ]
set event [lindex $emergencyList $index]
set emergencyList [ldelete $emergencyList $event]
callEvent $event
ozSet "emergency" $emergencyList
return continue
} elseif { [llength $shortList] > 0 && [ozGet "sysTimeSinceLastClose"] > [ozGet "shortTime"] } {
ozSet "shortTime" ""
set index [ random [llength $shortList] ]
set event [lindex $shortList $index]
set shortList [ldelete $shortList $event]
callEvent $event
ozSet "short" $shortList
return continue
} elseif { [llength $mediumList] > 0 && [ozGet "sysTimeSinceLastClose"] > [ozGet "mediumTime"] } {
ozSet "mediumTime" ""
set index [ random [llength $mediumList] ]
set event [lindex $mediumList $index]
set mediumList [ldelete $mediumList $event]
callEvent $event
ozSet "medium" $mediumList
return continue
} elseif { [llength $longList] > 0 && [ozGet "sysTimeSinceLastClose"] > [ozGet "longTime"] } {
ozSet "longTime" ""
set index [ random [llength $longList] ]
set event [lindex $longList $index]
set longList [ldelete $longList $event]
callEvent $event
ozSet "long" $longList
return continue
}
return queue
}
proc deleteEventPriority {event priority} {
set list [ozGet "$priority"]
set list [ldelete $list $event]
ozSet $priority $list
}
###########################################
## PROC ITEM NAME
###########################################
proc GetObjectName {obj} {
switch -exact $obj {
wineBottle {
return $::lng::wineBottleName
}
caretakerTools {
return $::lng::caretakerToolsName
}
figurine {
return $::lng::figurineName
}
circlet {
return $::lng::circletName
}
pendant {
return $::lng::pendantName
}
brokenPendant {
return $::lng::pendantName
}
noteBook {
return $::lng::noteBookName
}
wineCaveClue {
return $::lng::wineCaveClueName
}
magicalStaff {
return $::lng::magicalStaffName
}
doll {
return $::lng::dollName
}
caretakerNote {
return $::lng::caretakerNoteName
}
caretakerKey {
return $::lng::caretakerKeyName
}
keyRing {
return $::lng::keyRingName
}
headenFlowerPage {
return $::lng::headenFlowerPageName
}
yewlockLeavesPage {
return $::lng::yewlockLeavesPageName
}
nigilisPage {
return $::lng::nigilisPageName
}
headenFlower {
return $::lng::headenFlowerName
}
yewlockLeavesBlue {
return $::lng::yewlockLeavesName
}
yewlockLeavesRed {
return $::lng::yewlockLeavesName
}
yewlockLeavesWhite {
return $::lng::yewlockLeavesName
}
yewlockLeavesYellow {
return $::lng::yewlockLeavesName
}
nigilisSeed {
return $::lng::nigilisSeedName
}
nigilisFruit {
return $::lng::nigilisFruitName
}
catHair {
return $::lng::catHairName
}
wolfDrool {
return $::lng::wolfDribbleName
}
dragonClaw {
return $::lng::dragonClawName
}
celeste {
return $::lng::celestePortraitName
}
aleunderRoot {
return $::lng::aleunderName
}
oracleMoss {
return $::lng::oracleMossName
}
eternalFlame {
return $::lng::eternalFlameName
}
pearl {
return $::lng::pearlName
}
starFragment {
return $::lng::meteoriteName
}
soulDust {
return $::lng::soulDustName
}
orbNotes {
return $::lng::orbNotesName
}
handWrittenNotes {
return $::lng::nathanielNoteName
}
tapestryObservatory {
return $::lng::clueObservatoryName
}
tapestryForge {
return $::lng::clueForgeName
}
tapestryArtRoom {
return $::lng::clueArtRoomName
}
tapestrySolarium {
return $::lng::clueSolariumName
}
spellbook {
return $::lng::spellbookName
}
libraryBallEntrance {
return $::lng::libraryBallName
}
libraryBallPink {
return $::lng::libraryBallName
}
libraryBallAqua {
return $::lng::libraryBallName
}
libraryBallBrown {
return $::lng::libraryBallName
}
}
}
###########################################
## PROC ITEM DESC
###########################################
proc GetObjectDesc {obj} {
switch -exact $obj {
wineBottle {
return $::lng::wineBottleDesc
}
figurine {
return $::lng::figurineDesc
}
caretakerTools {
return $::lng::caretakerToolsDesc
}
circlet {
return $::lng::circletDesc
}
pendant {
return $::lng::pendantDesc
}
brokenPendant {
return $::lng::pendantBrokenDesc
}
wineCaveClue {
return $::lng::wineCaveClueDesc
}
magicalStaff {
return $::lng::magicalStaffDesc
}
doll {
return $::lng::dollDesc
}
caretakerNote {
return $::lng::caretakerNoteDesc
}
caretakerKey {
return [subst [subst {$::lng::caretakerKeyDesc}]]
}
keyRing {
return $::lng::keyRingDesc
}
noteBook {
return $::lng::noteBookDesc
}
headenFlowerPage {
if { [ozGet "itemCirclet"] == "pickedUp" } {
return $::lng::headenFlowerPageWithCircletDesc
} else {
return $::lng::headenFlowerPageNoCircletDesc
}
}
yewlockLeavesPage {
if { [ozGet "itemCirclet"] == "pickedUp" } {
return $::lng::yewlockLeavesPageWithCircletDesc
} else {
return $::lng::yewlockLeavesPageNoCircletDesc
}
}
nigilisPage {
if { [ozGet "itemCirclet"] == "pickedUp" } {
return $::lng::nigilisPageWithCircletDesc
} else {
return $::lng::nigilisPageNoCircletDesc
}
}
headenFlower {
return $::lng::headenFlowerDesc
}
yewlockLeavesBlue {
return $::lng::yewlockLeavesDesc
}
yewlockLeavesRed {
return $::lng::yewlockLeavesDesc
}
yewlockLeavesWhite {
return $::lng::yewlockLeavesDesc
}
yewlockLeavesYellow {
return $::lng::yewlockLeavesDesc
}
nigilisSeed {
if { [ozGet "itemCirclet"] == "pickedUp" && [ozGet "itemPagesNigilis"] == "pickedUp" } {
return $::lng::nigilisSeedDesc
} else {
return $::lng::nigilisSeedUnknownDesc
}
}
nigilisFruit {
return $::lng::nigilisFruitDesc
}
catHair {
return $::lng::catHairDesc
}
wolfDrool {
return $::lng::wolfDribbleDesc
}
dragonClaw {
return $::lng::dragonClawDesc
}
celeste {
return $::lng::celestePortraitDesc
}
aleunderRoot {
return $::lng::aleunderDesc
}
oracleMoss {
return $::lng::oracleMossDesc
}
eternalFlame {
return $::lng::eternalFlameDesc
}
pearl {
return $::lng::pearlDesc
}
starFragment {
return $::lng::meteoriteDesc
}
soulDust {
return $::lng::soulDustDesc
}
orbNotes {
return $::lng::orbNotesDesc
}
handWrittenNotes {
return $::lng::nathanielNoteDesc
}
tapestryObservatory {
return $::lng::clueObservatoryDesc
}
tapestryForge {
return $::lng::clueForgeDesc
}
tapestryArtRoom {
return $::lng::clueArtRoomDesc
}
tapestrySolarium {
return $::lng::clueSolariumDesc
}
spellbook {
return $::lng::spellbookDesc
}
libraryBallEntrance {
return $::lng::libraryBallDesc
}
libraryBallPink {
return $::lng::libraryBallDesc
}
libraryBallAqua {
return $::lng::libraryBallDesc
}
libraryBallBrown {
return $::lng::libraryBallDesc
}
}
}
proc canZakTalk {} {
# Zoomin!
if {[ozGet "interface.backevent"] != ""} {
return 0
}
# Interface?
if [oz'widget::visible? $::itf::sidebar] {
return 0
}
if [oz'widget::visible? $::itf::desc] {
return 0
}
# Zak Away from Lydia
if {[ozGet "zakPresence"] == "away"} {
return 0
}
if {[ozGet "zakHide"] == "initiated"} {
return 0
}
# Char 3D hidden
if {![ozEntityLydia isvisible]} {
return 0
}
if {![ozEntityZak isvisible]} {
return 0
}
# Lydia speak with another NPC
if {[ozGet "npcDiscussion"] == "initiated"} {
return 0
}
if [ozIConv isVisible] {
return 0
}
if [ozITalk isVisible] {
return 0
}
# Playing Zak
if {[ozGet "characterControlled"] == "Zak"} {
return 0
}
if {[ozGet "mainCharacter"] == "zak"} {
return 0
}
if {[ozGet "sanctuaryZakSwitch"] == "initiated"} {
return 0
}
# Game is loading
if {!$::isGameReady} {
return 0
}
# Lydia is Walking
if {![ozEntityLydia isidle]} {
return 0
}
return 1
}
proc TooFarAway {} {
# FIXME: Text not in language!
wizqTalkOpen
if [expr int(rand() * 2)] {
wizqTalkSay Lydia "I am too far away to use this!" ""
} else {
wizqTalkSay Zak "You should get a little closer before using this." ""
}
wizqTalkClose
}
proc CrashPlanB {} {
# FIXME: Text not in language!
if {[ozGet "puzzleMidgard"] != "complete"} {
oz'event {
ozEntityLydia set position 337 -19.7 -365
ozEntityZak set position 337 -19.7 -365
setScene dragonvaleAcademy world
}
} else {
oz'event {
ozEntityLydia set position 347 734 262
ozEntityZak set position 347 734 262
setScene mainBuilding world
}
}
oz'event {showInterface}
oz'event {showMouse}
wizqTalkOpen
wizqTalkSay Unknown "Sorry, to prevent an unexpected error, we have teleported you to this location..." ""
wizqTalkClose
}
proc CloseAllSounds {} {
oz'track::stop $::music_track
foreach v [info vars ::sfx::*] {
oz'sound::fadeto [set $v] 0 5
set $v 0
}
}