rem --------------------------- HOST COMMANDS ----------------------
host:
cls
set camera view 0,0,1,1
rem sample code to setup a net connection
perform checklist for net connections
nettotal=checklist quantity()
for a = 1 to nettotal
rem find the connection for TCP/IP internet
if checklist string$(a)="Internet TCP/IP Connection For DirectPlay" then netsel=a
next a
sync
input "Enter IP Address to broadcast(including periods): ";add$
print "Connecting ..."
sync
rem add$ is the IP address, example "127.0.0.1"
set net connection netsel,add$
_playername:
input "Enter player name: ";playername$
if playername$ = "" then gosub _playername
create net game "T",playername$,4,1
do
packet$=playername$+"*"+str$(camera position x())+"*"+str$(camera position y())+"*"+str$(camera position z())+"*"+str$(camera angle x())+"*"+str$(camera angle y())+"*"+str$(camera angle z())
set camera view 0,0,800,600
gosub camera_control
rem get a list of all players
oldquant# = 1
perform checklist for net players
for i = 1 to checklist quantity()
name$=checklist string$(i)
text 10,10+(i*20),name$
next i
if checklist quantity() > oldquant#
make object sphere 99,5
endif
send net message string 0,packet$
rem search for new messages
keepgoing:
get net message
message$=net message string$()
remstart
dim packet_split$(10)
dim packet_split#(10)
splitpos=1
for i=1 to len(message$)
if mid$(message$,i) = "*"
inc splitpos
packet_split$(splitpos)=""
else
packet_split$(splitpos)=packet_split$(splitpos) + mid$(message$,i)
endif
next i
for i=1 to splitpos
text 50,50+(i*20), packet_split$(i)
next i
packet_split#(2)=Val(packet_split$(2))
packet_split#(3)=Val(packet_split$(3))
packet_split#(4)=Val(packet_split$(4))
if checklist quantity() > 1
position object 99, packet_split#(2),packet_split#(3),packet_split#(4)
endif
rem then check for any remaining messages
if net message exists()=1 then goto keepgoing
sync
loop
return
rem ---------------------------------- JOIN COMMANDS ---------------------------
join:
cls
set camera view 0,0,1,1
rem sample code to setup a net connection
perform checklist for net connections
nettotal=checklist quantity()
for a = 1 to nettotal
rem find the connection for TCP/IP internet
if checklist string$(a)="Internet TCP/IP Connection For DirectPlay" then netsel=a
next a
sync
input "Enter IP Address to connect to(including periods): ";add$
print "Connecting..."
sync
rem add$ is the IP address, example "127.0.0.1"
set net connection netsel,add$
playername:
input "Enter player name: "; playername$
if playername$ = "" then gosub playername
perform checklist for net sessions
join net game 1, playername$
do
packet$=playername$+"*"+str$(camera position x())+"*"+str$(camera position y())+"*"+str$(camera position z())+"*"+str$(camera angle x())+"*"+str$(camera angle y())+"*"+str$(camera angle z())+"*"+ping$
set camera view 0,0,800,600
gosub camera_control
rem get a list of all players
oldquant# = 1
perform checklist for net players
for i = 1 to checklist quantity()
name$=checklist string$(i)
text 10,10+(i*20),name$
next i
if checklist quantity() > 1
make object sphere 99,5
endif
send net message string 0,packet$
rem search for new messages
keepgoing:
get net message
message$=net message string$()
dim packet_split$(10)
splitpos=1
for i=1 to len(packet$)
if mid$(packet$,i) = "*"
inc splitpos
packet_split$(splitpos)=""
else
packet_split$(splitpos)=packet_split$(splitpos) + mid$(packet$,i)
endif
next i
for i=1 to splitpos
text 50,50+(i*20), packet_split$(i)
next i
rem then check for any remaining messages
if net message exists()=1 then goto keepgoing
sync
loop
return
I do see that i'm forgetting to update the Host position when joining, but that wouldn't stop the Join option from, well, joining would it?
P.S. This is what the alphabet would look like if Q and R were eliminated.