Jump to content


k1ll3rM's Content

There have been 7 items by k1ll3rM (Search limited from 20-March 23)


By content type

See this member's

Sort by                Order  

#242592 Getting turtle direction

Posted by k1ll3rM on 07 January 2016 - 03:33 PM in Ask a Pro

View PostBomb Bloke, on 06 January 2016 - 11:25 PM, said:

Alternatively, Lion4ever came up with a clever solution here.
I don't want to use a method where I need to have things in my mining turtles inventory because It's a harvester and it could fill up a lot of it's inventory. But thanks anyways!



#242538 Getting turtle direction

Posted by k1ll3rM on 06 January 2016 - 11:05 PM in Ask a Pro

View PostKingofGamesYami, on 06 January 2016 - 09:51 PM, said:

I've edited my above post to add a bit more information.
Thank you for your reply! It's currently late for me so I will try this tomorrow but if I can't get it to work then I'll reply back in this thread again.



#242528 Getting turtle direction

Posted by k1ll3rM on 06 January 2016 - 09:46 PM in Ask a Pro

View PostKingofGamesYami, on 06 January 2016 - 09:44 PM, said:

There is no function in computercraft that tells a turtle which way it is facing. You can find which way you are facing by setting up a GPS cluster and using gps.locate(), then moving forward and using gps.locate() again. Depending on the variable which changed, and if it incremented or decremented, you can find if you are moving north / south / east / west.
I know that and that is why I am asking if someone has some code for it. The only code which seemed to look full and would fit my program didn't have any explanation meaning I had no idea how to use it and it kept returning 0



#242524 Getting turtle direction

Posted by k1ll3rM on 06 January 2016 - 09:40 PM in Ask a Pro

I have been looking for a while for a working function to get the direction my turtle is facing with no luck. So now I gave up on looking for it and decided to ask it here! Is there any easy code for getting the direction as a number (like in the F3 menu)? I'm still fairly new to this so I would like a bit of an explanation/example on how I would use it combined with my own code. Thank you in advance



#206642 Monitor loop not working

Posted by k1ll3rM on 21 February 2015 - 11:13 PM in Ask a Pro

View Postk1ll3rM, on 21 February 2015 - 10:15 PM, said:

View PostHPWebcamAble, on 21 February 2015 - 08:39 PM, said:

What I think is happening is your program never gets to the loop

I'm bored so I rewrote your program
I used the Parallel API. I'd bet you haven't used it before, but it's pretty simple. Here is the Wiki for it: http://computercraft...allel_%28API%29

mon = peripheral.wrap("right")

function list()
  --#shell.run("ToDoList") No idea what this is. Probably another program of yours?
  while true do
	sleep(1)
	local cTime = os.time()
	cTime = textutils.formatTime(cTime, false)
	mon.setCursorPos(10,26)
	mon.write("Day " .. tostring(os.day()))
	mon.setCursorPos(1,26)
	mon.write(atime)
  end
end

function getInput()
  while true do --#loops forever
	local input = read() --#Waits for input
	if input == "stop" then
	  break --#stops the loop
	else
	  print("Unknown Command")
	end
  end
end


while true do --#Continues forever
  term.clear()
  term.setCursorPos(1, 1)
  print("Enter Command:")
  local input = read()
  if input == "list" then
	parallel.waitForAny(list,getInput) --#Basically this allows both to run at the same time. When either stops, the other is also stopped
  elseif input == "exit" then
	print("Exiting...")
	sleep(1)
	break --#Stops the loop
  else
	print("Unknown command")
  end
end
Thanks for that! I should be able to figure that one out :P I hope it doesn't bring other problems and yes the ToDoList is another program just to save some space! It just places a list on the monitor on the right!
second problem! It doesn't work for me -_-



#206621 Monitor loop not working

Posted by k1ll3rM on 21 February 2015 - 10:15 PM in Ask a Pro

View PostHPWebcamAble, on 21 February 2015 - 08:39 PM, said:

What I think is happening is your program never gets to the loop

I'm bored so I rewrote your program
I used the Parallel API. I'd bet you haven't used it before, but it's pretty simple. Here is the Wiki for it: http://computercraft...allel_%28API%29

mon = peripheral.wrap("right")

function list()
  --#shell.run("ToDoList") No idea what this is. Probably another program of yours?
  while true do
	sleep(1)
	local cTime = os.time()
	cTime = textutils.formatTime(cTime, false)
	mon.setCursorPos(10,26)
	mon.write("Day " .. tostring(os.day()))
	mon.setCursorPos(1,26)
	mon.write(atime)
  end
end

function getInput()
  while true do --#loops forever
	local input = read() --#Waits for input
	if input == "stop" then
	  break --#stops the loop
	else
	  print("Unknown Command")
	end
  end
end


while true do --#Continues forever
  term.clear()
  term.setCursorPos(1, 1)
  print("Enter Command:")
  local input = read()
  if input == "list" then
	parallel.waitForAny(list,getInput) --#Basically this allows both to run at the same time. When either stops, the other is also stopped
  elseif input == "exit" then
	print("Exiting...")
	sleep(1)
	break --#Stops the loop
  else
	print("Unknown command")
  end
end
Thanks for that! I should be able to figure that one out :P I hope it doesn't bring other problems and yes the ToDoList is another program just to save some space! It just places a list on the monitor on the right!



#206565 Monitor loop not working

Posted by k1ll3rM on 21 February 2015 - 05:58 PM in Ask a Pro

I have a problem with the program I wrote but I have no idea how to fix it! I've been searching everywhere but I can't find a solution. I'm a beginner so I would love to have some help!
The problem is that the monitor is not getting it's clock updated as the loop should do! the program is for an over-complicated To Do List just so I have a little project to work on.
here is the code:
mon = peripheral.wrap("right")
function list()
local input2 = read()
if input2 == ("stop") then
  start()
else
  print("Unknown Command")
  list()
end
shell.run("ToDoList")
while not guess == 3 do
  sleep(0.3)
  time = os.time()
  atime = textutils.formatTime(time, false)
  mon.setCursorPos(10,26)
  mon.write("Day " .. tostring(os.day()))
  mon.setCursorPos(1,26)
  mon.write(atime)
end
end

function start()
term.clear()
term.setCursorPos(1, 1)
print("Enter Command: ")
local input = read()
if input == ("exit") then
  os.reboot()
elseif input == "list" then
  list()
  start()
else
  print("Unknown Command")
  start()
end
end
start()