slp13at420
Mad Scientist
so i have this script I have been trying to get-to work:
the objective of this is every 30 minutes it will call the function `CreateRankList();`.
I have it added to the list at the end of the script:
I gets called for the first time during config load:
the timer starts fine after getting called.
but never executes.
the variable `id` is always 0 and never calls `CreateRankList()`
I do have another timed event that is a player timed event and it works fine.
ugh any ideas what im missing?
Code:
[COLOR="#808080"]class GGW_RankTimer : public WorldScript
{
public:
GGW_RankTimer() : WorldScript("GGW_RankTimer")
{
TC_LOG_INFO("server.loading", "RE-RANK TIMER START"); // fires once
events.ScheduleEvent(1, 5000);
}
void OnUpdate(uint32 diff) override
{
uint32 id = events.ExecuteEvent();
TC_LOG_INFO("server.loading", "1ST RE-RANK TIMER UPDATE AI ID:%u", id); // allways returns a 0....
while (uint32 id = events.ExecuteEvent())
{
TC_LOG_INFO("server.loading", "2ND RE-RANK TIMER UPDATE AI ID:%u", id); // never
switch (id)
{
case 1:
CreateRankList();
break;
}
}
}
EventMap events;
};
[/COLOR]
the objective of this is every 30 minutes it will call the function `CreateRankList();`.
I have it added to the list at the end of the script:
Code:
[COLOR="#808080"]
void AddSC_Grunboz_Guild_Warz()
{
new GGW_RankTimer;
[/COLOR]
I gets called for the first time during config load:
Code:
[COLOR="#808080"]
virtual void OnConfigLoad(bool /*reload*/)
{
new GGW_RankTimer();
[/COLOR]
the timer starts fine after getting called.
Code:
[COLOR="#808080"]
RE-RANK TIMER START
[/COLOR]
the variable `id` is always 0 and never calls `CreateRankList()`
Code:
[COLOR="#808080"]
1ST RE-RANK TIMER UPDATE AI ID:0
[/COLOR]
I do have another timed event that is a player timed event and it works fine.
Code:
[COLOR="#808080"]
class GGW_PigPayz : public BasicEvent
{
public:
GGW_PigPayz(Player* _player) : player(_player)
{
_player->m_Events.AddEvent(this, _player->m_Events.CalculateTime(GUILDWARZ_PIGPAYZ_TIMER)); // 1000 = 1 second // 60000 = 1 minute
}
bool Execute(uint64, uint32) override
{
PigPayz(player);
new GGW_PigPayz(player);
return true;
}
Player* player;
};
[/COLOR]
ugh any ideas what im missing?
Last edited: