Not working inside of function

BlitzMax Forums/BlitzMax Beginners Area/Not working inside of function

Arska(Posted 2012) [#1]
I think this is stupid question and i just don't figure out solution now, so i put this on beginners are.

So i am using this inside of function and i get "Expection access violation"
If multiplayer=True And sync = 1 Then
		Local itemObj:TGNetObject = CreateGNetObject:TGNetObject( host )
		SetGNetInt itemObj, 19, 1
		SetGNetFloat itemObj, 2, x
		SetGNetFloat itemObj, 3, y
		SetGNetFloat itemObj, 4, z
	EndIf


It works just fine outside of my function.

Last edited 2012


GfK(Posted 2012) [#2]
Multiplayer or sync probably isn't defined as global. And you don't have debug mode on.


Arska(Posted 2012) [#3]
Multiplayer is global and sync is variable of function


Arska(Posted 2012) [#4]
and some why debugger is giving "Unhandled Expection: Assert failed" from this line:
If GetGNetInt( remoteObj, 19) = 0 Then


Any ideas?


Floyd(Posted 2012) [#5]
If GetGNetInt( remoteObj, 19) = 0 Then
remoteObj is the only thing which is not built into BlitzMax or GNet, so start your investigation there. What is remoteObj?


Arska(Posted 2012) [#6]
i am using remoteObj and getting all kinds of gnetints, strings, floats from server, but only this variable somehow is giving me error.


H&K(Posted 2012) [#7]
Split this line
Local itemObj:TGNetObject = CreateGNetObject:TGNetObject( host )

into

Local itemObj:TGNetObject = new TGNetObject
itemObj = CreateGNetObject:TGNetObject( host )

(Im assuming host defiantly exists?)

Anyway where is error message?


Arska(Posted 2012) [#8]
Yes host exists.

Looks like "Unhandled expection: assert failed" is only occuring if i create 2 GnetObjects, but it still showing me line:
If GetGNetInt( remoteObj, 19) = 0 Then


when i remove that line it shows another line where i am trying to get gnetint, string or float.

Without debugger everything is working good and how i expected. Error comes with no reason. Is this bug of debugger or what?

And i get expection access violation when i create gnetobject inside of function. No matter debugger on or off

Last edited 2012