singe/testScripts/author/picture.forge

37 lines
1.3 KiB
Text

-- The pictureAt condition: what the disc's picture is at a point. One watcher counts the frames
-- the spot reads dark and the frames it reads bright, so a run with no video proves the documented
-- answer (dark everywhere, since the engine reads zeroes when nothing is playing) and a run with
-- --framefile proves the condition sees the picture change.
return {
title = "Author test: the picture at a point",
players = 1,
size = { w = 720, h = 480 },
layers = { { kind = "overlay" } },
vars = { dark = 0, bright = 0, neither = 0 },
types = {
watcher = { look = { kind = "none" } }
},
rooms = {
{ name = "only", reset = true,
entities = {
{ id = "eye", type = "watcher", x = 8, y = 8 }
} }
},
rules = {
{ note = "The spot is dark",
on = "frame", each = "watcher",
when = { { "pictureAt", x = 200, y = 120, is = "dark" } },
act = { { "addVar", name = "dark", amount = 1 } } },
{ note = "The spot is bright",
on = "frame", each = "watcher",
when = { { "pictureAt", x = 200, y = 120, is = "bright" } },
act = { { "addVar", name = "bright", amount = 1 } } },
{ note = "The spot is neither",
on = "frame", each = "watcher",
when = { { "pictureAt", x = 200, y = 120, is = "unknown" } },
act = { { "addVar", name = "neither", amount = 1 } } }
}
}