Is there somethign wrong with this
Blitz3D Forums/Blitz3D Beginners Area/Is there somethign wrong with this
| ||
Function maininput() Print"please type a command" in$=Input() check() End Function Function check() If Lower$(in$)="start" startserver() ElseIf Lower$(in$)="exit" End Else Print"No command found" EndIf End Function is there |
| ||
Yes, the variable in$ is not accessible in the function check(). Either make it a global variable or pass it in the function call. |
| ||
ahh thanks |
| ||
ok I fixed that thanks to your help but I am trying to start a server Function startserver() svr=CreateTCPServer(8080) If svr<>0 Then Print "Server started successfully." Else Print "Server failed to start." End If End Function and it starts it and then says it didn't and then quits |
| ||
Are you calling the function repeatedly? It may be you're trying to set up multiple servers. |
| ||
Global svr=0 startserver() startserver() While Not KeyHit(1) Wend Function startserver() If svr<>0 Print "Server already started!" Return EndIf svr=CreateTCPServer(8080) If svr<>0 Print "Server started successfully." Else Print "Server failed to start." End If End Function |
| ||
why do you start the server twice |
| ||
To show you that the second time does not actually start another server it just returns the message "Server already started!" |