keine Nachricht gesendet ?

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

ToeB

Betreff: keine Nachricht gesendet ?

BeitragSa, Jun 23, 2007 14:56
Antworten mit Zitat
Benutzer-Profile anzeigen
WArum kann ich hier keine nachrivhten senden ? Also ich habs an zwei Computer ausprobviert und hab aba keine Nachrivht bekommen .... Woran liegt das ?

Code: [AUSKLAPPEN]
Graphics 800,600,16,2
SetBuffer BackBuffer()

;*** Globals : ***
Global make = 0
Global nam,pot
Global name$="Heinz",port=8000

;*** Grafiken : ***

Global Button = LoadAnimImage("gfx\Button.bmp",135,28,0,3)
MaskImage Button,255,0,255

Global Schild = LoadImage("gfx\Schild.bmp")
MaskImage Schild,255,0,255

;*** Fonts : ***

Global Schrift = LoadFont("Secret Service Typewriter",20,1,0,0)
SetFont Schrift

ClsColor 160,160,255

; MAKE = 0 -> Menü
; MAKE = 1 -> Host
; MAKE = 2 -> Join
; MAKE = 3 -> Game

Type c
Field Text$
Field y
Field Name$
End Type

Global c.c

Repeat
If make = 0
Color 0,0,255
InfoText(300,165,200,250,"PLEASE SELECT\YOUR MODE",1)

Host = CreateButton(400-135/2,250,"HOST GAME")
Join = CreateButton(400-135/2,300,"JOIN GAME")
Ende = CreateButton(400-135/2,350,"EXIT GAME")

If Hostcb = 1 Then make = 1:a$ = "Heinz"
If Joincb = 1 Then make = 2
If Endecb = 1 Then End

Hostcb = CheckButton(Host,Hostcb)
Joincb = CheckButton(Join,Joincb)
Endecb = CheckButton(Ende,Endecb)
Text 1,1,b$

EndIf

If Make = 1
Color 0,0,255

InfoText(300,165,200,80,"PLEASE PUT IN\YOUR DATAS",1)

If Mat(220,270,"NAME :") Color 255,0,0

InfoText(200,250,400,50,"NAME : ",0)

Color 0,0,255

If Mat(220,320,"PORT :") Color 255,0,0

InfoText(200,300,400,50,"PORT : ",0)

If Mat(220,270,"NAME :",0,0,1) Then nam = 1:pot = 0
If Mat(220,320,"PORT :",0,0,1) Then pot = 1:nam = 0

If nam = 1
  g = GetKey()
    If g > 0 And g <> 13 And g <> 8 name$ = name$ + Chr(g)
    If g = 8 Then name$ = Mid(name$,1,Len(Name$)-1)
    name$ = ConstString(name$,300,1)
    Rect 300+StringWidth(name$),270,1,StringHeight(name$)
    If g = 13 Then nam = 0
EndIf

If pot = 1
  g = GetKey()
    If g > 0 And g <> 13 And g <> 8 port = port + Chr(g)
    If g = 8 Then port = Mid(port,1,Len(port)-1)
    port = ConstVar(port,0,8000)
    Rect 300+StringWidth(port),320,1,StringHeight(port)
    If g = 13 Then pot = 0
EndIf

Color 0,0,255
Text 300,270,name$
Text 300,320,port
Color 150,150,150
InfoText(250,380,300,65,"")
Start = CreateButton(265,400,"Start")
Back  = CreateButton(400,400,"Back")

If BAckcb  = 1 Then make = 0:Cls
If Startcb = 1 Then
Cls
e_stream = CreateUDPStream(port)
a_stream = CreateUDPStream(port-1)
make = 3 
EndIf
Startcb = CheckButton(Start,Startcb)
Backcb  = CheckButton(Back,Backcb)


EndIf

If make = 2


EndIf

If make = 3
Ip = RecvUDPMsg(e_stream)
If Ip <> 0
c.c = New c
c\y = y:y = y + 20
c\Text$ = ReadLine(e_stream)
c\Name$ = DottedIP(Ip)
EndIf
For c.c = Each c
ColorText 100,c\y-ScrollY,"[255,0,0]"+c\Name$+"[255,255,255] : [0,255,0]"+c\Text$
If c\y-ScrollY > 500 Then ScrollY = ScrollY + 20
Next
g = GetKey()
  If g > 0 And g <> 13 And g <> 8 msg$ = msg + Chr(g)
  If g = 8 Then msg = Mid(msg,1,Len(msg)-1)
  msg$ = ConstString(msg,400,1)
  If g = 13 ;And msg <> "" Then
    c.c = New c
    c\y = y:y = y + 20
    c\Name$ = NAme$
    c\Text$ = msg$
    msg$ = ""
    WriteLine a_stream,Name$
    WriteLine a_stream,Text$
    SendUDPMsg(a_stream,Ip,port)
  EndIf
