// Project: prbMulti SetErrorMode(2) // set window properties SetWindowTitle( "prbMulti" ) SetWindowSize( 1024, 768, 0 ) SetWindowAllowResize( 1 ) // set display properties SetVirtualResolution( 1024, 768 ) SetOrientationAllowed( 1, 1, 1, 1 ) SetSyncRate( 30, 0 ) SetScissor( 0,0,0,0 ) UseNewDefaultFonts( 1 ) //This was the template's default setup, now comes my real program: local host as integer local NetID as integer local port as integer local id1 as integer local id2 as integer local mockID as integer //because in theory I only need one client port = 56950 //suggestions are welcome, but not the main problem AddVirtualButton(1, 100, 100, 100) AddVirtualButton(2, 300, 100, 100) SetVirtualButtonText(1, "host") SetVirtualButtonText(2, "join") CreateEditBox(1) SetEditBoxPosition(1, 100, 400) do if GetVirtualButtonPressed(1) //host NetID = HostNetwork("NetworkName", "HostName", port) while GetNetworkNumClients(NetID) < 2 print("IP: "+GetDeviceIP()) Sync() endwhile Id1 = GetNetworkFirstClient(NetID) Id2 = GetNetworkNextClient(NetID) mockID = GetNetworkNextClient(NetID) while mockID <> 0 mockID = GetNetworkNextClient(NetID) endwhile SetNetworkLocalInteger(NetID, "var", 2, 0) do print("hosted") Sync() loop endif if GetVirtualButtonPressed(2) //join NetID = JoinNetwork(GetEditBoxText(1), port, "ClientName") if GetNetworkExists(NetID) Id1 = GetNetworkFirstClient(NetID) Id2 = GetNetworkNextClient(NetID) mockID = GetNetworkNextClient(NetID) while mockID <> 0 mockID = GetNetworkNextClient(NetID) endwhile do print(Str(GetNetworkClientInteger(NetID, id1, "var"))) Sync() loop else do print("FAILED") Sync() loop endif endif Sync() loop