2004-08-21 14:02:45 +02:00
|
|
|
function process(orders)
|
|
|
|
-- read game and orders
|
2003-12-28 16:30:43 +01:00
|
|
|
local turnfile = "" .. get_turn()
|
|
|
|
if read_game(turnfile)~=0 then
|
|
|
|
print("could not read game")
|
|
|
|
return -1
|
2003-12-16 00:20:41 +01:00
|
|
|
end
|
2004-08-21 14:02:45 +02:00
|
|
|
|
|
|
|
-- read the orders file
|
|
|
|
read_orders(orders)
|
|
|
|
|
|
|
|
-- set up the sphinx
|
2004-08-29 10:53:02 +02:00
|
|
|
-- init_sphinxhints()
|
2004-08-19 00:24:48 +02:00
|
|
|
sphinx_handler()
|
2004-08-21 14:02:45 +02:00
|
|
|
sphinx_weekly()
|
|
|
|
|
|
|
|
-- run the turn:
|
2005-10-02 18:06:12 +02:00
|
|
|
-- (no more braineaters) spawn_braineaters(0.25)
|
2004-06-23 00:00:36 +02:00
|
|
|
plan_monsters()
|
2003-12-28 16:30:43 +01:00
|
|
|
process_orders()
|
|
|
|
outfile = "" .. get_turn()
|
2003-12-16 00:20:41 +01:00
|
|
|
|
|
|
|
-- write out the initial reports (no need to run a turn)
|
|
|
|
write_passwords()
|
|
|
|
write_reports()
|
|
|
|
|
2004-08-21 14:02:45 +02:00
|
|
|
-- siegbedingungen ausgeben
|
|
|
|
write_standings()
|
2003-12-16 00:20:41 +01:00
|
|
|
|
2004-08-21 14:02:45 +02:00
|
|
|
-- save the game
|
2003-12-18 00:11:52 +01:00
|
|
|
if write_game(outfile)~=0 then
|
2003-12-16 00:20:41 +01:00
|
|
|
print("could not write game")
|
|
|
|
return -1
|
|
|
|
end
|
|
|
|
end
|
2004-08-19 00:24:48 +02:00
|
|
|
|
2004-08-21 14:02:45 +02:00
|
|
|
--
|
|
|
|
-- main body of script
|
|
|
|
--
|
|
|
|
|
2004-08-19 00:24:48 +02:00
|
|
|
print("- Running wdw-run.lua")
|
2003-12-16 00:20:41 +01:00
|
|
|
|
2005-10-08 23:34:00 +02:00
|
|
|
scripts = {
|
|
|
|
"spells.lua",
|
2005-10-29 16:48:37 +02:00
|
|
|
"extensions.lua",
|
2004-08-21 14:02:45 +02:00
|
|
|
"wdw-sphinx.lua",
|
|
|
|
"wdw-standings.lua"
|
2004-08-08 09:45:30 +02:00
|
|
|
}
|
|
|
|
|
2004-08-21 14:02:45 +02:00
|
|
|
-- orderfile: contains the name of the orders.
|
|
|
|
if orderfile==nil then
|
|
|
|
print "you must specify an orderfile"
|
|
|
|
else
|
|
|
|
for index in scripts do
|
|
|
|
local script = scriptpath .. "/" .. scripts[index]
|
|
|
|
print("- loading " .. script)
|
|
|
|
if pcall(dofile, script)==0 then
|
|
|
|
print("Could not load " .. script)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
process(orderfile)
|
2004-08-08 09:45:30 +02:00
|
|
|
end
|