Re: (WIP) Curious Conundrum / CFD 2012 submission
Posted: Tue Dec 04, 2012 7:28 am
This is what I'm thinking so far:
Now there's just the missing IF/THEN section missing that checks if the firsts are true to set firstSolutionFound to true, and if the seconds are true, set secondSolutionFound to true...and where to put in the damage.
Does that work with an "OR" in it? Does that part after the "OR" need to be nested before the damage, so it looks for the first half, then if not true, checks the second set, THEN if both aren't true, damage.
That looks like it could be right, but when I tried to test it, got "unexpected symbol near 'for'" thrown at the first "for" after the first "and".
Oh, and I still need to know how to recolor the lights from the temple_ceiling_light.
Code: Select all
function checkAlcoveForItems()
local firstSolutionFound = false
local secondSolutionFound = false
local firstBlueRight = false
local firstGreenRight = false
local firstRedRight = false
local secondBlueRight = false
local secondGreenRight = false
local secondRedRight = false
for i in dungeon_alcove_1:containedItems() do
if i.name == "blue_gem" then
firstBlueRight = true
break
else
firstBlueRight = false
break
end
end
for i in dungeon_alcove_4:containedItems() do
if i.name == "red_gem" then
firstRedRight = true
break
else
firstRedRight = false
break
end
end
for i in dungeon_alcove_5:containedItems() do
if i.name == "green_gem" then
firstGreenRight = true
break
else
firstGreenRight = false
break
end
end
if firstSolutionFound then
playSound("level_up")
exitdoor:open()
else
exitdoor:close()
end
if secondSolutionFound then
playSound("level_up")
prizedoor:open()
else
prizedoor:close()
endCode: Select all
function checkForSolution()
for i in dungeon_alcove_1:containedItems() do
if i.name == "blue_gem" and
for i in dungeon_alcove_4:containedItems() do
if i.name == "red_gem" and
for i in dungeon_alcove_5:containedItems() do
if i.name == "green_gem" then
exitdoor:open()
break
else
spawn("poison_cloud", party.level, party.x, party.y, 0)
or
for i in dungeon_alcove_2:containedItems() do
if i.name == "green_gem" and
for i in dungeon_alcove_3:containedItems() do
if i.name == "red_gem" and
for i in dungeon_alcove_5:containedItems() do
if i.name == "blue_gem" then
prizedoor:open()
break
else
spawn("poison_cloud", party.level, party.x, party.y, 0)
end
end
end
end
end
end
end
how many of these ends do I need?Does that work with an "OR" in it? Does that part after the "OR" need to be nested before the damage, so it looks for the first half, then if not true, checks the second set, THEN if both aren't true, damage.
Code: Select all
function checkForSolution()
for i in dungeon_alcove_1:containedItems() do
if i.name == "blue_gem" and
for i in dungeon_alcove_4:containedItems() do <-- unexpected symbol near "for"
if i.name == "red_gem" and
for i in dungeon_alcove_5:containedItems() do
if i.name == "green_gem" then
exitdoor:open()
break
else
for i in dungeon_alcove_2:containedItems() do
if i.name == "green_gem" and
for i in dungeon_alcove_3:containedItems() do
if i.name == "red_gem" and
for i in dungeon_alcove_5:containedItems() do
if i.name == "blue_gem" then
prizedoor:open()
break
else
spawn("poison_cloud", party.level, party.x, party.y, 0)
end
end
end
end
end
end
end
end
end
end
end
endOh, and I still need to know how to recolor the lights from the temple_ceiling_light.