Jump to content


crazyguymgd's Content

There have been 139 items by crazyguymgd (Search limited from 29-March 23)


By content type

See this member's


Sort by                Order  

#74311 Program error.

Posted by crazyguymgd on 14 January 2013 - 12:10 PM in Ask a Pro

Did you read TheOriginalBITs tips on ifs? Because you didn't seem to follow them...



#74303 Program error.

Posted by crazyguymgd on 14 January 2013 - 12:00 PM in Ask a Pro

I also saw a point where you use turtle.Up(z + 2). These don't take parameters. To get this effect, you would do:

for i = 1, z+2 do
  turtle.up()
end



#74302 Program error.

Posted by crazyguymgd on 14 January 2013 - 11:57 AM in Ask a Pro

turtle movements:

turtle.up()
turtle.down()
turtle.turnRight()
turtle.turnLeft()

notice where everything is capitalized. You often try to use turtle.Down() which wont work. Neither with turtle.turnright() and so on.



#74291 Need help with my problem

Posted by crazyguymgd on 14 January 2013 - 11:35 AM in Ask a Pro

looks like you don't have an end to your refuel function.



#74287 [Lua][Error] startup:27: attempt to call nil

Posted by crazyguymgd on 14 January 2013 - 11:27 AM in Ask a Pro

how old of a version of cc are you using in that tekkit pack?



#74061 Program error.

Posted by crazyguymgd on 14 January 2013 - 12:50 AM in Ask a Pro

one thing I also noticed when I ran this on a turtle is tmDown() doesn't actually work. This is because the command to move down is just turtle.down(). And the reason it seems to do nothing when you run it is because you have a ton of sleep(1)s in there. just wait 15 seconds and you'll start getting errors that will help you find all the problems.



#74057 Program error.

Posted by crazyguymgd on 14 January 2013 - 12:45 AM in Ask a Pro

View PostTheOriginalBIT, on 14 January 2013 - 12:41 AM, said:

ok I've gone and commented your code with all the mistakes that you have made ( hope i didn't miss any )

http://pastebin.com/eCHabxgj

I was just getting into doing this as well...



#74045 Program error.

Posted by crazyguymgd on 14 January 2013 - 12:23 AM in Ask a Pro

your while true do mine() end needs to be outside of the mine() function.



#74033 Program error.

Posted by crazyguymgd on 14 January 2013 - 12:01 AM in Ask a Pro

it often helps to put some debugging print statements in this situation. also, make sure you're actually calling the main function after all these edits. sometimes that could get missed.



#74023 Program error.

Posted by crazyguymgd on 13 January 2013 - 11:42 PM in Ask a Pro

so nested ifs?

if condition then
  if condition then
    -- do something
  end
else
    -- do something else
end

but you only need that else if you're actually going to do something else. otherwise just an end.
if that's not clear i'm sure there's a wikipedia page that explains ifs and elses better than I can. or someone else on here.



#74020 [Lua][Error] I need help finding out the error im getting for this a* demo

Posted by crazyguymgd on 13 January 2013 - 11:36 PM in Ask a Pro

oh, your original loops had y associated with the width and x with the height... i thought that was strange but just kept that for you.
basically if it doesn't do what you want it to do, you'll probably have to re-write it to properly fit the structure you want...



#74018 Program error.

Posted by crazyguymgd on 13 January 2013 - 11:29 PM in Ask a Pro

well the extra else's aren't necessary so did you try just getting rid of them? also, there are a couple of places where you have

if condition then
   ...
end
else
  ...
end

that first end isn't necessary. so you can find those and get rid of them too.



#74011 Program error.

Posted by crazyguymgd on 13 January 2013 - 11:12 PM in Ask a Pro

examples:

function foo()
  ... 
end

if condition then
   ...
end

if condition then
   if condition2 then
      ...
   end
else
  ...
end

while something do
  ...
end

for x = 1, n do
  ...
end

and so on



#74010 RC4 Encryption API

Posted by crazyguymgd on 13 January 2013 - 11:09 PM in APIs and Utilities

Sounds cool. I'll probably never use it but I always like seeing people do things like this :P



#74009 [Lua][Error] I need help finding out the error im getting for this a* demo

Posted by crazyguymgd on 13 January 2013 - 11:07 PM in Ask a Pro

wait i think I was confused to your last question there. What I was saying originally was to change it to:

