Based on the Visionaire Studio Guide by Chris Tikkos (Dionous Games), published here with his permission.
This script shows a simple list of open tasks or objectives on screen. Add it as a definition script. Tasks are added and removed with an Execute a script action part:
add_task("pick up paycheck")
remove_task("pick up paycheck")
Task names are case sensitive. The list uses the font example; change the name to one of your fonts. The font's size, color, border and shadow are used.
task_list = {} -- open tasks
function draw_tasks()
if #task_list == 0 then return end
graphics.font = Fonts["example"]
-- x position, y position, opacity
graphics.drawFont(table.concat(task_list, "\n"), 100, 100, 1)
end
-- -1 = below the scene, 0 = above the scene, 1 = above the interfaces
graphics.addDrawFunc("draw_tasks()", 1)
function add_task(str)
for i = 1, #task_list do
if task_list[i] == str then return end -- already in the list
end
table.insert(task_list, str)
end
function remove_task(str)
for i = #task_list, 1, -1 do
if task_list[i] == str then table.remove(task_list, i) end
end
end
The draw functions are described in the Graphics and media API. Test whether the list survives saving and loading in your game; if not, store the tasks in values or conditions as well.