Code: Select all
function ButtonPuzzle() --Controls the entire button puzzle
local Hundreds, Tens, Units = 0,0,0 --Creates the Hundreds, Tens and Units variables.
--Variable assignment
Hundreds_Counter:getValue() = Hundreds --Assigns the value from the Hundreds_Counter to the variable Hundreds.
Tens_Counter:getValue() = Tens --Assigns the value from the Tens_Counter to the variable Tens.
Units_Counter:getValue() = Units --Assigns the value from the Units_Counter to the variable Units.
--Main Method
if Hundreds == 1 and Tens == 1 and Units == 3 then --Checks that all the buttons were pressed the correct amount of times.
hudPrint ("Correct Answer!)
ButtonPuzzle_Door:Open --Opens the door at the end of the room so the player can progress the level.
else
hudPrint ("Incorrect Answer!)
hudprint("Hundreds ="Hundreds" Tens="Tens" and Units ="Units) --Helps the player by telling them what they inputted.
hudPrint ("Resetting Puzzle...")
Hundreds_Counter:reset() --Resets the Hundreds_Counter back to 0.
Tens_Counter:reset() --Resets the Tens_Counter back to 0.
Units_Counter:reset() --Resets the Units_Counter back to 0.
end --End ButtonPuzzle
What I have done badly here?