Jump to content




Print screen


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

#21 Willibilly19

  • Members
  • 48 posts
  • LocationColorado, USA

Posted 21 January 2013 - 08:54 PM

I rewrote the code using TheOriginalBIT's suggestion. I tested it for you and I know it was working for me at least.
Let me know if there are any errors.

local mon = peripheral.wrap("back")
term.redirect(mon)
mon.setTextScale(2)
mon.setTextColor(colors.blue)
mon.setBackgroundColor(colors.white)
mon.clear()
mon.setCursorPos(1, 1)

print([[
		  FuzzyCorp ToDo List
1. ----- 2. ----- 3. -----
4. ----- 5. ----- 6. -----
7. ----- 8. ----- 9. -----
10. ----- 11. ----- 12. -----
]])
term.restore()


This way, it's all in "print" and should be easier to edit/add more later on if you need to.

#22 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 21 January 2013 - 09:47 PM

View PostTheOriginalBIT, on 21 January 2013 - 07:19 PM, said:

View PostremiX, on 21 January 2013 - 07:15 PM, said:

No, sorry. That was atypo of 'code' for the code tags. And I cant edit my post on my phone... Fail.
Really? I can what kind of phone u got? Touchscreen? Tap on the post and it should give you edit and quote...

Lmao. Shot for that xD I never knew about that xD only started using mobile theme recently xD

#23 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 January 2013 - 10:47 PM

View PostWillibilly19, on 21 January 2013 - 08:54 PM, said:

I rewrote the code using TheOriginalBIT's suggestion. I tested it for you and I know it was working for me at least.
Let me know if there are any errors.

local mon = peripheral.wrap("back")
term.redirect(mon)
mon.setTextScale(2)
mon.setTextColor(colors.blue)
mon.setBackgroundColor(colors.white)
mon.clear()
mon.setCursorPos(1, 1)

print([[
		  FuzzyCorp ToDo List
1. ----- 2. ----- 3. -----
4. ----- 5. ----- 6. -----
7. ----- 8. ----- 9. -----
10. ----- 11. ----- 12. -----
]])
term.restore()


This way, it's all in "print" and should be easier to edit/add more later on if you need to.
For the record... It's not actually the way I suggested, you still have all the mon.'s ... By redirecting the terminal you remove the need to use the mon object, and it also allows you to use the normal print and write on the monitor too...

#24 Willibilly19

  • Members
  • 48 posts
  • LocationColorado, USA

Posted 21 January 2013 - 10:52 PM

I tried it with term.'s there, but I was getting an attempt to call nil. I changed it to mon. and it stopped throwing up that error.

#25 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 January 2013 - 11:20 PM

View PostWillibilly19, on 21 January 2013 - 10:52 PM, said:

I tried it with term.'s there, but I was getting an attempt to call nil. I changed it to mon. and it stopped throwing up that error.
Only textScale needs to be mon as term doesn't have that function. The rest can be term...

#26 ChunLing

  • Members
  • 2,027 posts

Posted 21 January 2013 - 11:26 PM

Yeah, but is there any advantage once you've gone ahead and wrapped the monitor?

#27 Willibilly19

  • Members
  • 48 posts
  • LocationColorado, USA

Posted 21 January 2013 - 11:34 PM

I think for simplicity's sake, it all works the same, and it seems to look more organized this way. It's also a little easier to understand for someone new to Lua and the API's from ComputerCraft. I haven't used most of these commands myself (before this), but I understand they are all going to the monitor. With the redirect, I now know that you can print to a monitor, which is very nice. I like how this one looks how it is.

#28 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 January 2013 - 11:51 PM

View PostChunLing, on 21 January 2013 - 11:26 PM, said:

Yeah, but is there any advantage once you've gone ahead and wrapped the monitor?
print... or making having one function that can work on the computer but optionally go to a monitor if a param is passed in or something like that...

#29 ChunLing

  • Members
  • 2,027 posts

Posted 22 January 2013 - 08:18 AM

Yeah, but you've got that from the term.redirect(mon) already. Though I guess that making the setTextScale method optional is a good idea, so that the program can be used without a monitor.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users