I have done a few source code edits of my own, so that would need to be done (the merging) anyhow, when the time comes to upgrade the server source.
I was myself puzzling over how to implement a "live" time change switch, like you mentioned, instead of just triggering on zoning.
Incidentally, I have managed to break this script again, by trying to reverse what we coded and cancel out the night time buff when it's day time. I will highlight the area I think caused the problem, and explain why I think it happened.
Code:
sub EVENT_TIMER {
if ($timer eq "Zoned") {
quest::stoptimer("Zoned");
if ($zonesn=~/Nexus/i && !defined $qglobals{"NexusBind"}) {
quest::selfcast(35);
quest::setglobal("NexusBind", 1, 5, "F");
}
if ($zonetime > 599 && $zonetime < 1900) { #it is day time
if($client->FindBuff(346)){ #find night buff
$client->Message(12, "The darkness wanes.");
$client->BuffFadeBySpellID(346); #cancel night buff
$client->Message(12, "The sun's rays beam down.");
quest::selfcast(992); #cast day buff
} else { #does not have night buff
quest::selfcast(992);
} else { #it is night time
$client->Message(12, "It's very dark outside.");
if($client->FindBuff(992)){ #find day buff
$client->Message(12, "The sunlight fades.");
$client->BuffFadeBySpellID(992); #cancel day buff
quest::selfcast(346); #cast night buff
} else { #does not have the day buff
quest::selfcast(346); #cast night buff
}
}
}
}
}
I believe this happened because we've kept the night check as just an "else" statement and not actually coded in the times that it considers to be night, so when I added another "else" in there, it's getting confused about what's actually going on. This is why I thought we needed to actually designate the specific times of night, instead of just going by "else" --- does that make sense, and am I correct in thinking this is what caused the problem?