91 posts
Posted 16 January 2013 - 03:18 PM
Please go here to see code as I cannot figure out how to copy over Thank you
btw this is just the send code
http://pastebin.com/MLaPHVyQ
7508 posts
Location
Australia
Posted 16 January 2013 - 03:36 PM
pastebin is a good place to put it anyways
Where you have this all over the place
local event, con = os.pullEvent("key203")
it wont work… should be
local event, con = os.pullEvent("key")
your line here checks the key code…
if con == 203 then
-- do the stuff you need to here
end
91 posts
Posted 16 January 2013 - 03:45 PM
omg thankyou i will try it
91 posts
Posted 16 January 2013 - 03:58 PM
7508 posts
Location
Australia
Posted 16 January 2013 - 04:00 PM
ok so now I'm assuming the next issue you posted that link for is that only one key works?
91 posts
Posted 16 January 2013 - 04:07 PM
im getting a bios: [string "control"]:16: '<eof>' expected
7508 posts
Location
Australia
Posted 16 January 2013 - 04:10 PM
looks at code *wild else appears on line 16*
remove the else and it should be good
91 posts
Posted 16 January 2013 - 04:11 PM
i fixed that with removing the else and i think if i get 1 key works ill just make the con to cad ras ert and other random variables
im gonna start on the recive code
7508 posts
Location
Australia
Posted 16 January 2013 - 04:15 PM
the reason the other keys dont work is because the program is tied up in the first loop…
change the check to this
local event, con = os.pullEvent("key")
if con == 203 then
-- do something
elseif con == 205 then
-- do something else
elseif -- etc etc etc
end
91 posts
Posted 16 January 2013 - 04:29 PM
that wouldnt work you would need
while true do
[indent=1]local event,con os.pullEvent(key)[/indent]
[indent=1]if con == ___ then[/indent]
[indent=1]ect[/indent]
[indent=1]ect[/indent]
[indent=1]end[/indent]
[indent=1]local event, cod os.pullevent(key)[/indent]
7508 posts
Location
Australia
Posted 16 January 2013 - 04:31 PM
no i can tell you that it will work…
while true do
is an infinite loop, so it pulls an event each loop and stores the key that was pressed to cause the event…
then all you need to do is check the key against what you want with if elseif when you need to check multiple keys…
EDIT: Oh i just realised what you meant… the code i suggested is for inside the loop… not replacing the loop
Edited on 16 January 2013 - 03:32 PM
91 posts
Posted 16 January 2013 - 04:55 PM
91 posts
Posted 16 January 2013 - 04:57 PM
lol ill fix the first one and post my final thx
91 posts
Posted 16 January 2013 - 04:59 PM
while true do
local event, con = os.pullEvent("key")
rednet.open("left")
elseif if con == 205 then
rednet.send(1, "turnRight")
elseif rednet.close("left")
end
end
is that what u meant?
7508 posts
Location
Australia
Posted 16 January 2013 - 05:06 PM
here is your turtle code fixed
http://pastebin.com/QQpjxNDUhere is your console code fixed
http://pastebin.com/yMC1aBMa
91 posts
Posted 16 January 2013 - 05:35 PM
can i keep that as my own or should i just take yours? as yours… thx tho
7508 posts
Location
Australia
Posted 16 January 2013 - 05:39 PM
can i keep that as my own or should i just take yours? as yours… thx tho
Not sure I understand what you mean… if you mean do I 'own' the rights to that code… no i don't… I'm here helping you, so its all yours…