Posted 25 August 2013 - 05:03 PM
Title: I cannot get this rednet chat script to work
I've been teaching myself some lua in computercraft and lately I've been messing around with rednet. I'm trying to make a simple chat script that displays messages in a sort-of irc format. Whenever it receives a rednet message it just hangs and won't respond to anything other than ctrl+s. Here's my code:
If you could help me that'd be awesome! Thanks.
edit: spelling :o/>
I've been teaching myself some lua in computercraft and lately I've been messing around with rednet. I'm trying to make a simple chat script that displays messages in a sort-of irc format. Whenever it receives a rednet message it just hangs and won't respond to anything other than ctrl+s. Here's my code:
aa = " "
bb = " "
cc = " "
dd = " "
ee = " "
ff = " "
gg = " "
hh = " "
ii = " "
jj = " "
kk = " "
ll = " "
mm = " "
nn = " "
oo = " "
pp = " "
qq = " "
rr = "Logged on"
function updateChat()
term.setCursorPos(1,1)
aa = bb
print(aa)
bb = cc
print(bb)
cc = dd
print(cc)
dd = ee
print(dd)
ee = ff
print(ee)
ff = gg
print(ff)
gg = hh
print(gg)
hh = ii
print(hh)
ii = jj
print(ii)
jj = kk
print(jj)
kk = ll
print(kk)
ll = mm
print(ll)
mm = nn
print(mm)
nn = oo
print(nn)
oo = pp
print(oo)
pp = qq
print(pp)
qq = rr
print(qq)
rr = chat
print(rr)
end
updateChat()
rednet.open("back")
term.clear()
term.setCursorPos(1,19)
print("Chat V0.1 - hyphon to quit")
event, id, chat = os.pullEvent()
a = true
while true do
sleep(0)
if event == "key" and id == 41 then
term.setCursorPos(1,1)
term.clear()
break
elseif event == "rednet_message" then
sleep(0)
updateChat()
end
end
If you could help me that'd be awesome! Thanks.
edit: spelling :o/>