Jump to content

Welcome to FTB Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

Computercraft


2 replies to this topic

#1
Firehawk

Firehawk

    Member

  • Members
  • PipPip
  • 16 posts
  • Modpack:Direwolf20 Pack

you can post code in for people or for other people to help you

==MERGED==

to get started off i have this code so when its run on the monitor it keeps spacing out i dont want this to happen

==MERGED==

monitor = peripheral.wrap("right")
-- term.redirect(peripheral.wrap("right"))

while true do
peripheral.call("right", "clear")
term.setCursorPos(1,1)
monitor.write(textutils.formatTime(os.time(), false))
sleep(5)

end

==MERGED==

works fine might have to tweak ran on actual Lua

print ("Please enter the first number")
num1=tonumber(io.read())
print ("Please enter the second number")
num2=tonumber(io.read())
print("Please enter the operation")
num3 = 0
opera = io.read()
if opera == "+" then
num3 = num1 + num2;
end
if opera == "-" then
num3 = num1 - num2;
end
if opera == "*" then
num3 = num1 * num2;
end
if opera == "/" then
if num2 ~= 0 then
num3 = num1 / num2;
end
end
print (tostring(num1) .. tostring(opera) .. tostring(num2) .. " = " .. tostring(num3))

==MERGED==

code that doesnt work you have to change the term.setCursorPos(1 ,1)
into monitor.setCursorPos(1,1)

==MERGED==

48 people have seen this only one has commented

==MERGED==

just to say im not a complete master program somewhere near beginner



#2
Firehawk

Firehawk

    Member

  • Members
  • PipPip
  • 16 posts
  • Modpack:Direwolf20 Pack

Bringing fax machines into the world of minecraft needs a modem and a printer

 

sender:

 

rednet.open("top")
rednet.send(0, "start", true)
rednet.send(0, "line 1", true) 
rednet.send(0, "line 2", true)
rednet.send(0,"line 3", true)
rednet.send(0,"end",true)
 
write anything you want in the parenthesis 
 
Receiver:
 
local monitor = peripheral.wrap("right") - optional
local printer = peripheral.wrap("left")
monitor.setCursorPos(1,1)
monitor.clear()
rednet.open("top")
id, message = rednet.receive()
if ( message == "start" ) then
   printer.newPage()
   printer.setPageTitle("Your name")
   id, message = rednet.receive()
   lin=1
   while message ~= "end" do
      printer.setCursorPos(1,lin)
      printer.write(message)
      lin=lin+1
      id, message = rednet.receive()
   end
   printer.endPage()
end
monitor.write("New Message")
sleep(60)
monitor.clear
 


#3
Firehawk

Firehawk

    Member

  • Members
  • PipPip
  • 16 posts
  • Modpack:Direwolf20 Pack

two new programs

 

turtle stairs program:

 

local x = 2
while true do
  turtle.refuel()
  turtle.digDown()
  turtle.down()
  turtle.dig()
  turtle.forward()
  turtle.digUp()
--  if (x % 2) == 0 then ( these lines for automatic torch placing if fixed i would be glad)
 --  turtle.placeUp()
 -- x = x + 1
--end
end
 
A program where you can send a message to another computer(you dont have to always change the program to send a message)
 
sender:
rednet.open("top")
local op = read()
rednet.send(13, op ) 
 
receiver:
rednet.open("top")
id,message,distance = rednet.receive()
print(message)
 




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users