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

Movement Functions Not Working

Started by EnergyMatter, 13 August 2013 - 04:22 PM
EnergyMatter #1
Posted 13 August 2013 - 06:22 PM
I made an API to make some things about programming turtles easier, but for some reason, the function that are supposed to make the turtle move don't make it move. I had them on an older program for mining before I made the API, and they worked fine then. I think the problem might have occurred due to how I combined automatically digging the block in front of it and waiting if it can't move forward because of an entity being in the way. I looked at it, but I still have no idea why it doesn't work.

API: http://pastebin.com/fpbEfZAF

Thanks in advance!
Yevano #2
Posted 13 August 2013 - 11:24 PM
You say you used it for an older program. Would this have been for the turtles were updated to require fuel? Turtles require fuel now to move. Other than that, I don't immediately see any problems with your API.
campicus #3
Posted 14 August 2013 - 12:12 AM
Should line 25 be "math.random()" instead of "math.random"? This isn't really relevant to your problem though and I cannot see why your movement functions don't work.
EnergyMatter #4
Posted 14 August 2013 - 11:55 AM
You say you used it for an older program. Would this have been for the turtles were updated to require fuel? Turtles require fuel now to move. Other than that, I don't immediately see any problems with your API.
I set turtlesNeedFuelToMove=false, so it isn't a problem
LordIkol #5
Posted 15 August 2013 - 08:31 AM
you always check if bedrock variable is false but you never set it to false it is set to nil initally.
if you change that part :


local enter = nil
local bedrockF = nil
local bedrockU = nil
local bedrockD = nil
local bedrockL = nil
local bedrockR = nil
local bedrockB = nil
local bedrock = nil

to this:


local enter = false
local bedrockF = false
local bedrockU = false
local bedrockD = false
local bedrockL = false
local bedrockR = false
local bedrockB = false
local bedrock = false

it should work

Greets
Loki
EnergyMatter #6
Posted 15 August 2013 - 09:32 AM
you always check if bedrock variable is false but you never set it to false it is set to nil initally.
if you change that part :


local enter = nil
local bedrockF = nil
local bedrockU = nil
local bedrockD = nil
local bedrockL = nil
local bedrockR = nil
local bedrockB = nil
local bedrock = nil

to this:


local enter = false
local bedrockF = false
local bedrockU = false
local bedrockD = false
local bedrockL = false
local bedrockR = false
local bedrockB = false
local bedrock = false

it should work

Greets
Loki

I'll try this now!

Thanks for helping me out!