I messed around with the ComputerCraft and Web Display mods for Minecraft and made a little controller program for the Web Display screens, except I am having a problem getting it to take text input for text boxes. I want to make it so that I do not have to use the in-game keyboard.
function clr()
term.clear()
term.setCursorPos(1,1)
end
-- Location of the "Computer Interface" block
local scr = peripheral.wrap("bottom")
-- Quick Statistics
print("Is the monitor connected?")
test = scr.isLinked()
if test == true then
print("Ready")
end
print()
print("What is the screen's position?")
x, y, z = scr.getScreenPos()
print("X: " .. x .. ", Y: " .. y .. ", Z: " .. z)
sleep(1)
clr()
-- Main Body
print[[Welcome to my ComputerCraft web browser, of sorts.
1 - Get Current URL
2 - Get New URL
3 - Enter New Text
]]
write("What would you like to do? ")
ans = read()
if ans == "1" then
currentUrl = scr.getUrl()
print()
print("Current url is " .. currentUrl)
sleep(5)
clr()
elseif ans == "2" then
print()
write("Enter new url ")
newUrl = read()
scr.setUrl(newUrl)
clr()
elseif ans == "3" then
print()
webTxt = read()
print(scr.type(webTxt))
else
scr.setUrl("about:blank")
end
I'm at a lost here since it seems like scr.type() does not work despite this being what the mod author used in this video.
Did I do something wrong? @previous (D)
So software developers have autism? Okay.