This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Mike_Wazowski00's profile picture

Chat Box Wont Say Variables

Started by Mike_Wazowski00, 24 August 2013 - 10:30 AM
Mike_Wazowski00 #1
Posted 24 August 2013 - 12:30 PM
Im writing a code for my server when someone dies to say LOL player DIED!!!! :D/>

mainly just to tick people off as a joke but this happens
chat:5: bad argument #2 (expected number)
i tried having it print on the computer and it works just fine, what am i doing wrong?

cb = peripheral.wrap("left")

while true do
 e,player,killer,cause = os.pullEvent("chat_death")
 cb.say("LOL ",player," DIED!!! :D/>")
end

also ignore the />/> in the print message, BB code added them

ty in advanced:)
Lyqyd #2
Posted 24 August 2013 - 12:51 PM
You're using a weird feature of the print command, which only works for print (and possibly write). You should use actual concatenation instead:


cb.say("Unfortunately, "..player.." is dead.")

Notice the two periods together. That's the concatenation operator, and it joins it all into one string.
Mike_Wazowski00 #3
Posted 24 August 2013 - 01:27 PM
ty!