Type Problems
Blitz3D Forums/Blitz3D Programming/Type Problems
| ||
For some reason this keeps freezing the host, but not the client, any clues? I think it has something to do with the mesh, because when I take it out it works... I've tried using a cube, even a pivot in it's place, but to no avail. I also tried restricting the Entity to an interger (%). Also, to note, something else odd is when I move creating a "New" type for the object to the bottom of the code it gives me a memory access error (even though I have a globalized type at the beginning). Again, it does not give the same error on the client (even though the type and the entity are both still created). [CODE] Function SN_CreateObject( MsgData$ ) IDStart=(Instr(MsgData$,"*"))+1 ;Beginning IDEnd=(Instr(MsgData$,"M=")) ;End IDLength=IDEnd-IDStart ;Length TID%=Int(Mid$(MsgData$,IDStart,IDLength)) ;Set Variable If TID%<>0 SN_NObj.SN_Object = New SN_Object SN_NObj\ID%=TID% ;Parse Mesh MStart=(Instr(MsgData$,"M="))+2 MEnd=(Instr(MsgData$,"N=")) MLength=MEnd-MStart SN_NObj\Mesh$=Mid$(MsgData$,MStart,MLength) DebugLog.Print SN_NObj\Mesh$ SN_NObj\Entity%=LoadMesh( SN_NObj\Mesh$ ) ;Load The Mesh ;HideEntity SN_NObj\Entity ;Hide it until ready for use ;Parse Name NStart=(Instr(MsgData$,"N="))+2 NEnd=(Instr(MsgData$,"&")) NLength=NEnd-NStart SN_NObj\Name$=Mid$(MsgData$,NStart,NLength) EndIf End Function [/CODE] |
| ||
Hmm.. This is really frustrating... I've tried both here and at www.blitzcoder.com, but to no avail.. Please if I can't find an answer I might end up e-mailing Mark, but I doubt I'll get any more of a response than I'm getting here :(. |
| ||
I doubt anyone can guess the problem. You will have to debug this yourself. There is no obvious reason it should freeze, whatever that means. But liberal use of DebugLog should show where it stops doing what you expect. For example, before each call to SN_CreateObject you could have: DebugLog "About to call SN_CreateObject with MsgData$ = " + YourMessageData$ And similarly log a message verifying a successful function return. If that is not enough then log more details inside the function, such as the value of SN_NObj\Entity% after the mesh is loaded. Incidentally, the command DebugLog.Print apparently works because the parser thinks .Print is a label and ignores it. The following bizarre code also works: DebugLog.IgnoreMe "message" x# = Sin.ThisIsSillyButCorrect(30) DebugLog x This writes message and 0.5 to the debuglog. |