2 posts
Posted 14 November 2016 - 06:46 PM
Hi,
I have a small problem…. I want to make a Fallout 4 like terminal. Now there is a problem. I don´t know how to change the colour of the text you tipe like of the commands you enter.
I hope i can get a very helpful answer.
marv
(Sorry if anything is written wrong… I´m from Germany)
Sorry to do this with an edit…. I can´t post a reply…
this is how far I got…
[img]file:///C:/Users/Marvin/AppData/Roaming/.minecraft/screenshots/2016-11-14_21.12.12.png[/img]
file:///C:/Users/Marvin/AppData/Roaming/.minecraft/screenshots/2016-11-14_21.12.12.pngThis is the code:
term.clear()
term.setCursorPos(1, 1)
term.setTextColor(colors.lime)
print("ROBCO Industries (TM) Termlink")
term.setTextColor(colors.lime)
term.write(io.read())
Edited on 14 November 2016 - 07:24 PM
101 posts
Location
Sweden
Posted 14 November 2016 - 07:30 PM
term.setTextColor( [color from
http://computercraft.info/wiki/Colors_(API)] ) is probably what you are looking for, you should probably also check out
http://www.computercraft.info/wiki/Term_(API) and
http://www.computercraft.info/wiki/ (the wiki itself) as it is filled with many useful topics.
On a whim I'd say that shell.run([program]) and some os. functions will be useful.
If you're new to programming some examples and tutorials are also available on the wiki.
Good luck! :)/>
2 posts
Posted 14 November 2016 - 07:53 PM
Tahnks for the quick help. I will look for some Tutorials as I´m new to programming.
marv
This is what happend…
file:///C:/Users/Marvin/AppData/Roaming/.minecraft/screenshots/2016-11-14_21.12.12.pngHere is the code
term.clear()
term.setCursorPos(1, 1)
term.setTextColor(colors.lime)
print("ROBCO Industries (TM) Termlink")
term.setTextColor(colors.lime)
term.write(io.read())
101 posts
Location
Sweden
Posted 14 November 2016 - 09:18 PM
Hi,
I have a small problem…. I want to make a Fallout 4 like terminal. Now there is a problem. I don´t know how to change the colour of the text you tipe like of the commands you enter.
I hope i can get a very helpful answer.
marv
(Sorry if anything is written wrong… I´m from Germany)
Sorry to do this with an edit…. I can´t post a reply…
this is how far I got…
[img]file:///C:/Users/Marvin/AppData/Roaming/.minecraft/screenshots/2016-11-14_21.12.12.png[/img]
file:///C:/Users/Marvin/AppData/Roaming/.minecraft/screenshots/2016-11-14_21.12.12.pngThis is the code:
term.clear()
term.setCursorPos(1, 1)
term.setTextColor(colors.lime)
print("ROBCO Industries (TM) Termlink")
term.setTextColor(colors.lime)
term.write(io.read())
We can't see those errors, try uploading them to, for example, imgur.
As for the code the 'TM' is probably causing an error or being replaced by a '?'. Try replacing that entire string with just 'test' to see that that works.
And for reading input you should use just 'read()'
Hope that helps!
797 posts
Posted 16 November 2016 - 04:44 PM
Tahnks for the quick help. I will look for some Tutorials as I´m new to programming.
marv
This is what happend…
file:///C:/Users/Marvin/AppData/Roaming/.minecraft/screenshots/2016-11-14_21.12.12.png
Here is the code
term.clear()
term.setCursorPos(1, 1)
term.setTextColor(colors.lime)
print("ROBCO Industries (TM) Termlink")
term.setTextColor(colors.lime)
term.write(io.read())
Firstly, those image links are local to your computer. Nobody else can see them. You'll need to upload them to something like imgur if you want to show anyone else. Check out
puush.
Secondly, that code isn't wrong exactly, but you're writing the user input back onto the screen. `io.read()` will return the string the user enters. All the displaying is handled by that function, so you don't need to write it afterwards. I'd assume you want something more like the following:
term.clear()
term.setCursorPos(1, 1)
term.setTextColor(colors.lime)
print("ROBCO Industries (TM) Termlink")
term.setTextColor(colors.lime)
while true do -- keep doing this over and over
local input = io.read() -- get the user input into a variable called 'input'
-- do something with 'input'
end -- end the loop