InfoText 0,550,800,50,"Message : "+msg
  Rect 150+StringWidth(msg),570,1,StringHeight(msg)
EndIf


Flip
Cls

Until KeyHit(1)
End

Function CreateButton(x,y,Text$)
Local Wert = 0
DrawImage Button,x,y,0
If ImageRectCollide(Button,x,y,0,MouseX(),MouseY(),1,1) Then
  DrawImage Button,x,y,1
    If MouseDown(1) Then
      DrawImage Button,x,y,2
      Wert = 1
    EndIf
EndIf
Color 250,150,190
Text x+135/2,y+14,Text$,1,1
Color 255,255,255
Return Wert
End Function


Function CheckButton(But,cb)
If but = 1 Then cb = 2
If cb = 2
If Not MouseDown(1) Then cb=0:Return 1
EndIf
If but = 0 Then cb = 0
Return cb
End Function

Function InfoText(x,y,width,height,Text$,xmid=0)
If width < 22 Or height < 22 Then RuntimeError "Graphikeinstellungen zu klein !"
DrawImageRect Schild,x,y,0,0,11,11
DrawImageRect Schild,x+width-11,y,124,0,11,11
DrawImageRect Schild,x,y+height-11,0,19,11,11
DrawImageRect Schild,x+width-11,y+height-11,124,19,11,11
For xx = 11 To width-11
DrawImageRect Schild,x+xx,y,20,0,1,11
DrawImageRect Schild,x+xx,y+height-11,20,19,1,11
Next
For yy = 11 To height-11
DrawImageRect Schild,x,y+yy,0,15,11,1
DrawImageRect Schild,x+width-11,y+yy,124,15,11,1
Next
For xx = 1 To (width-20)/10
For yy = 1 To (height-20)/10
DrawImageRect Schild,x+xx*10,y+yy*10,55,15,10,10
Next
Next
While Instr(Text$,"\")-1 > 0
If xmid = 0 Then
Text 20+x,20+y,Left(Text$,Instr(Text$,"\")-1)
Text$ = Mid(Text$,Instr(Text$,"\")+1,-1)
y = y + FontHeight()
EndIf
If xmid = 1 Then
Text x+width/2,20+y,Left(Text$,Instr(Text$,"\")-1),1
Text$ = Mid(Text$,Instr(Text$,"\")+1,-1)
y = y + FontHeight()
EndIf
Wend
If xmid = 0 Then Text 20+x,20+y,Text$
If xmid = 1 Then Text x+width/2,20+y,Text$,1
End Function

Function Input2$(x,y,i2$,vor$="")
g = GetKey()
If g > 0 And g <> 13 And g <> 8 i2 = i2 + Chr(g)
If g = 8 Then i2 = Mid(i2,1,Len(i2)-1)
Text x,y,vor$+i2$
Return i2$
End Function

Function Mat(x,y,Text$,xmid=0,ymid=0,modus=0)
If xmid=0 And ymid = 0
  If MouseX() > x And MouseY() > y
    If MouseX() < x+StringWidth(Text$) And MouseY() < y + StringHeight(Text$) Then 
      If Modus = 1
        If MouseDown(1) Then Return 1
      Else
        Return 1
      EndIf
    EndIf
  EndIf
EndIf
If xmid = 1 And ymid = 0
  If MouseX() > x-StringWidth(Text$)/2 And MouseY() > y
    If MouseX() < x+StringWidth(Text$)/2 And MouseY() < y + StringHeight(Text$) Then 
      If Modus = 1
        If MouseDown(1) Then Return 1
      Else
        Return 1
      EndIf
    EndIf
  EndIf
EndIf
If xmid = 0 And ymid = 1
  If MouseX() > x And MouseY() > y-StringHeight(Text$)/2
    If MouseX() < x+StringWidth(Text$) And MouseY() < y + StringHeight(Text$)/2 Then 
      If Modus = 1
        If MouseDown(1) Then Return 1
      Else
        Return 1
      EndIf
    EndIf
  EndIf
EndIf
If xmid = 1 And ymid = 1
  If MouseX() > x-StringWidth(Text$)/2 And MouseY() > y-StringHeight(Text$)/2
    If MouseX() < x+StringWidth(Text$)/2 And MouseY() < y + StringHeight(Text$)/2 Then 
      If Modus = 1
        If MouseDown(1) Then Return 1
      Else
        Return 1
      EndIf
    EndIf
  EndIf
EndIf
End Function
 
 

Function ConstString$(String$,Anzahl,mode=0)
If mode = 0 Then
If Len(String$) > Anzhal Then String$ = Mid(String$,1,Len(String$)-1)
ElseIf mode = 1
If StringWidth(String$) > Anzahl Then String$ = Mid(String$,1,Len(String$)-1)
EndIf
Return String$
End Function

Function ConstVar(Var,min,max)
If Var < min Then Var = min
If Var > max Then Var = max
Return Var
End Function

Function ColorText(x,y,Text$)
anf$ = Left(Text$,Instr(Text$,"[")-1)
Text$ = Right(Text$,Len(Text$)-Instr(Text$,"[")+1)
Text x,y,anf
x = x + StringWidth(anf)
While Instr(Text$,"]") > 0
t$ = Mid(Text$,Instr(Text$,"[")+1,Instr(Text$,"]")-Instr(Text$,"[")-1)
r  = Left (   t$,        Instr(   t$,","))
t$ = Right(   t$,Len(t$)-Instr(   t$,",")) 
g  = Left (   t$,        Instr(   t$,","))
t$ = Right(   t$,Len(t$)-Instr(   t$,",")) 
b  = Left (   t$,        Len(t$))
Color r,g,b
Text$ = Right(Text$,Len(Text$)-Instr(Text$,"]"))
n$ = Mid(Text$,1,Instr(Text$,"[")-1)
Text x,y,n$
x = x + StringWidth(n$)
Wend
Color 255,255,255
End Function


thx Wink

Crack93
Religiöse Kriege sind Streitigkeiten erwachsener Männer darum, wer den besten imaginären Freund hat.
Race-Project - Das Rennspiel der etwas anderen Art
SimpleUDP3.0 - Neuste Version der Netzwerk-Bibliothek
Vielen Dank an dieser Stelle nochmal an Pummelie, welcher mir einen Teil seines VServers für das Betreiben meines Masterservers zur verfügung stellt!

ToeB

BeitragSa, Jun 23, 2007 20:57
Antworten mit Zitat
Benutzer-Profile anzeigen
Wieso antworted keiner ? Ich warte jetzt schon seid 3.00 Uhr ... Sad

Crack93
Religiöse Kriege sind Streitigkeiten erwachsener Männer darum, wer den besten imaginären Freund hat.
Race-Project - Das Rennspiel der etwas anderen Art
SimpleUDP3.0 - Neuste Version der Netzwerk-Bibliothek
Vielen Dank an dieser Stelle nochmal an Pummelie, welcher mir einen Teil seines VServers für das Betreiben meines Masterservers zur verfügung stellt!

Tankbuster

BeitragSa, Jun 23, 2007 21:17
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich habs mir jetzt nich angeguckt (viel zu lang und unübersichtlich), aber.. vllt liegts daran:
1. IP ist kein Integer
2. IP,Port oder der Stream sind nicht Global und werden in Funktionen verwendet
3. Falsche IP
4. Falscher Port
5. Die Firewall blockt den Port Wink
6. Bedingung zum schicken wird nicht gegeben (also irgendein Fehler mit Ifs)

mehr fällt mir im Moment nicht ein.
Twitter
Download Jewel Snake!
Windows|Android

ToeB

BeitragSa, Jun 23, 2007 21:44
Antworten mit Zitat
Benutzer-Profile anzeigen
Ja danke schonmal, ich werds mal auf die sachen überprüfen, hasst mia also schon ne grundlage geben, danke Wink



thx Wink

Crackyy
Religiöse Kriege sind Streitigkeiten erwachsener Männer darum, wer den besten imaginären Freund hat.
Race-Project - Das Rennspiel der etwas anderen Art
SimpleUDP3.0 - Neuste Version der Netzwerk-Bibliothek
Vielen Dank an dieser Stelle nochmal an Pummelie, welcher mir einen Teil seines VServers für das Betreiben meines Masterservers zur verfügung stellt!

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group