[DiscordArchive] will that work?
[DiscordArchive] will that work?
Archived author: MR.MUSTACHE • Posted: 2019-04-28T22:06:08.503000+00:00
Original source
I mean if I add to the diff
Archived author: MR.MUSTACHE • Posted: 2019-04-28T22:06:30.398000+00:00
Original source
a check
if(m_queue.size() > 0)
Archived author: MR.MUSTACHE • Posted: 2019-04-28T22:06:37.716000+00:00
Original source
it starts ticking?
Archived author: Rochet2 • Posted: 2019-04-28T22:07:23.045000+00:00
Original source
hmm, not sure what you mean.
Archived author: Elliot • Posted: 2019-04-28T22:07:29.548000+00:00
Original source
<@248138535968833537> We have the same system as of now
Archived author: Rochet2 • Posted: 2019-04-28T22:09:22.606000+00:00
Original source
<@477468968559443999> in the previous script you already used the diff. this is not different in any way.
{Archived author: MR.MUSTACHE • Posted: 2019-04-28T22:10:06.466000+00:00
Original source
example
```cpp
class checkQueue : public WorldScript
{
public:
checkQueue() : WorldScript("checkQueue")
{
}
void OnUpdate(uint32 diff) override
{
if (m_queue.size() > 0)
{
for (auto it = m_queue.begin(); it != m_queue.end()
{
Player* player = ObjectAccessor::FindPlayer(*it);
if (!player)
m_queue.remove(*it);
}
}
}
private:
char msg[500];
};
```
Archived author: MR.MUSTACHE • Posted: 2019-04-28T22:10:33.975000+00:00
Original source
if (m_queue.size() > 0)
trigger the WorldScript
Archived author: MR.MUSTACHE • Posted: 2019-04-28T22:10:49.531000+00:00
Original source
I don't really know how WorldScripts are triggered
Archived author: Rochet2 • Posted: 2019-04-28T22:12:10.961000+00:00
Original source
OnUpdate triggers just like UpdateAI, it is run multiple times every second (or as fast as server can keep up).
the code looks fine.
Except that you are currently not doing `else ++it;` after erase