Jump to content




Random sentence.


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

#1 UrASmurf

  • New Members
  • 13 posts

Posted 18 July 2012 - 03:17 AM

Hi, I am "newish" to computercraft. I discovered it in december 2011, but stopped using it/am a noob. Is there a way to put in a bunch of print("XXXXX")'s and have it say one at random when you run a program. I want to do something like program name fact, having it give me a random fact.

Tuts/code would help a bunch.

#2 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 18 July 2012 - 03:27 AM

phrases={"The cake is a lie","Pi is exactly 3.","Today is Friday the thirteenth."}
print(phrases[math.random(1,#phrases)])
sleep(1)
inserted somewhere in the shell program
expand the table to whatever count you want

#3 UrASmurf

  • New Members
  • 13 posts

Posted 18 July 2012 - 03:53 AM

Thank you so much, is there a way to make it so it does not say the same line twice in a row?

I would expect its like if phrase = something then bloop blop.


Also, where would I put term.clear() to have it clear after every said phrase?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users