Jump to content


sidewinder5675's Content

There have been 3 items by sidewinder5675 (Search limited from 30-October 19)


By content type

See this member's

Sort by                Order  

#222611 Help: text not changing colors.

Posted by sidewinder5675 on 22 June 2015 - 06:16 AM in Ask a Pro

View PostKingofGamesYami, on 22 June 2015 - 03:55 AM, said:

That should work perfectly - if you touch the monitor anywhere from (2,2) to (9,2). I'd guess you have it in a loop, and something happening after this redraws something different before you pull another event. Something like this:

while true do
  term.setCursorPos( 1, 1 )
  term.write( "Hello World" )
  local event = {os.pullEvent()}
  if event[ 1 ] == "key" and event[ 2 ] == keys.space then
	term.clear()
  end
end

Notice that even if you press spacebar, nothing appears to happen. In reality, the terminal is being cleared, but the text is redrawn before you can see the effects of clear.

OH! That makes sense, so it probably is turning it the lime green, but when it hits the "end" it starts the program again?

Is there a simple way to halt the program so that it just waits for another button to be pushed instead of re-writting out the terms to the monitor?



#222529 Help: text not changing colors.

Posted by sidewinder5675 on 21 June 2015 - 11:19 PM in Ask a Pro

Thank you for the help so quickly! And I will try to learn more about tables and how to take advantage of them un future code I work with.

This program works as of now, for exactly what I want it for, it's just that in this line here, nothing seems to happen.
Even when I add a command like mon.clear() it does not clear the monitor. Any suggestions why this may not be working? Am I just asking LUA to do something it doesn't know how to do?

  if x > 1 and x < 10 and y == 2 then
		mon.setCursorPos(1,2)
		mon.setTextColor(colors.lime)
		mon.write("Manyullyn-")
	  end



#222505 Help: text not changing colors.

Posted by sidewinder5675 on 21 June 2015 - 08:31 PM in Ask a Pro

First off, I know next to nothing about LUA or coding in general. I know what I wrote is probably laughable, but it works (mostly) However, I am interested in learning more to make redstone bend to my will and have more general coding knowledge!


I tried to write a simple Advanced computer monitor code to control the output of liquids to a Tinker's Construct Tank, it works great!! however, There is a spot where I tried to change the color when the "if" statement is fulfilled and it does not change color! I tried to write it in the same if statement and it didn't work. I tried to originally write it so that if it was pressed again, it would go to sleep(1) to restart the program from the true statement, it did;t work that way, but it did put the text color green for a tick and shut the program off.
Here is a pastebin to what I wrote:

pastebin.com/eZDwu5ck

Appreciate any assistance and even ways to make this simple code better, or things that I should research in my coding quest. Thanks guys!