Thank you mrnaughty. I'm sorry I wasn't able to respond in the chat room. This was because I had the server running so long I added a sleep line to my code, so I wasn't able to talk back.
and you're right, I do need a backspace, so now that I know the code works I can add one, and I'll get on commenting the code right now.
*EDIT*
OK I have made the code a little easier to read, and I have commented it, very heavily, so It should be pretty easy to understand now.
Rem Project: chat
Rem Created: 3/23/2005 11:34:49 AM
Rem ***** Main Source File *****
`set IP address for host computer
ip$="24.92.123.105"
`get a list of net connections, and set to TCP/IP.
perform checklist for net connections
sleep 50
for x=1 to checklist quantity()
if checklist string$(a)="Internet TCP/IP Connection For DirectPlay" then netsel=x
next x
set net connection netsel,ip$
cls
`get a list of current chat room running.
perform checklist for net sessions
`display the list of chat rooms.
print "[ ",checklist quantity()," ] NET SESSIONS FOUND"
for x=1 to checklist quantity()
print x,". ",checklist string$(x)
next x
`ask user to join room, or create new one.
input "(1)JOIN / (2)CREATE: ",g
`create room if option was selected
if g=2
input "server name: ",s$
input "name: ",name$
input "max # of players: ",num
`if a server is dedicated, then all the comps that connect
` to it will send their data the server, and if the host
` leaves then all the comps disconnect. whereas, if it is
` not dedicated then all the comps communicate with each
` other, and if host leaves then the next player becomes
` host and the server continues.
input "Dedicated? (0)NO / (1)YES",flag : flag=flag+1 : `the actual values of the flag is 1 for regular(Pier/Pier) and 2 for dedicated(Client/Server), so the flag is incremented.
create net game s$,name$,num,flag
endif
`join room if option was selected
if g=1
input "join which server: ",s
input "name: ",name$
join net game s,n$
endif
`=================================
`=================================
` all connections are set
` now ready to send and
` recieve messages
`=================================
`=================================
cls
`send message to let other players know a new player joined
s$=n$+" has joined"
send net message string 0,s$
`the entry buffer is a string that stores any keypresses
`that you make throughout your program, this will clear it.
clear entry buffer
`array of all sent/recieved messages.
dim messages$(9)
`number of total messages
mnum=0
`begin main loop
do : cls
perform checklist for net players
`will print all the players in server to the rigth of the screen
for x=1 to checklist quantity()
text 300,x*30,checklist string$(x)
next x
`check for messages
get net message
message$=net message string$()
`if the message is not blank then store it in the message array
if message$>""
`if array is full then scroll the messages
if mnum=10
for x=1 to 9
messages$(x-1)=messages$(x)
next x
messages$(9)=message$
else
`if array is not full then store message in next empty string
messages$(mnum)=message$
`increment number of total messages
mnum=mnum+1
endif
endif
`write all messages to the screen
for x=1 to mnum
text 1,x*10,messages$(x)
next x
`used to find all letters typed by user
s$=entry$()
`if enter key is pressed then send the message
if (returnkey()=1 and s$>"")
repeat : until returnkey()=0
s$=name$+": "+s$
send net message string 0,s$
`if array is full then scroll messages
if mnum=10
for x=1 to 9
messages$(x-1)=messages$(x)
next x
messages$(9)=s$
else
`if array has room then store message in next empty slot
messages$(mnum)=s$
`increment number of total messages
mnum=mnum+1
endif
`get ready to send a new message
clear entry buffer
endif
`display the contents of entry buffer so the user can see what he/she is typing
text 10,300,s$
sync : loop
I still havent added a backspace feature but If I do, I'll be sure to post it here. If anyone else has a way to backspace using the entry buffer please let me know.