potinho
Intermediate OT User
Hello everyone, everything good? I have a global event where a TP is created for a room. If I put in the setup just one day, it works. If I put it every day, it doesn't start, it doesn't give an error on the console and it doesn't work. can you help me?
in globalevents.xml i have
Lua:
local configuration = {
day = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"},
to_pos = {x = 503, y = 1246, z = 9}, --Para onde o teleport levará.
pos = {x = 503, y = 1237, z = 9}, --Onde o teleport será criado.
teleport_id = 1387, --ID do teleport.
}
function onTime()
if os.date("%A") == configuration.day then
local item = getTileItemById(configuration.pos, configuration.teleport_id).uid
if item > 0 then
doRemoveItem(item, 1)
broadcastMessage("Master Yalahari's portal has closed.", MESSAGE_STATUS_WARNING)
else
doCreateTeleport(configuration.teleport_id, configuration.to_pos, configuration.pos)
broadcastMessage("The portal to defeat the Yalahari master has opened.", MESSAGE_STATUS_WARNING)
end
end
return true
end
in globalevents.xml i have
XML:
<globalevent name="YalaharBoss" time="08:51" event="script" value="yalaharboss.lua"/>
<globalevent name="YalaharClose" time="09:01" event="script" value="yalaharboss.lua"/>
Post automatically merged:
Forgot, just remove day config from script. worksHello everyone, everything good? I have a global event where a TP is created for a room. If I put in the setup just one day, it works. If I put it every day, it doesn't start, it doesn't give an error on the console and it doesn't work. can you help me?
Lua:local configuration = { day = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, to_pos = {x = 503, y = 1246, z = 9}, --Para onde o teleport levará. pos = {x = 503, y = 1237, z = 9}, --Onde o teleport será criado. teleport_id = 1387, --ID do teleport. } function onTime() if os.date("%A") == configuration.day then local item = getTileItemById(configuration.pos, configuration.teleport_id).uid if item > 0 then doRemoveItem(item, 1) broadcastMessage("Master Yalahari's portal has closed.", MESSAGE_STATUS_WARNING) else doCreateTeleport(configuration.teleport_id, configuration.to_pos, configuration.pos) broadcastMessage("The portal to defeat the Yalahari master has opened.", MESSAGE_STATUS_WARNING) end end return true end
in globalevents.xml i have
XML:<globalevent name="YalaharBoss" time="08:51" event="script" value="yalaharboss.lua"/> <globalevent name="YalaharClose" time="09:01" event="script" value="yalaharboss.lua"/>
Last edited: