Sentinel3
New Member
- Joined
- Oct 16, 2014
- Messages
- 180
- Reaction score
- 0
Hello everyone,
I wanted to make a raid for every day or something like that, and I got this error in console, i don't know how can I fix this type of problems with time and date?
Error in console:
/data/globalevent.xml (TAG)
/data/globalevents/raids.lua
I wanted to make a raid for every day or something like that, and I got this error in console, i don't know how can I fix this type of problems with time and date?
Error in console:
HTML:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/spawn/raids.lua:onThink
data/globalevents/scripts/spawn/raids.lua:15: attempt to call global 'getRealDate' (a nil value)
stack traceback:
[C]: in function 'getRealDate'
data/globalevents/scripts/spawn/raids.lua:15: in function <data/globalevents/scripts/spawn/raids.lua:14>
[Error - GlobalEvents::think] Failed to execute event: RaidSystem
/data/globalevent.xml (TAG)
HTML:
<globalevent name="RaidSystem" interval="10000" script="spawn/raids.lua"/>
HTML:
local raids = {
-- Weekly
['Monday'] = {
['08:00'] = {raidName = 'RatsThais'},
['15:00'] = {raidName = 'Arachir the Ancient One'}
},
['Wednesday'] = {
['12:00'] = {raidName = 'OrcsThais'}
},
-- By date (Day/Month)
['31/10'] = {
['16:00'] = {raidName = 'Halloween Hare'}
}
}
function onThink(interval, lastExecution, thinkInterval)
local day, date = os.date('%A'), getRealDate()
local raidDays = {}
if raids[day] then
table.insert(raidDays, raids[day])
end
if raids[date] then
table.insert(raidDays, raids[date])
end
if #raidDays == 0 then
return true
end
for i = 1, #raidDays do
local settings = raidDays[i][getRealTime()]
if settings and not settings.alreadyExecuted then
Game.startRaid(settings.raidName)
settings.alreadyExecuted = true
end
end
return true
end