Check to see if object exists?(SOLVED)

onimike
09 Sept 2016, 15:41Edited: Solved just used a flag to check works fine now still open to suggestions thou.
Hey again your favorite question asker here lol. Got a little problem not serious but looks awful when object is not set. What im doing is I have a day and night cycle and everything works even when game.campfire is not set problem is thou I get errors as quest is trying to find game.campfire when its not set and fills screen with ugly errors. Here is code
IncreaseObjectCounter (player, "Hour")
if (GetInt(player, "Hour") = 24) {
IncreaseObjectCounter (player, "Days")
player.Hour = 1
}
if (GetInt(player, "Hour") >= 17) {
SetObjectFlagOff (player, "day")
msg ("its night")
EnableTimer (Exposed)
if (not IsSwitchedOn(game.campfire)) {
if (ListContains(ScopeReachable(), game.campfire)) {
SetDark (player.parent)
}
}
else {
SetDark (player.parent)
}
}
else if (GetInt(player, "Hour") < 7) {
SetObjectFlagOff (player, "day")
msg ("its night")
EnableTimer (Exposed)
if (not IsSwitchedOn(game.campfire)) {
if (ListContains(ScopeReachable(), game.campfire)) {
SetDark (player.parent)
}
}
else {
SetDark (player.parent)
}
}
else if (GetInt(player, "Hour") >= 7) {
SetObjectFlagOn (player, "day")
msg ("its day time")
SetLight (player.parent)
DisableTimer (Exposed)
}
Now I have a basic idea of just setting a flag and if flag is set then check but wanted to ask is there a better way or is that the best way for a quick reference? Thanks in advanced!
Mike