Minichan

Topic: Web Browser Code

Anonymous A started this discussion 11 years ago #46,570

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?

Anonymous B joined in and replied with this 11 years ago, 21 minutes later[^] [v] #613,913

What language is that?

Syntax joined in and replied with this 11 years ago, 1 hour later, 1 hour after the original post[^] [v] #613,925

Web browser Coke

Anonymous D joined in and replied with this 11 years ago, 3 hours later, 5 hours after the original post[^] [v] #613,952

k

Syntax joined in and replied with this 11 years ago, 7 hours later, 12 hours after the original post[^] [v] #613,999

@613,925 (Syntax)

Anonymous A (OP) replied with this 11 years ago, 21 minutes later, 12 hours after the original post[^] [v] #614,000

@613,913 (B)
Lua

Anonymous D replied with this 11 years ago, 11 minutes later, 13 hours after the original post[^] [v] #614,002

@613,913 (B)
Autism (pure)

Anonymous A (OP) replied with this 11 years ago, 7 minutes later, 13 hours after the original post[^] [v] #614,007

@previous (D)
So software developers have autism? Okay.
:

Please familiarise yourself with the rules and markup syntax before posting.