- –By S0N_G0KU_Z
- local pos = 18
- mon = peripheral.wrap("right")
- mon.clear()
- mon = setBackgroundColor(32768)
- mon.setTextColor(1)
- mon.setTextScale(5)
- while true do
- if pos==-30
- then pos = 18
- end
- mon.clear()
- mon.setCursorPos(pos,1)
- mon.write("WELOCOME")
- pos = pos-1
- os.sleep(0.15)
- end
- local mon = peripheral.wrap("right")
- local img = paintutils.loadImage("logo")
- term.redirect(mon)
- paintutils.drawImage(img,1,1)
- term.restore()
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Help
Started by S0N_G0KU_Z, 14 April 2013 - 02:18 PMPosted 14 April 2013 - 04:18 PM
Im trying to write a program that th screen has WELCOME flashing on it and when i touch it it displays logog can someone help me it get startup:7: attempt to call nil
Posted 14 April 2013 - 04:22 PM
local pos = 18
local mon = peripheral.wrap("right")
mon.clear()
mon.setBackgroundColor(32768)
mon.setTextColor(1)
mon.setTextScale(5)
while true do
if pos == 30 then
pos = 18
end
mon.clear()
mon.setCursorPos(pos,1)
mon.write("WELOCOME")
pos = pos-1
sleep(0.15)
end
local img = paintutils.loadImage("logo")
term.redirect(mon)
paintutils.drawImage(img,1,1)
term.restore()
You were redefining the variable mon.Posted 15 April 2013 - 04:22 AM
thank you but how do i get it so whn i click the screen it changes to the logo
Posted 15 April 2013 - 04:36 AM
while true do
local ev = os.pullEvent()
if ev == "mouse_click" then
--logo
else
--something else
end
end
Posted 15 April 2013 - 06:00 AM
thank you all so much but were would it put that SuicidalSTDz
Posted 15 April 2013 - 06:01 AM
EDIT So just flash Welcome, then if someone clicks display the logo, correct?
Posted 15 April 2013 - 06:19 AM
Here, try this:
local w,h = term.getSize()
local pos = w
local mon = peripheral.wrap("right")
local function scrollText(text)
for i = 1,w+#text do
mon.clear()
mon.setCursorPos(pos,1)
mon.write(text)
sleep(0.1)
pos = pos-1
end
pos = w
end
local function welcome()
mon.setBackgroundColor(32768)
mon.setTextColor(1)
mon.setTextScale(5)
while true do
scrollText("WELCOME")
end
end
local function click()
local ev = os.pullEvent("mouse_click")
local img = paintutils.loadImage("logo")
term.redirect(mon)
paintutils.drawImage(img,1,1)
term.restore()
return
end
parallel.waitForAny(welcome,click)
Posted 15 April 2013 - 10:35 AM
thnanks but now im getting a parallel:22: error it works but i when i click it dosent change
Posted 15 April 2013 - 10:36 AM
and i wanted it a touch screenthnanks but now im getting a parallel:22: error it works but i when i click it dosent change
Sorry if you dont answer im a noob i feel bad if im bothering anyone if so you can kick me off this website :(/>
Posted 15 April 2013 - 02:11 PM
Im sorry to bother anyone but can i have an awnser or will i get kicked from this site
Posted 15 April 2013 - 04:48 PM
Whoops, sorry. I was busy doing something.
local w,h = term.getSize()
local pos = w
local mon = peripheral.wrap("right")
local function scrollText(text)
for i = 1,w+#text do
mon.clear()
mon.setCursorPos(pos,1)
mon.write(text)
sleep(0.1)
pos = pos-1
end
pos = w
end
local function welcome()
mon.setBackgroundColor(32768)
mon.setTextColor(1)
mon.setTextScale(5)
while true do
scrollText("WELCOME")
end
end
local function click()
local ev = os.pullEvent("monitor_touch")
local img = paintutils.loadImage("logo")
term.redirect(mon)
paintutils.drawImage(img,1,1)
term.restore()
end
parallel.waitForAny(welcome,click)