well i restarted my mud project so its easier for me to use.. this is what i got in the last hour so so, and hour of this thing not working!
AppTitle "MDB-MUD DEMO VERSION 1"
Graphics 600,400,16,3
Color 0,0,255
Global Server
Const Menu=1
Const NewChar1=2
Const NewChar2=3
Const Newchar3=4
Const PlayChar1=5
Const PlayChar2=6
Const Playing=7
Const Logoff=8
Global comm1$
Global comm2$
Global comm3$
Global comm4$
Global message$
Global msg$
Print "MDB-MUD Demon Version 1**********"
Print "Programmed in Blitz Basic! **********"
Print "Written by Michael D. Boruta II*******"
Print "*******************************"
server=CreateTCPServer(4000)
If Not server Then
Print "Server Failed to start on port 4000!"
Print "terminating Program!...sorry!"
Delay 1000
End
Else
Print "Server started! Telnet to port 4000 to play!"
Print "*Now Listening for *Connections**"
Print "Hit the ESCAPE KEY to Shutdown MDB-MUD!"
EndIf
While Not KeyHit(1)
CheckNew
Readstream
Delay 200
Wend
Cls:Text 100,100,"MDB MUD TERMINATED...shutting down!"
Delay 1500
End
Function CheckNew()
stream=AcceptTCPStream(server)
If stream Then
Print "*CONNECTION RECIEVED*"
p.player=New player
p\stream=stream
p\status=Menu
WriteLine p\stream, "Welcome to MDB MUD Server!!!"
WriteLine p\stream, ""
DisplayMenu p
EndIf
End Function
Function ReadStream()
For p.player=Each player
If Not p\stream Logoff p
If ReadAvail(p\stream) Then
CommandReader p
EndIf
Next
End Function
Function commandreader(p.player)
comm=1
comm1$=""
comm2$=""
comm3$=""
comm4$=""
message$=""
While ReadAvail(p\stream)
d=ReadByte(p\stream)
Select True
Case d>32
If comm=1 Then comm1$=comm1$+Chr$(d)
If comm=2 Then comm2$=comm2$+Chr$(d)
If comm=3 Then comm3$=comm3$+Chr$(d)
If comm=4 Then comm4$=comm4$+Chr$(d)
If comm=5 Then message$=message$+Chr$(d)
Case d=32
If comm=1 Then comm=2 ;And comm1$=comm1$
If comm=2 Then comm=3 ;And comm2$=comm2$
If comm=3 Then comm=4 ;And comm3$=comm3$
If comm=4 Then comm=5 ;And comm4$=comm4$
End Select
Wend
comm2$=comm2$+" "
Print "Command:"+comm2$+" "+"xxx"+"xxx"
SelectStatus p
End Function
Function DisplayMenu(p.player)
WriteLine p\stream, ""
WriteLine p\stream, ""
WriteLine p\stream, ""
WriteLine p\stream, " Main Menu:"
WriteLine p\stream, " *********************"
WriteLine p\stream, " * *"
WriteLine p\stream, " * (P)lay Character *"
WriteLine p\stream, " * *"
WriteLine p\stream, " * (N)ew Character *"
WriteLine p\stream, " * *"
WriteLine p\stream, " * (W)hos Online *"
WriteLine p\stream, " * *"
WriteLine p\stream, " * (V)iew Helpfiles *"
WriteLine p\stream, " * *"
WriteLine p\stream, " *********************"
WriteLine p\stream, " * *"
WriteLine p\stream, " * Your Command:___ *"
WriteLine p\stream, " * *"
WriteLine p\stream, " *********************"
WriteLine p\stream, " "
End Function
Function SelectStatus(p.player)
Select True
Case p\status=PLAYING
Playing p
Case p\status=Menu
Menu p
Case p\status=NewChar1
SelectName p
Case p\status=NewChar2
SelectPassword p
Case p\status=NewChar3
VerifyPassword p
Case p\status=PlayChar1
ValidateName p
Case p\status=Playchar2
Validatepassword p
Case p\status=Logoff
Logoff p
End Select
End Function
Function Playing(p.player)
command$=comm1$
x=0
Select True
Case command$="gossip"
;ks$=Chr$(160)
;comm2$=comm2$+Chr$(32)
;comm3$=comm3$+Chr$(32)
msg$=comm2$+comm3$+comm4$+message$
For a.player=Each player
If a\name$=p\name$ Then
WriteLine p\stream, "You gossip: "+msg$
Else
WriteLine a\stream, p\name$+" gossips "+msg$
EndIf
Next
x=1
Case command$="quit"
logoff p
x=1
Case command$="who"
wholist p
x=1
Case command$="recall"
p\curr_room=000
WriteLine p\stream, "You recall back to Town Sqaure"
x=1
Case command$="help"
WriteLine p\stream, "Sorry, no Helpfiles have been added yet *sniff*"
x=1
Case command$=""
WriteLine p\stream, "You look around Town Sqaure wearily"
x=1
End Select
If x<>1 WriteLine p\stream, "Sorry that command is not yet written!"
End Function
Function Menu(p.player)
Print "Function Menu!"
If comm1$<>"" Then
command$=Left(comm1$,1)
Print command$
EndIf
If command$="n" Then
WriteLine p\stream, "Please choose your name: "
p\status=NewChar1
EndIf
If command$="w" wholist p
If command$="v" Then
WriteLine p\stream, "Sorry no helpfiles have been added yet!"
EndIf
If command$="p" Then
WriteLine p\stream, "What is your characters name? "
p\status=Playchar1
EndIf
End Function
Function SelectName(p.player)
If command$<>"" Then
WriteLine p\stream, "Sorry your Name must be at least 3 characters long...try again."
Else
p\name$=comm1$
WriteLine p\stream, "Welcome to MDB MUD!!!"+p\name$
WriteLine p\stream, "What password would you like? "
p\status=NewChar2
EndIf
End Function
Function SelectPassword(p.player)
If comm1$<>"" Then
p\password$=comm1$
WriteLine p\stream, "Please Verifty that your password is: "+p\password$
p\status=NewChar3
Else
WriteLine p\stream, "Sorry password not accepted!"
EndIf
End Function
Function VerifyPassword(p.player)
checkpw$=comm1$
If comm1$=p\password$ Then
WriteLine p\stream,"Password Verified....You are now Playing"
p\status=PLAYING
startup p
Else
WriteLine p\stream, "Sorry the passwords did not match, please try again!"
p\password$=""
p\status=NewChar2
WriteLine p\stream, "Please try another password:"
EndIf
End Function
Function Validatename(p.player)
End Function
Function Validatepassword(p.player)
End Function
Function Startup(p.player)
p\curr_room=000
WriteLine p\stream, "This is a test server, Races,Classes, Areas, etc are not in yet"
WriteLine p\stream, "The following commands are in(case sensitive too"
WriteLine p\stream, "quit recall who help gossip"
WriteLine p\stream, "almost in: north south east west ne se sw se up down look(room only)"
WriteLine p\stream, "almost in: say tell whois look(someone), look(object), cast"
WriteLine p\stream, "almost in: helpfiles, spell,skill.score,stat"
WriteLine p\stream, "Please enjoy the game, hopefully will soon be completed"
WriteLine p\stream, "New areas, etc etc will always be added...Thank you for playing!"
WriteLine p\stream, "Welcome to Town Sqaure"
End Function
Function logoff(p.player)
If p\stream Then
WriteLine p\stream, "GOODBYE!...come back soon!"
EndIf
CloseTCPStream(p\stream)
Delete p
End Function
Function Wholist(p.player)
WriteLine p\stream, "Players found:"
c#=0
For a.player=Each player
c#=c#+1
WriteLine p\stream, "Level 50: "+p\name$+" "+p\title$
Next
WriteLine p\stream, "Total players found: "+c#
End Function
Type player
Field stream
Field status
Field name$
Field password$
Field Title$
Field curr_room
End Type