[code]
81: for x = 1,h do -- for each cell do
82: cell[x] = {}
83: stringl = filel.readLine()
84: for y = 1,w do
85: cell[x][y] = {}
86: --calculate heuristic
87: dx = math.abs(ex - x)
88: dy = math.abs(ey - y)
89: h = dx + dy
90: cell[x][y].h = h-1
91: ce = stringl:sub(y,y)
92: cell[x][y].type = gettype(ce)
93: end
94: end
[/code]
edit - can't figure out formating with this copied and pasted. sorry all you formatting gods :P



#74004 Program error.

Posted by crazyguymgd on 13 January 2013 - 10:59 PM in Ask a Pro

you're missing ends to a lot of your functions. The one's I found were to value(), walls(), home(), and mine().
Also, turtle.turnRight() not turtle.turn("right")
In your home() function you use os.shutdown instead of os.shutdown()...
and maybe some other things. try going through your code and seeing if you can find any more problems :P debugging code is like a game, the more problems you find, the more points you get. so far, I'm winning.



#73999 [Lua][Error] I need help finding out the error im getting for this a* demo

Posted by crazyguymgd on 13 January 2013 - 10:49 PM in Ask a Pro

as far as i can tell, reverse everything that calls it.



#73991 [LUA][ERROR]Getting false " 'then' expected " error?

Posted by crazyguymgd on 13 January 2013 - 10:27 PM in Ask a Pro

m == 1 and k == 28 instead of one =



#73971 best way to deal with gravel!

Posted by crazyguymgd on 13 January 2013 - 09:42 PM in Ask a Pro

well first you have a moveforward function but you never actually call it. otherwise that is the basics of the moveforward function I use to avoid gravel problems.



#73961 looking for a clock(for in game time) that can activate redstone at night and...

Posted by crazyguymgd on 13 January 2013 - 09:33 PM in Ask a Pro

View PostOrwell, on 13 January 2013 - 09:29 PM, said:

For this purpose I like to use "os.startTimer()" and "os.pullEvent('timer')".

why do you like to do this?



#73960 [Lua][Error] I need help finding out the error im getting for this a* demo

Posted by crazyguymgd on 13 January 2013 - 09:32 PM in Ask a Pro

you should be able to just switch the for loops. for x = 1, w .... for y = 1, h...



#73952 looking for a clock(for in game time) that can activate redstone at night and...

Posted by crazyguymgd on 13 January 2013 - 09:21 PM in Ask a Pro

View PostRunasSudo, on 13 January 2013 - 09:20 PM, said:

Use os.time() to get the time and check if it's greater than 19 or something (19 = 7:00PM).

EDIT: Argh, ninja'd!

:)



#73950 looking for a clock(for in game time) that can activate redstone at night and...

Posted by crazyguymgd on 13 January 2013 - 09:19 PM in Ask a Pro

os.time() returns the current in-game time. I believe morning is 6 and night is 18. so...
time = os.time()
if time < 6 or time > 18 then
  -- redstone output that says it's night
end
would tell you if it's night. then you just run that when you want to know if it's night...



#73947 [Lua][Error] startup:27: attempt to call nil

Posted by crazyguymgd on 13 January 2013 - 09:14 PM in Ask a Pro

Well I ran your program without any errors so I'm not too sure why you would be having a problem.
And I just spent a little while trying to force the error with no luck so something else you are doing must be wrong.
Sorry I couldn't find the problem, just letting you know I tried.



#73937 [Lua][Error] I need help finding out the error im getting for this a* demo

Posted by crazyguymgd on 13 January 2013 - 08:53 PM in Ask a Pro

View Postcolumna1, on 13 January 2013 - 08:21 PM, said:

Im pretty sure that the way im defining it in the for loop:

81:	for y = 1,w do -- for each cell do
82:	   cell[y] = {}
83:	   stringl = filel.readLine()
84:	   for x = 1,h do
85:		 cell[x][y] = {}
86:		 --calculate heuristic
87:		 dx = math.abs(ex - x)
88:		 dy = math.abs(ey - y)
89:		 h = dx + dy
90:		 cell[x][y].h = h-1
91:		 ce = stringl:sub(y,y)
92:		 cell[x][y].type = gettype(ce)
93:	   end
94:	 end

would define cell[x] first then it would define
cell[x][y] as a table
so that i could use it almost as an object with a 2d identifier

Also if you want i could post the code without the lines numbered
and i have defined cell to as a table

cell[y] = {}, when y is 1, puts an empty table at cell[1].
then you go into the x loop.
when x = 1, cell[1][1] = {} works fine because you created that empty table at cell[1].
But the next time through the for loop, you try to access cell[2][1] which doesn't exist...