Posted 16 January 2015 - 05:31 PM
Hello
I am currently working on a system to swap blocks in an bloodmagic altar.
It works by using redstone signals of variating colors to trigger the switch.
the only thing it has to do first is to swap the default block back to its position by applying a signal to the last used switcher.
The only thing is i can't seem to get my code working.
I was hoping someone can see what i am doing wrong.
Thanks in advance.
I am currently working on a system to swap blocks in an bloodmagic altar.
It works by using redstone signals of variating colors to trigger the switch.
the only thing it has to do first is to swap the default block back to its position by applying a signal to the last used switcher.
The only thing is i can't seem to get my code working.
I was hoping someone can see what i am doing wrong.
Thanks in advance.
recieveComp = 8
switchNr = 6
rednet.open("top")
ToFile = fs.open("TempFile", "w")
FromFile = fs.open("TempFile", "r")
function EmptyFile()
ReadFile()
if CurrentBlock == "" then
writeToFile("Home")
end
end
function check()
ReadFile()
switch(CurrentBlock)
case "Red": pulse(colors.red)
case "Green": pulse(colors.green)
case "Brown": pulse(colors.brown)
case "Blue": pulse(colors.blue)
case "Purple": pulse(colors.purple)
case "Cyan": pulse(colors.cyan)
case "Light Gray": pulse(colors.lightGray)
case "Gray": pulse(colors.gray)
case "Pink": pulse(colors.pink)
case "Home": print("alreadySomething There")
end
end
function pulse(pulseColor)
rs.setBundledOutput("back", pulseColor)
sleep(0,5)
rs.setBundledOutput("back", colors.white)
end
function writeToFile(Blank)
ToFile.write(Blank)
ToFile.close()
end
function ReadFile()
CurrentBlock = FromFile.readLine()
FromFile.close()
end
function swapAugCap()
if CurrentBlock == "Red" then
break
else
check()
writeToFile("Red")
check()
end
end
function swapDisLoc()
if CurrentBlock == "Green" then
break
else
check()
writeToFile("Green")
check()
end
end
function swapOrb()
if CurrentBlock == "Brown" then
break
else
check()
writeToFile("Brown")
check()
end
end
function swapSupCap()
if CurrentBlock == "Blue" then
break
else
check()
writeToFile("Blue")
check()
end
end
function swapAcc()
if CurrentBlock == "Purple" then
break
else
check()
writeToFile("Purple")
check()
end
end
function swapSpe()
if CurrentBlock == "Cyan" then
break
else
check()
writeToFile("Cyan")
check()
end
end
function swapEff()
if CurrentBlock == "Light Gray" then
break
else
check()
writeToFile("Light Gray")
check()
end
end
function swapSac()
if CurrentBlock == "Gray" then
break
else
check()
writeToFile("Gray")
check()
end
end
function swapSelSac()
if CurrentBlock == "Pink" then
break
else
check()
writeToFile("Pink")
check()
end
end
while true do
EmptyFile()
event = os.pullEvent("rednet_message")
senderID, message = rednet.recieve(switchNr, 5)
if senderID == recieveComp then
switch(message)
case 1: swapAugCap()
case 2: swapDisLoc()
case 3: swapOrb()
case 4: swapSupCap()
case 5: swapAcc()
case 6: swapSpe()
case 7: swapEff()
case 8: swapSac()
case 9: swapSelSac()
end
end
end
Edited on 16 January 2015 - 04:35 PM