Oh man, i hoped to solve this all myself but i need help again.
Ill keep it short.
Why isnt this working? I get a "Unhandled excepton:: Call to uninitialized function pointer." error...
If i call it. And if i check it for being set, it returns a false.
It looks as if "client.OnConnect = blah" does have any effect at all.
Ill keep it short.
Local client:TClient = New TClient client.SetPlayerName("Patrick") client.Connect("127.0.0.1", 1234) client.OnConnect = blah Function blah() While Not KeyHit(KEY_ESCAPE) DrawText "Connected!", 10, 10 Delay(100) Flip Wend End Function Type TClient Extends TPacket Field name:String 'Callback Field OnConnect() Field OnConnectFail() Method SetPlayerName(name:String) Self.name = name 'if is connected, send new name End Method Method Connect(host:String, port:Int, timeout:Int = 30) Self.host = host Self.port = port Self.tcpsock = CreateTCPSocket() If ConnectSocket(Self.tcpsock, HostIp(Self.host), Self.port) 'Self.tcpstream = CreateSocketStream(tcpsock) If Self.OnConnect Self.OnConnect() Else If Self.OnConnectFail Self.OnConnectFail() End If End Method
Why isnt this working? I get a "Unhandled excepton:: Call to uninitialized function pointer." error...
If i call it. And if i check it for being set, it returns a false.
It looks as if "client.OnConnect = blah" does have any effect at all.