This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Ray_Anor's profile picture

[1.51] turtle.remember(), turtle.compareFromMemory(block)

Started by Ray_Anor, 22 March 2013 - 07:37 PM
Ray_Anor #1
Posted 22 March 2013 - 08:37 PM
I'm suggest new functions:

turtle.remember(), turtle.rememberUp(), turtle.rememberDown(), turtle.RememberFrom(slotNum)
returns new type of variables, memBlock

turtle.compareFromMemory(memBlock), turtle.compareFromMemoryUp(memBlock), turtle.compareFromMemoryDown(memBlock), turtle.compareFromMemoryTo(memBlock,slotNum)
works like other compare functions but use memBlock type var to compare



--example
---[[
  some code there
]]---
turtle.select(16)
print("give me charcoal please in active slot, and press <Enter>")
read()
--user give us charcoal!
--That may be not a charcoal, but he is charcoal!!!
--My MASTER say that.
local charcoal=turtle.rememberFrom(16)
---[[
  some code there
]]---
--finding charcoal in chest at front of turtle
--and putting it's in chest down
select(1)
turtle.dropDown()
while turtle.suck() do
  if turtle.compareFromMemory(charcoal,1) then
	 print("I'm found charcoal, Master!")
	 turtle.dropDown()
	 break
  end
  turtle.dropDown()
end


why turtles can't do it? If it able to compare object in inventory it must be able to simply remember it to memory.

but, it's totally may be broke ID-blackList-suggestions, if that functions will be return some value of standart lua code, or value that will be unprotected from read or type by another functions.

var type block must be used only for thats functions. In other cases it must cause exception and break of code.
immibis #2
Posted 22 March 2013 - 10:39 PM
Already been suggested, already been denied.
Frederikam #3
Posted 23 March 2013 - 02:18 AM
It's just too "overpowered".
AnDwHaT5 #4
Posted 23 March 2013 - 02:37 AM
OP and its well sensing the id's of the items and thats a no post in the rules
Lyqyd #5
Posted 23 March 2013 - 02:38 AM
Locked. It's not "too overpowered"; direct block ID mapping simply breaks the fourth wall. Shatters it, in fact. I'd say this is essentially detecting block IDs with an intermediate step, hence the lock.
Cloudy #6
Posted 23 March 2013 - 03:56 AM
I'll just point out that not once have we denied something for being overpowered.