Jump to content




Help


10 replies to this topic

#1 S0N_G0KU_Z

  • Members
  • 16 posts

Posted 14 April 2013 - 03: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


  • --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()


#2 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 14 April 2013 - 03: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.

#3 S0N_G0KU_Z

  • Members
  • 16 posts

Posted 15 April 2013 - 03:22 AM

thank you but how do i get it so whn i click the screen it changes to the logo

#4 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 15 April 2013 - 03:36 AM

while true do
 local ev = os.pullEvent()
 if ev == "mouse_click" then
  --logo
 else
  --something else
 end
end


#5 S0N_G0KU_Z

  • Members
  • 16 posts

Posted 15 April 2013 - 05:00 AM

thank you all so much but were would it put that SuicidalSTDz

#6 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 15 April 2013 - 05:01 AM

So when you click the screen you want the logo to appear, right? What do you want to appear if you click the screen again?

EDIT So just flash Welcome, then if someone clicks display the logo, correct?

#7 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 15 April 2013 - 05: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)


#8 S0N_G0KU_Z

  • Members
  • 16 posts

Posted 15 April 2013 - 09:35 AM

thnanks but now im getting a parallel:22: error it works but i when i click it dosent change

#9 S0N_G0KU_Z

  • Members
  • 16 posts

Posted 15 April 2013 - 09:36 AM

View PostS0N_G0KU_Z, on 15 April 2013 - 09:35 AM, said:

thnanks but now im getting a parallel:22: error it works but i when i click it dosent change
and i wanted it a touch screen

Sorry if you dont answer im a noob i feel bad if im bothering anyone if so you can kick me off this website :(

#10 S0N_G0KU_Z

  • Members
  • 16 posts

Posted 15 April 2013 - 01:11 PM

Im sorry to bother anyone but can i have an awnser or will i get kicked from this site

#11 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 15 April 2013 - 03: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)






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users