This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Deadpangod3's profile picture

How to get a computer to say something on startup?

Started by Deadpangod3, 18 April 2014 - 06:14 PM
Deadpangod3 #1
Posted 18 April 2014 - 08:14 PM
So Im trying this mod (which is totally awesome so far :D/>) and I'm trying to get a computer to say something on a monitor when it starts, like if you have it reboot or run the "shutdown" program, and then right click on the computer to turn it on again,

I don't know if this matters but just in case, it's the advanced computer and advanced monitor, and the advanced monitor is a giant five by five block square, and this is in Tekkit.

I couldn't find anything about this in the tutorials section in the wiki, so I'm hoping someone can tell me how, cause I'm trying to get this computer to be awesome and stuff so I can show my cousin who is coming over in like 2-3 hours.

Any help is appreciated :)/>
Lyqyd #2
Posted 18 April 2014 - 10:09 PM
The computers will execute whatever code is in their startup file in the root of their drive. Just type `edit startup` or rename an existing program that you want it to run on boot.
Deadpangod3 #3
Posted 18 April 2014 - 10:36 PM
The computers will execute whatever code is in their startup file in the root of their drive. Just type `edit startup` or rename an existing program that you want it to run on boot.
Okay, but I couldn't program a dot. I tried doing something similar to one of the wiki tutorials, but it didn't work.
rpg4mc #4
Posted 18 April 2014 - 11:40 PM
If you want to write 'This is a startup-message' on startup then do the following:

1) type 'edit startup'

print("This is a startup-message")
2) save and 'reboot'
Deadpangod3 #5
Posted 19 April 2014 - 03:34 AM
If you want to write 'This is a startup-message' on startup then do the following:

1) type 'edit startup'

print("This is a startup-message")
2) save and 'reboot'
I tried that but I put the monitor thing like "monitor top" cause the monitor was above it, then the print and stuff, but it wouldn't show up on the computer or the monitor. :(/>
kornichen #6
Posted 19 April 2014 - 07:50 AM
Just do this:

local monitor = peripheral.wrap("top")
monitor.write("This is a startup-message")
For more information about monitors take a look at: http://computercraft.info/wiki/Monitor
Edited on 19 April 2014 - 05:50 AM
Deadpangod3 #7
Posted 19 April 2014 - 07:26 PM
Just do this:

local monitor = peripheral.wrap("top")
monitor.write("This is a startup-message")
For more information about monitors take a look at: http://computercraft.info/wiki/Monitor
That didn't work either, it does show up on the monitor or the computer on startup.
mrpoopy345 #8
Posted 19 April 2014 - 09:17 PM
Obviously, change "top" to be whatever side the monitor is on.
Deadpangod3 #9
Posted 19 April 2014 - 09:52 PM
Obviously, change "top" to be whatever side the monitor is on.
The monitor is on top of the computer…
mrpoopy345 #10
Posted 19 April 2014 - 09:54 PM
Well then there should be no problem. Is it in your startup file?
Deadpangod3 #11
Posted 20 April 2014 - 12:41 AM
Well then there should be no problem. Is it in your startup file?
Yes it is.
mrpoopy345 #12
Posted 20 April 2014 - 01:14 AM
Does it error at all? I tested on my world and it worked completely fine.
Try re copying it.
And make sure you spelled everything right.

monitor = peripheral.wrap("top")
monitor.write("This should work.")
Edited on 20 April 2014 - 12:03 AM
Deadpangod3 #13
Posted 20 April 2014 - 04:10 PM
Ahh, I know why it wasn't working, I was putting in "edit start" like one of the wiki tutorials, I put in "edit startup" and then typed it in, and it worked, but now the writing goes off the monitor screen and doesn't go to the next line down, I tried putting the message in two parts with a second monitor.write below the first but it still didn't work.

So it apears on the screen now but it won't show the entire message on the screen.
CometWolf #14
Posted 20 April 2014 - 05:09 PM
the monitor.write function won't move the cursor like print() does on the terminal. Since monitors don't have a print function by default, you can either redirect your terminal to the monitor by using

term.redirect(peripheral.wrap"monitorSide")
and then just use print like normal. Or you can move the cursor on the terminal after you write the first message, then write the second.

monitor.write"line1"
monitor.setCursorPos(1,2) --the 1 is sideways, and the 2 is up and down
monitor.write"line2"
Edited on 20 April 2014 - 03:11 PM
Deadpangod3 #15
Posted 21 April 2014 - 01:58 AM
the monitor.write function won't move the cursor like print() does on the terminal. Since monitors don't have a print function by default, you can either redirect your terminal to the monitor by using

term.redirect(peripheral.wrap"monitorSide")
and then just use print like normal. Or you can move the cursor on the terminal after you write the first message, then write the second.

monitor.write"line1"
monitor.setCursorPos(1,2) --the 1 is sideways, and the 2 is up and down
monitor.write"line2"

Ok, it works, thanks everyone! :D/>

But since another question popped into my head just now, I hope it's ok with the moderators if I "recycle" this thread and use it to ask another question instead of making a second thread.

Would it be possible to make a computer give you the recipe for an item when you type the name of the item in?
Like if I were to type in "chest" it would say "eight wood planks in an O shape."?
Bomb Bloke #16
Posted 21 April 2014 - 04:48 AM
Indeed it would be, though you'd need to first program the computer with the information about those recipes yourself.

You'd basically cram all the data in a table.