Concerning the "flushmem error" I'll look into it. It does happen to me too, but I doubt it's my fault. I'll still take a look at it and see if I can figure it out.
Also you don't explain how to use ZInts(blah) very wel
Have you checked the command referense at www.truplo.com/TNet? I hope it is explains well, or I will change it for the better, I like feedback =)
I am going to write a tutorial on packing (a detailed one) but I haven't had time for it. It'll come.. in time..
Anyhow the point with my packing commands is to make your life simpler. So it would be pointless to use your own packing on top of it =)
Instead of: ( SEND )
datasend = Player.NX+"|"+PLayer.NY
..
TNet_SendUDP(INFO_PLAYER,datasend)
Go:
datasend = ZInt(Player.NX)+ZInt(Player.NY)'Dynamic packing
..
TNetSendUDP( INFO_PLAYER,datasend )
Instead of: ( RECEIVE )
data1 = Instr(TNetData,Left(TNetData,1))
DrawText data1,8,8
data2 = Instr(TNetData,"|",data1)
DrawText data2,8,24
Player.PX = Float(Mid(TNetData,data1,data2))
Player.PY = Float(Mid())
Go:
Player.PX = XInt( TNetData )
Player.PY = XInt( TNetData )
Magic eh?
If you need floats use ZFloat() and XFloat(), If you need to pack several Strings use ZString() and XString().
The logic:
Z is for Zip I.E. Pack. X is for eXtract I.E. UnPack.
You can also use a similar command called ZInts, note the extra "s".
It works like this:
DataToSend$ = XInts([ X, Y , Dir , Speed , Acceleration, LastX, LastY, ID, Trigger1, Color])
All these numbers will be packed into the string, DataToSend$
Send this string in a message.
Unpack it like this:
If TNet_Receive(2)
NewData$ = TNetData$
Debuglog "Start Size of NewData: "+NewData.Length
X = ZInt( NewData$ ) 'First int
Y = ZInt( NewData$ ) 'Second Int
Dir = ZInt( NewData$ ) 'Third Int
Speed = ZInt( NewData$ ) 'You get he point
Acceleration = ZInt( NewData$ ) 'Fifth Int
LastX = ZInt( NewData$ )' And so on..
LastY = ZInt( NewData$ )
ID = ZInt( NewData$ )
Trigger1 = ZInt( NewData$ )
Color = ZInt( NewData$ )'Last Int
Debuglog "End Size of NewData: "+NewData.Length
'If you packed 10 Ints like I did in this example then NewData$ will be 0 in size!