I'm adding on to my program that has may options with an os.pullEvent("char"). now I'm working with miscperipherals' chat turtles, and it adds an event os.pullEvent("chat"). I would like to be able to push w for a turtle.forward(). but at the same time I'd like to be able to say "forward "..number in the chat box and have it follow whichever event type it receives at the time.
Edit: Actually.... Wouldn't this be in a parallel.waitForAny(os.pullEvent(), os.pullEvent()) ???
[Solved] 2 Simultaneous Os.pullevent(Type)
Started by CCJJSax, Aug 31 2013 01:50 AM
2 replies to this topic
#1
Posted 31 August 2013 - 01:50 AM
#2
Posted 31 August 2013 - 02:00 AM
I would try this:
while true do
event, p1, p2 = os.pullEvent()
if event=="char" then
if p1=="w" then
turtle.forward()
end
elseif event=="chat" then
if p1=="forward" then
turtle.forward()
end
end
end
#3
Posted 31 August 2013 - 02:30 AM
BigTwisty, on 31 August 2013 - 02:00 AM, said:
I would try this:
while true do event, p1, p2 = os.pullEvent() if event=="char" then if p1=="w" then turtle.forward() end elseif event=="chat" then if p1=="forward" then turtle.forward() end end end
Yep. That did it
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











