24 posts
Posted 08 May 2012 - 11:53 AM
can anyone help me to make adverising monitor (right side)
so i can type in my text (auto update pastebin)
my lua knowlegde is 0%
thanks all
24 posts
Posted 08 May 2012 - 01:43 PM
i need to ask you something too
can oyu make that i write message to display? and that /clear clears monitor?
thanks
24 posts
Posted 08 May 2012 - 01:44 PM
and also help how to set it up using woreless, thanks again
236 posts
Location
Germany
Posted 08 May 2012 - 03:20 PM
this shoud do :)/>/>
local function open() --this function detects any monitor
local bOpen, sFreeSide = false, nil
for n,sSide in pairs(rs.getSides()) do
if peripheral.getType( sSide ) == "monitor" then
return sSide
end
end
return false
end -- end of the function
x = open() -- this checks if the function said that a monitor is given
if x == false then
print("please add a monitor") -- end of the check
else
local m = peripheral.wrap(x) -- this adds the monitor
shell.run("clear") -- this shows the ui
print("Please enter the text to display:n(/clear will delete)") -- end of ui
while true do -- this creates an infinite loop
local txt = read() -- this reads your input
if txt ~= "/clear" then -- this checks if u didn't entered /clear
m.write(txt) -- this writes the text on the monitor
else -- this checks if u entered /clear
m.clear() -- this clears the monitor
m.setCursorPos(1,1) -- this sets the monitor coursor to the start
end -- end of the /clear check
end -- end of the declared loop
end -- end of the monitor check
it auto detects the monitor side and terminates if no monitor is given
ps: the – at the beginning indicates a comment
24 posts
Posted 10 May 2012 - 08:50 AM
thanks guys, i really like this! ♥
24 posts
Posted 10 May 2012 - 08:53 AM
but now, how to go orther line :)/>/>
for instance /line
sholud do this? :)/>/>
236 posts
Location
Germany
Posted 16 May 2012 - 04:28 PM
but now, how to go orther line :P/>/>
for instance /line
sholud do this? :D/>/>
well thats a bit harder cuz the monitor only has the write function not the print which does that automaticly but there is this woraround im gonna give u
ill repost all the code + the new stuff
local function open() --this function detects any monitor
local bOpen, sFreeSide = false, nil
for n,sSide in pairs(rs.getSides()) do
if peripheral.getType( sSide ) == "monitor" then
return sSide
end
end
return false
end -- end of the function
x = open() -- this checks if the function said that a monitor is given
if x == false then
print("please add a monitor") -- end of the check
else
local m = peripheral.wrap(x) -- this adds the monitor
shell.run("clear") -- this shows the ui
print("Please enter the text to display:n(/clear will delete)") -- end of ui
while true do -- this creates an infinite loop
local txt = read() -- this reads your input
if txt ~= "/clear" then -- this checks if u didn't entered /clear
m.write(txt) -- this writes the text on the monitor
else -- this checks if u entered /clear
m.clear() -- this clears the monitor
m.setCursorPos(1,1) -- this sets the monitor coursor to the start
end -- end of the /clear check
if txt =="/line" then
x,y = m.getCursorPos()
y = y + 1
m.setCursorPos(x,y)
end -- end of the /line
end -- end of the declared loop
end -- end of the monitor check
hope this works ;)/>/> didnt test it in the game tell me if not im gonna fix it