Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- BookPuzzle.lua
- Functions for bookcase puzzle
- --]]
- bookssolved = getObject("Conditions[FoundSecretRoom]")
- feedback = getObject("Values[PuzzleFeedback]")
- allin = getObject("Conditions[B10Inserted]")
- tblOuts = {}
- tblOuts[1] = getObject("Conditions[B1Out]")
- tblOuts[2] = getObject("Conditions[B2Out]")
- tblOuts[3] = getObject("Conditions[B3Out]")
- tblOuts[4] = getObject("Conditions[B4Out]")
- tblOuts[5] = getObject("Conditions[B5Out]")
- tblOuts[6] = getObject("Conditions[B6Out]")
- tblOuts[7] = getObject("Conditions[B7Out]")
- tblOuts[8] = getObject("Conditions[B8Out]")
- tblOuts[9] = getObject("Conditions[B9Out]")
- tblOuts[10] = getObject("Conditions[B10Out]")
- booksol = "12345678910"
- currentrun = {}
- function ResetBooks()
- for x=1,10 do
- tblOuts[x]:setValue(VConditionValue,false) -- all books back in
- currentrun = {}
- feedback:setValue(VValueString,"Back to where we started...")
- end
- end
- function ClickBook(book)
- feedback:setValue(VValueString,"")
- if tblOuts[book]:getBool(VConditionValue) then -- reset all on push back
- ResetBooks()
- else
- tblOuts[book]:setValue(VConditionValue,true)
- currentrun[#currentrun+1] = book
- end
- -- check for puzzle completion
- if #currentrun==9 and allin:getBool(VConditionValue)==false then
- ResetBooks()
- feedback:setValue(VValueString,"Hmmm... something is still missing.")
- elseif #currentrun==10 and allin:getBool(VConditionValue)==true then
- currentsol = ""
- for x=1,10 do
- currentsol = currentsol..currentrun[x]
- end
- if currentsol==booksol then
- feedback:setValue(VValueString,"That must be right. Something is happening.")
- bookssolved:setValue(VConditionValue,true)
- else
- ResetBooks()
- feedback:setValue(VValueString,"Hmmm... I guess that wasn't correct.")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement