Jump to content




need help running programs on multiple monitors and wireless turtles

turtle lua help

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

#1 Asianchickenisha

  • New Members
  • 2 posts

Posted 01 January 2013 - 09:11 AM

So I'm going to do a New Years thing tonight and I was trying to get a 60 second countdown on every monitor that I have placed. So then when the countdown ends I want the program to tell 3 different turtles to dance and I want the computer to emit a constant redstone signal which turns on an array of lights.

Here is what I have so far:

local mon = peripheral.wrap("top")
mon.clear()
local j = 60

repeat

if j > 0 then
j = j - 1
end

mon.setTextScale(5)
mon.setCursorPos(1,1)
mon.clear()
mon.write(j)
sleep(1)
until j == 0

if j == 0 then
mon.clear()
mon.write("!!2013!!")
end


I figured I could put the emit constant redstone signal under the if j == 0. Also I don't really know how to make the 3 turtles dance at the end of the countdown. But that's the least important matter I really need to know how I can run any program on multiple monitors at the same time so I can show the countdown on monitors everywhere and so I run programs on multiple computer at the same time in the future. I don't have much experience programming so sorry if I sound foolish but I have to finish this today. Thank you for your response.

#2 zekesonxx

  • Signature Abuser
  • 263 posts
  • LocationWhere you aren't

Posted 01 January 2013 - 09:45 AM

Turtles:

rednet.open("right")
id, msg = rednet.receive()
if msg == "dance" then
shell.run("dance")
end


#3 Asianchickenisha

  • New Members
  • 2 posts

Posted 01 January 2013 - 10:27 AM

Thanks I added that to all of the turtles and got them to dance at the same time. I just need to know how to run the countdown on all computer though.

#4 zekesonxx

  • Signature Abuser
  • 263 posts
  • LocationWhere you aren't

Posted 01 January 2013 - 11:00 AM

Server Computer:
local j = 60
rednet.open("SIDE HERE")

while true do
  rednet.broadcast(j)
  if j == 0 then
    rednet.broadcast("dance")
  end
end

Monitor Computers:
local isRun = true

local mon = peripheral.wrap("top")
mon.clear()
rednet.open("SIDE HERE")
while isRun do
  id, j = rednet.receive()

  mon.setTextScale(5)
  mon.setCursorPos(1,1)
  mon.clear()
  mon.write(j)

  if j == 0 then
    mon.clear()
    mon.write("!!2013!!")
    os.pullEvent("candy_apples") --Not a actual event, this will make the computer sleep infinately.
  end
end


#5 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 01 January 2013 - 01:01 PM

View Postzekesonxx, on 01 January 2013 - 11:00 AM, said:

Server Computer:
local j = 60
rednet.open("SIDE HERE")

while true do
  rednet.broadcast(j)
  if j == 0 then
	rednet.broadcast("dance")
  end
end

You may want to decrement j :P

And instead of pulling a random event, just make isRun = false





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users