• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Mod] Automatic Raids [Day and Hour]

This script is not working for me on TFS 0.3.6
I get error message
[21/11/2014 00:45:21] [Error - GlobalEvent Interface]
[21/11/2014 00:45:21] buffer
[21/11/2014 00:45:21] Description:
[21/11/2014 00:45:21] [string "days = {..."]:5: '}' expected near '='

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Automatic Raids" version="1.0" author="Vodkart And xotservx" contact="otl.com" enabled="yes">
<config name="raids_func"><![CDATA[
days = {
["Monday"] = {
["15:30"] = {
nome = "Orshabaal",
pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"5 Demon", "2 Orshabaal"},
Time = 15
},
["22:00"] = {
nome = "Evil Sorcerer",
pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"10 Evil Sorcerer"},
Time = 20
}
},
["Sunday"] = {
["15:00"] = {
nome = "Demon",
pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"20 Demon"},
Time = 15
},
["22:00"] = {
nome = "Evil Sorcerer",
pos = pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"10 Evil Sorcerer"},
Time = 20
}
},
["Saturday"] = {
["15:00"] = {
nome = "Grims",
pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"40 Grim Reaper"},
Time = 15
},
["22:00"] = {
nome = "Evil Sorcerer",
pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"10 Evil Sorcerer"},
Time = 20
}
},
["Friday"] = {
["00:50"] = {
nome = "Terrible Dragon",
pos = pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"15 Terrible Dragon"},
Time = 15
},
["22:00"] = {
nome = "Ferumbras",
pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"1 Ferumbras, 3 Orshabaal"},
Time = 20
}
},
["Thursday"] = {
["10:08"] = {
nome = "Demon",
pos = pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"20 Demon"},
Time = 15
},
["22:00"] = {
nome = "Evil Sorcerer",
pos = pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"10 Evil Sorcerer"},
Time = 20
}
},
["Wednesday"] = {
["15:00"] = {
nome = "Demon",
pos = pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"20 Demon"},
Time = 15
},
["22:00"] = {
nome = "Tank",
pos = pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"1 Tank"},
Time = 20
}
},
["Tuesday"] = {
["15:00"] = {
nome = "Orshabaal",
pos = pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"5 Orshabaal"},
Time = 15
},
["22:00"] = {
nome = "Rotworm Queen",
pos = pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
m = {"1 Rotworm queen"},
Time = 20
}
}
}
]]></config>
<globalevent name="AutomaticRaids" interval="60" event="script"><![CDATA[
domodlib('raids_func')
function onThink(interval, lastExecution)
if days[os.date("%A")] then
hours = tostring(os.date("%X")):sub(1, 5)
tb = days[os.date("%A")][hours]
if tb then
function removeCreature(tb)
for x = ((tb.pos.fromPosition.x)-10), ((tb.pos.toPosition.x)+10) do
for y = ((tb.pos.fromPosition.y)-10), ((tb.pos.toPosition.y)+10) do
local m = getTopCreature({x=x, y=y, z=tb.pos.fromPosition.z}).uid
if m ~= 0 and isMonster(m) then
doRemoveCreature(m)
end
end
end
end
doBroadcastMessage("The invasion of " .. tb.nome .. " started")
for _,x in pairs(tb.m) do
for s = 1, tonumber(x:match("%d+")) do
pos = {
x = math.random(tb.pos.fromPosition.x,tb.pos.toPosition.x),
y = math.random(tb.pos.fromPosition.y, tb.pos.toPosition.y),
z = tb.pos.fromPosition.z
}
doSummonCreature(x:match("%s(.+)"), pos)
end
end
addEvent(removeCreature, tb.Time*60*1000, tb)
end
end
return true
end
]]></globalevent>
</mod>
 
Bump, anyone know's why? :(

Get this error message aswell while server is running.

Code:
[Error - GlobalEvent Interface]
buffer:onThink
Description:
[string "loadBuffer"]:3: attempt to index global 'days' (a nil value)
stack traceback:
        [string "loadBuffer"]:3: in function <[string "loadBuffer"]:2>
[Error - GlobalEvents::think] Couldn't execute event: AutomaticRaids
 
Change
Code:
pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
To
Code:
pos = {fromPosition = {x=953, y=973, z=7}, toPosition = {x=1068, y=1014, z=7}},
So remove {fromPosition = pos = and the } at the end, do the same thing for the other days.
 
Change
Code:
pos = {fromPosition = pos = {fromPosition = {x=953, y=973, z=7},toPosition = {x=1068, y=1014, z=7} } },
To
Code:
pos = {fromPosition = {x=953, y=973, z=7}, toPosition = {x=1068, y=1014, z=7}},
So remove {fromPosition = pos = and the } at the end, do the same thing for the other days.
That sorted teh error message I got while starting the server up.

But I still get this error over and over again when the server is up.
Code:
[Error - GlobalEvent Interface]
buffer:onThink
Description:
[string "loadBuffer"]:3: attempt to index global 'days' (a nil value)
stack traceback:
        [string "loadBuffer"]:3: in function <[string "loadBuffer"]:2>
[Error - GlobalEvents::think] Couldn't execute event: AutomaticRaids
 
Back
Top