Jump to content


crazyguymgd's Content

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


By content type

See this member's


Sort by                Order  

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

Posted by crazyguymgd on 15 January 2013 - 07:43 AM in Ask a Pro

So you retyped the whole program to put it on here? Interesting... well glad it's fixed.



#74587 [lua] script problem

Posted by crazyguymgd on 15 January 2013 - 05:06 AM in Ask a Pro

Use == in your ifs. A single = is for assignments, double == is for comparisons.



#74535 Program error.

Posted by crazyguymgd on 15 January 2013 - 01:55 AM in Ask a Pro

Nice job :)



#74477 [1.48] YellowSquare Game

Posted by crazyguymgd on 14 January 2013 - 06:50 PM in Programs

Nice job! Suggestions:
Add mouse click to the any key to start, since the mouse is what you use to play the game.
Reset the background color to black before you clear the screen. I don't like it leaving my screen yellow :)

Also, when I got up to 39 points, it must have put a new square over an old one, so there was really no way of knowing where to click. Now I don't even want to try to beat my high score because odds are, it'll just screw me again :P



#74476 disk instaler

Posted by crazyguymgd on 14 January 2013 - 06:47 PM in Programs

I remember the first thing I did in terms of programming was create a simple webpage in html back in 2003. It said Hi Matt! and linked to some of my favorite flash games. Point is I was super proud of that webpage, even though it was poorly made and served no purpose, and I showed it to everyone!
Rick3333, you have a long way to go but nice job on picking a project and finishing it. Now take these guys (the ones that weren't assholes) advice, modify your project and keep making it better. If you have any other questions just ask!



#74435 Program error.

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

View PostTheOriginalBIT, on 14 January 2013 - 04:02 PM, said:

the do is required for the while... but when I looked at your completed code post before a wild 'do end' has appeared....

I'm having a hard time not photoshopping an image of this pokemon battle...



#74434 Program error.

Posted by crazyguymgd on 14 January 2013 - 04:08 PM in Ask a Pro

View Postdetsuo04, on 14 January 2013 - 03:57 PM, said:

edit: i added a turn right command after it collects ore so that should fix that. thanks

ok let me know how that goes



#74432 Turtle Invintory Management and Lava Problem

Posted by crazyguymgd on 14 January 2013 - 04:07 PM in Ask a Pro

Lol could not resist the urge!



#74427 Turtle Invintory Management and Lava Problem

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

 TheOriginalBIT, on 14 January 2013 - 03:37 PM, said:

if turtle.getItemCount( 16 ) > 0 then
  print( "There is something in the slot" )
else
  print( "There isn't" )
end
Posted Image



#74423 Program error.

Posted by crazyguymgd on 14 January 2013 - 03:56 PM in Ask a Pro

In your walls function:


function walls()
  for j = 1,4 do
    print("value function")
    if value() then
      turtle.dig()
      rn (base, "ore collected at "..z.." ")
    else
      turtle.turnRight()
    end
  end
end
Lets say there is an ore when j = 1, the value function will return true, you'll dig the ore, sit still, then j increments to 2. Then value will return false, you'll turn right, and j increments to 3. say there is another ore here (we're only on the second wall at this point). value will return true, you'll dig, and then j will increment to 4. Value returns false, you turn right, but now the for loop is done, walls() returns and you never actually check the back or left wall.
Thats a scenario I imagined that could cause this problem. There are probably plenty more.
To solve this, turn right when value() returns true and when it returns false. So you will at least always check every wall.



#74411 Program error.

Posted by crazyguymgd on 14 January 2013 - 03:35 PM in Ask a Pro

congrats!



#74404 Program error.

Posted by crazyguymgd on 14 January 2013 - 03:18 PM in Ask a Pro

Ahh and yes it should be if turtle.compare() then.... without the not. thanks for the catch



#74398 Program error.

Posted by crazyguymgd on 14 January 2013 - 03:11 PM in Ask a Pro

 TheOriginalBIT, on 14 January 2013 - 03:07 PM, said:

Here is what I would do:
function value()
  if not turtle.detect() then
	return false
  end

  for i = 1 , 3 do
	print("comparing "..i.." now")
	turtle.select(i)
	  if turtle.compare() then -- I'm assuming this was meant to be when it finds something
		return true
	  end
	end
  end

  return false
end
Its not any different logically, but it has a slightly better flow, then also if you decide to add anything else in later you wont forget to put return false in at the end of the function...

also just a question, shouldn't

How is it not different logically? Originally, if the compare with the block at slot 1 was false, he would return false and never check slot 2 or 3. This checks slots 2 and 3 if 1 fails. Which is differentt



#74395 FTP Client

Posted by crazyguymgd on 14 January 2013 - 03:07 PM in Ask a Pro

What's the problem you're having so I have an idea of where to start looking?



#74392 Program error.

Posted by crazyguymgd on 14 January 2013 - 03:01 PM in Ask a Pro

when you return, that means stop the function right there. So here's what I would do:

function value()
  if not turtle.detect() then
    return false
  else
    for i = 1 , 3 do
    print("comparing "..i.." now")
    turtle.select(i)
      if not turtle.compare() then
        return true
      end
    end
    return false
  end
end

As you can see, it will return true if it finds something at i, and returns false only if the for loop exits, and it hasn't returned true yet.
However, this might cause a problem if there is something at 1 and 2 because it'll return true at 1, then skip 2 because it returned.



#74391 Turtle Invintory Management and Lava Problem

Posted by crazyguymgd on 14 January 2013 - 02:57 PM in Ask a Pro

I usually run a check that says if slot 16 has something in it, go back to the start, unload, and then go back to the position it left off. (actually I say if it's full, drop an enderchest, unload, then pick the enderchest back up).
To go back to the home position, you'll have to keep track of it's position every time it moves in variables like currentX and currentZ and currentY. Then when you need to reload, you go from the currentX to the chestX, then the currentZ to the chestZ, then y... and then back to where you were by doing the reverse.

With the lava problem, I'm not sure why this would be happening to you. I've never had a problem with my turtles in lava. My guess is there is some other factor causing it to stop. Possibly because you only move and dig forward if you detect something.



#74386 Turtle Programs

Posted by crazyguymgd on 14 January 2013 - 02:45 PM in Ask a Pro

Yup. We've all been there.



#74383 Turtle Programs

Posted by crazyguymgd on 14 January 2013 - 02:39 PM in Ask a Pro

you need to give the turtle a label to get it to save it's programs. If you want to call it Mike, just say label set Mike and he'll forever be Mike



#74371 Program error.

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

I keep wanting to like your posts...
dam facebook



#74365 Program error.

Posted by crazyguymgd on 14 January 2013 - 02:01 PM in Ask a Pro

yup yup



#74364 Help with mini-game

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

 EpicTreeMiner, on 14 January 2013 - 01:36 PM, said:

 crazyguymgd, on 14 January 2013 - 01:28 PM, said:

Does it return to somewhere near the original positions? And if you tell it to go to a different place than the obsidean, does it return to that same, wrong position?
It returns to the position it was in when you started the programs, or well at least it should. thats the problem
So does it just sit above the obsidean and never actually runs the goback function? Or does it run the goback function but returns to a position that is 1 x coord too far? If it does go somewhere, but the wrong place, just tinker with the values in the goback function.



#74361 Program error.

Posted by crazyguymgd on 14 January 2013 - 01:54 PM in Ask a Pro

sorry, I missed that do,
for i = 1, 3 do
  if turtle.compare..........
end



#74348 Help with mini-game

Posted by crazyguymgd on 14 January 2013 - 01:28 PM in Ask a Pro

Does it return to somewhere near the original positions? And if you tell it to go to a different place than the obsidean, does it return to that same, wrong position?



#74344 Program error.

Posted by crazyguymgd on 14 January 2013 - 01:24 PM in Ask a Pro

Here's your value function with proper indentation. As you can see, you're missing key ends (and you have unnecessary ends)

function value()
  if turtle.detect() == false then
	return false
  end
  else
	for i = 1 , 3
	  if turtle.compareTo(i) == true then
		return false
	  end
	  else
		return true
	  end
	end
And here's the correct way to use the if's, else's and ends

function value()
  if turtle.detect() == false then
	return false
  else
	for i = 1 , 3
	  if turtle.compareTo(i) == true then
		return false
	  else
		return true
	  end
	end
  end
end



#74319 Program error.

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

I rode a turtle all the way to bedrock with this code.
z = 0
while true do
  print("2")
  f = turtle.getFuelLevel()
  if f < z + 10 then 
    rn (base , "Danger! fuel levels low.")
    turtle.select(16)
    turtle.refuel()
    z = turtle.getFuelLevel()
    if f < z + 10 then
      rn (base , "Insuficient Coal, Returning.")
      home()
    end
  elseif turtle.detectDown() then
    turtle.digDown()
    --turtle.detectDown()
    print("3")
    if turtle.detectDown() then
      rn (base , "I hit bedrock, Returning")
      print("Your home function")
      --home()
      break  -- to break out of the while loop
    end
  else
      turtle.down()
      print("your walls function")
      --walls()
      z = z + 1
  end
end