37 posts
Posted 24 September 2012 - 09:48 PM
I've got a question
I build up a very complex redstone thingy:
(!WARNING! Big Image !WARNING!)
Spoiler
And got code like this:
Spoiler
if rs.testBundledInput("back", colors.blue) then
print("Blue")
elseif
rs.testBundletInput("back", colors.pink) then
print("Pink")
end
- I want it to write "Blue" if the Blue wire is powered only (that works)
- I want it to write "Pink" if the Pink wire is powered only (that works)
- I want it to write "Pink and Blue" if both wires are powered (don't work)
Now my question is how do i put this
rs.testBundletInput("back", colors.****) then
For 2 coloured wires :P/>/>
thanks for help
864 posts
Location
Sometime.
Posted 24 September 2012 - 09:57 PM
rs.getTestInput("back", colors.pink)
c = colors.combine( colors.pink, colors.blue )
if rs.getTestInput("back", colors.pink) then
-- code
elseif rs.getTestInput("back", colors.blue) then
-- code
elseif rs.getTestInput("back", c) then
-- code
end
I think that should work for it.
37 posts
Posted 24 September 2012 - 10:07 PM
rs.getTestInput("back", colors.pink)
c = colors.combine( colors.pink, colors.blue )
if rs.getTestInput("back", colors.pink) then
-- code
elseif rs.getTestInput("back", colors.blue) then
-- code
elseif rs.getTestInput("back", c) then
-- code
end
I think that should work for it.
Now i have this:
c = colors.combine( colors.pink, colors.blue )
if rs.getTestInput("back", colors.pink) then
print("Pink")
elseif rs.getTestInput("back", colors.blue) then
print("Blue"
elseif rs.getTestInput("back", c) then
print("Pink and Blue")
end
But i get this
'test:2: attempt to call nill'
1111 posts
Location
Portland OR
Posted 24 September 2012 - 10:08 PM
Use noodles method only stick with the rs.testBundledInput() command, getTestInput() is not a valid command.
So
c = colors.combine( colors.pink, colors.blue )
if rs.testBundledInput("back", colors.pink) then
-- code
elseif rs.testBundledInput("back", colors.blue) then
-- code
elseif rs.testBundledInput("back", c) then
-- code
end
1604 posts
Posted 24 September 2012 - 10:09 PM
Easier way, don't use elseif:
if rs.testBundledInput("back", colors.blue) then
print("Blue")
end
if rs.testBundledInput("back", colors.pink) then
print("Pink")
end
37 posts
Posted 24 September 2012 - 10:12 PM
Use noodles method only stick with the rs.testBundledInput() command, getTestInput() is not a valid command.
So
c = colors.combine( colors.pink, colors.blue )
if rs.testBundledInput("back", colors.pink) then
-- code
elseif rs.testBundledInput("back", colors.blue) then
-- code
elseif rs.testBundledInput("back", c) then
-- code
end
Do not work either…
Easier way, don't use elseif:
if rs.testBundledInput("back", colors.blue) then
print("Blue")
end
if rs.testBundledInput("back", colors.pink) then
print("Pink")
end
And how about pink and blue at the same time? :P/>/>
1604 posts
Posted 24 September 2012 - 10:15 PM
And how about pink and blue at the same time? :P/>/>
Have you tried that? It works as you want. It first checks for blue and if it's on prints "Blue", then it checks for pink and if it's on it prints "Pink". So if both are on, it will print "Blue" then "Pink".
1111 posts
Location
Portland OR
Posted 24 September 2012 - 10:16 PM
You might have to use an and statement
if rs.testBundledInput("back", colors.blue) and rs.testBundledInput("back", colors.pink) then
print("Pink and Blue")
elseif rs.testBundledInput("back", colors.blue) then
print("Blue")
elseif rs.testBundledInput("back", colors.pink) then
print("Pink")
end
37 posts
Posted 24 September 2012 - 10:21 PM
And how about pink and blue at the same time? ;)/>/>
Have you tried that? It works as you want. It first checks for blue and if it's on prints "Blue", then it checks for pink and if it's on it prints "Pink". So if both are on, it will print "Blue" then "Pink".
You might have to use an and statement
if rs.testBundledInput("back", colors.blue) and rs.testBundledInput("back", colors.pink) then
print("Pink and Blue")
elseif rs.testBundledInput("back", colors.blue) then
print("Blue")
elseif rs.testBundledInput("back", colors.pink) then
print("Pink")
end
Thank you two :D/>/> again :P/>/>
And sorry to you MysticT i tried after i wrote. stupid me..
864 posts
Location
Sometime.
Posted 24 September 2012 - 10:28 PM
Ohlol.. Didn't realize.
Forgot testBundled.. I just replaced bundled with test -.-