Jump to content




[HELP][LUA] Text wont print.


  • You cannot reply to this topic
14 replies to this topic

#1 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 22 April 2013 - 04:34 AM

Hi! Im updating my OS (MackOS) and I want the version to print.
But it wont show the text when I try to print it.

Relevant code:
function drawDesktop2()
  slc = 2
  term.setBackgroundColor(backColor)
  term.clear()
  term.setTextColor(txtcol)
  paintutils.drawImage(logo,1,1)
  paintutils.drawImage(icon,3,10)
  titleBar2()
  term.setCursorPos(1,10)
  print("Running Version: "..Version)

end

What's wrong?

#2 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 22 April 2013 - 04:56 AM

View PostMackan90096, on 22 April 2013 - 04:34 AM, said:

Hi! Im updating my OS (MackOS) and I want the version to print.
But it wont show the text when I try to print it.

Relevant code:
function drawDesktop2()
  slc = 2
  term.setBackgroundColor(backColor)
  term.clear()
  term.setTextColor(txtcol)
  paintutils.drawImage(logo,1,1)
  paintutils.drawImage(icon,3,10)
  titleBar2()
  term.setCursorPos(1,10)
  print("Running Version: "..Version)

end

What's wrong?
Where have you defined the "txtcol" and the "backcolor" variable?

#3 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 22 April 2013 - 04:57 AM

What's more important:
Where's your relevant code for the "Version" variable that you're trying to print?

#4 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 22 April 2013 - 04:57 AM

At the very beginning are my current variables:

bar1 = paintutils.loadImage(".bar1")
logo = paintutils.loadImage(".logo")
icon = paintutils.loadImage(".icon")
TriviaLogo = paintutils.loadImage(".trivia")
tBarC = 8
tBartC = 1
backColor = 1
scroll = 0
Version = "1.1"
credCol = 32
firstCol = 1
secCol = 2048
Author  = "Mackan90096"
ErrCol1 = 16384
calcCol = 256
txtcol = 16384


#5 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 22 April 2013 - 04:59 AM

Ok, what happens in titleBar2() ?
Maybe it never returns and thus it will never get to the point where it can print?

Why don't you just give us the whole code? Then we don't have to guess and ask for more and more code.
Don't get me wrong, not trying to bash you. :)

#6 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 22 April 2013 - 05:00 AM

What's the last colour that get's printed with the icon paintutils image?
What does the function titleBar2 do?

My feeling is that the text colour is the same colour as the background making you unable to see it, have you checked that?

#7 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 22 April 2013 - 05:01 AM

View PostEspen, on 22 April 2013 - 04:59 AM, said:

Ok, what happens in titleBar2() ?
Maybe it never returns and thus it will never get to the point where it can print?

Why don't you just give us the whole code? Then we don't have to guess and ask for more and more code.
Don't get me wrong, not trying to bash you. :)

TitleBar2() :
function titleBar2()
  term.setCursorPos(1,1)
  term.setBackgroundColor(tBarC)
  term.setTextColor(tBartC)
  term.clearLine()
  term.setCursorPos(3,1)
  print("[Begin]")
  term.setCursorPos(12,1)
  print("[Games]")
  term.setCursorPos(20,1)
  print("Logged in as: "..usrName)

end

the usrName comes from the login function.

And the whole code is over 1000 lines.

View PostremiX, on 22 April 2013 - 05:00 AM, said:

What's the last colour that get's printed with the icon paintutils image?
What does the function titleBar2 do?

My feeling is that the text colour is the same colour as the background making you unable to see it, have you checked that?

What do you mean?

#8 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 22 April 2013 - 05:12 AM

Ok, using everything you provided your code worked for me, i.e. it printed out the version.
Just to be safe: do you actually call drawDesktop2() anywhere? :huh:

#9 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 22 April 2013 - 05:35 AM

Yes, I do actually call the drawDesktop2() function when you login, register and when you exit a what I call "Logged in" program.
Since the drawDesktop2() function is the desktop when you are logged in.

#10 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 22 April 2013 - 05:42 AM

Show us the entire code.

#11 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 22 April 2013 - 05:44 AM

Alright. This is my entire code:

Spoiler

Pastebin: http://pastebin.com/KnbAfUTN
As I said, Over 1000 lines of code.

#12 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 22 April 2013 - 06:33 AM

Please remove the code in the code tags, pastebin was enough xD

Will go over it now...

#13 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 22 April 2013 - 06:35 AM

View PostremiX, on 22 April 2013 - 06:33 AM, said:

Please remove the code in the code tags
At the very least put it in a spoiler! :P

#14 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 22 April 2013 - 06:37 AM

View Posttheoriginalbit, on 22 April 2013 - 06:35 AM, said:

View PostremiX, on 22 April 2013 - 06:33 AM, said:

Please remove the code in the code tags
At the very least put it in a spoiler! :P

Lol yeah xD

EDIT: When is it supposed to display the version, which screens

#15 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 22 April 2013 - 08:04 AM

Version should be shown in:

drawDesktop()
and
drawDesktop2()





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users