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

i can't figure out the code to get this working

Started by block12345, 09 December 2013 - 01:45 AM
block12345 #1
Posted 09 December 2013 - 02:45 AM
soo i have question about some stuff

so i have a chat box and i want a fast way to make it say what i type so if i typed hi it will type in the chat hi

EX:

chat = peripheral.wrap("right")

print ("enter chat")
i want to eat
chat.say("i want to eat")

so what want it to do is i can type whatever i want in the computer and it will say it

i need help figureing this out
Goof #2
Posted 09 December 2013 - 10:54 AM
First ask the user for input… then read that with the read(). then make the chat.say say it_


local chat = peripheral.wrap("right") -- wrap the chatbox
term.clear() -- clear the screen
term.setCursorPos(1,1) -- set the cursorpos to 1,1 ( upper left corner )
term.write("Enter a word to say: ") -- print the text on the computer
local word = read() -- store the typed message in the "word" variable
chat.say(word) -- input the word variable in the chat.say

Not tested… but it should work
Edited on 09 December 2013 - 09:55 AM
block12345 #3
Posted 09 December 2013 - 03:38 PM
thx