Jump to content




Packets And Tables


7 replies to this topic

#1 Kaleb702

  • New Members
  • 41 posts

Posted 30 January 2012 - 07:55 AM

Mmkay, so... I have started work on a tic-tac-toe version, this time using multiplayer instead of an AI.

Now the issue is... "attempt to index ? (a nil value)"

This may not be able to be fixed without actual knowledge of the MineCraft mod's APIs, but it might be able to be fixed: http://pastebin.com/bQKvVW2K Essentially, it sends packet "MOVE 1 1" for instance, meaning that it moves to the first row, first column. The packet reader then checks if it starts with "MOVE", then takes the numbers and uses them to set the spot on the board.

The issue though, is that after it moves on one, they both sit for a minute... then display an error message, which was aforementioned.

#2 Casper7526

    OG of CC

  • Members
  • 362 posts

Posted 30 January 2012 - 08:01 AM

Well the error means that your trying to use a variable thats nil. The easiest way to find out where a program is crashing is to throw some debug prints in there.

print "At this place now"
print "Doing this function"
print "Ending this function"

That way you can find out where the program is crashing by what line is printed last. Add and remove those until you find out where in your program the crash is occuring, then backtrack and find out whats causing a variable to be nil or etc etc.

#3 Kaleb702

  • New Members
  • 41 posts

Posted 30 January 2012 - 07:20 PM

Ah. Well, there's the "infinite loop packet search" fixed. It wasn't recognizing the host because I typo'd. That has been updated in the pastebin.

Still broken. Some more debug prints have been placed, still can't find it myself.

#4 Casper7526

    OG of CC

  • Members
  • 362 posts

Posted 31 January 2012 - 04:48 AM

It prolly works, but no need for os.sleep you can just use sleep

Also when using double matrice's you have to set the first part to a table each time.

matrix[a] = matrix[a] or {}
matrix[a][b] = 1

#5 Kaleb702

  • New Members
  • 41 posts

Posted 31 January 2012 - 05:08 AM

Wait, what?
what do you mean "set the first part to a table each time"? I did that, didn't I?

#6 Casper7526

    OG of CC

  • Members
  • 362 posts

Posted 31 January 2012 - 05:17 AM

Yeah I didn't realize you had it at the top. IMO you gotta find out WHERE it's crashing with some more debug lines and let us know. You can do it Kaleb! Code the night away!

#7 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 03 February 2012 - 02:56 AM

Any Progress?

#8 Kaleb702

  • New Members
  • 41 posts

Posted 19 February 2012 - 06:49 AM

http://pastebin.com/cT1UVRwC

Now it's an infinite loop somewhere in there.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users