I'm not sure what the problem is, but please use code boxes, it will make people want to read your posts more
.
[ code ]
*CODE GOES HERE
[ /code ]
(without the spaces of course)
Your code in a code box:
REM Project: net04Nachher
REM Created: 25.01.2009 10:45:42
REM
REM ***** Main Source File *****
REM
REM *** use a window ***
set window on
set window size 500,700
set window position 0,0
r = EstablishConnection()
rem *** Send and recieve messages ***
do
rem *** Send message ***
input "Choose number of player to recieve message ",playerno
input "Enter your message ", mes$
send net message string playerno,mes$
rem *** Display any recieved messages ***
repeat
get net message
until net message exists()
while net message exists()
print "Message from player ID : ",net message player from()
print net message string$()
get net message
endwhile
loop
#constant Host 1
#constant Client 2
function EstablishConnection()
TCPIPno = GetTCPIPNumber()
IPaddress$ = GetIPAddress$()
rem *** select tcp/ip connection ***
set net connection TCPIPno, IPaddress$
option = HostorClient()
if option = Host
rem *** host program ***
input "Enter the name you wish to use : ",name$
input "Enter maximum users : ",max
input "Enter session name : ",session$
create net game session$,name$,max,1
else
ListNetSessions()
session = GetSessionToJoin()
input "Enter the name you wish to use : ",name$
join net game session,name$
ListPlayersDetails()
endif
get net message
endfunction option
function GetTCPIPNumber()
result = 0
perform checklist for net connections
for c = 1 to checklist quantity()
if left$(checklist string$(c), 8) = "Internet"
result = c
endif
next c
if result = 0
print "No connection available! press any key."
wait key
end
endif
endfunction result
function GetIPAddress$()
input "Enter the IP address of the Host machine : ",IPaddress$
endfunction IPaddress$
function ListNetSessions()
print "Session available : "
perform checklist for net sessions
for c = 1 to checklist quantity()
print c, " ", checklist string$(c)
next c
endfunction
function ListPlayersDetails()
print "Players in session"
perform checklist for net players
for c = 1 to checklist quantity()
print c, " Name : ",checklist string$(c)
print c, " Local ID : ",checklist value A(c)
print c, " Universal ID : ", checklist value B(c)
print c, " Me? : ",checklist value C(c)
print c, " Host? ",checklist value D(c)
next c
endfunction
function HostorClient()
print " Choose from the following options : "
print " 1 - Host a new session"
print " 2 - Join an existing session"
input " Enter option : ", option
while option < 1 or option > 2
print "Enter 1 or 2"
input "Enter option : ",option
endwhile
endfunction option
function GetSessionToJoin()
input " Enter session you wish to join : ",session
while session < 1
print "Enter the session number from the list given"
input "Enter option : ",session
endwhile
endfunction session
end
<---Spell casting battle game!