Thanks for reading. If I get this sorted, i'll post the solution here. If it's too hard to read my code, simply ask and i'll comment the hell out of it.
Basically, me and a friend are trying to get a simple chat system working. After that we're going to fiddle more and make a mutliplayer game. We've read tons of threads and can't see what is wrong. Connecting to 127.0.0.1 works fine, but through hamachi or interal IP connections it fails. We can ping eachother just fine, and play other games perfectly.
Rem Project: Chat
Rem Created: Friday, April 02, 2010
Rem ***** Main Source File *****
SendText$ = ""
RecText$ = ""
perform checklist for net connections
cls
print "Connection Types"
for c=1 to checklist quantity()
print c;". ";checklist string$(c)
next c
SelectionIndex=0
if checklist quantity()<>0
while SelectionIndex<1 or SelectionIndex>checklist quantity()
print : input "Select A Number>";SelectionIndex
endwhile
endif
CLEAR ENTRY BUFFER
input "Do you wish to host? Type 1 for yes. 0 to join game directly", choice
cls
if choice = 0
input "Please enter IP Address: ", IP$
cls
print "Loading..."
wait 5
set net connection selectionindex,IP$
JOIN NET GAME 1, "Ben"
endif
if choice = 1
cls
print "Loading..."
wait 5
set net connection selectionindex,"127.0.0.1"
CREATE NET GAME "chat", "Paul", 3
endif
CLS
SYNC ON
SYNC RATE 30
global arraysize = 10
global dim messages$(arraysize)
rem main loop lol
Do
GET NET MESSAGE
if NET MESSAGE EXISTS() = 1
RecText$ = NET MESSAGE STRING$()
endif
remstart
if rnd(50) = 5
RecText$ = "Hey, test message."
endif
if rnd(50) = 10
RecText$ = "WOAH!"
endif
remend
Debug()
if returnkey() = 1 and len(sendtext$) > 0
rectext$ = SendText$
SendText$ = ""
endif
if returnkey() = 1
SendText$ = ""
CLEAR ENTRY BUFFER
endif
if RecText$ <> ""
addMessage(RecText$)
RecText$ = ""
endif
if entry$() <> ""
SendText$ = SendText$ + entry$()
ENDIF
CLEAR ENTRY BUFFER
if leftkey() = 1
SendText$ = left$(SendText$ , len(sendtext$)-1)
wait 70
ENDIF
for index = 1 to arraysize
y=(index*15) - 15
ink rgb(255,255,255), rgb(255,255,255)
rem text 0, y, str$(index) + ": " + messages$(index) FOR TESTING INDEXING IS CORRECT
text 0, y, messages$(index)
NEXT index
ink rgb(0,255,0), rgb(0,0,0)
text 0,y+15, SendText$
sync
cls
LOOP
function addMessage(Message$)
if messages$(arraysize) <> ""
for index = 1 to arraysize-1
messages$(index) = messages$(index + 1)
NEXT index
messages$(arraysize) = message$
Else
for index = 1 to arraysize
if messages$(index) = ""
messages$(index) = message$
index = arraysize
ENDIF
NEXT index
endif
ENDFUNCTION
function debug()
y = 165
remstart
for index = 1 to arraysize
ink rgb(255,255,255), rgb(255,255,255)
text 0, y, messages$(index)
y=y+15
NEXT index
text 0,y, "Entry buffer is " + str$(len(entry$())) + " Characters long"
remend rem checks text
if NET GAME EXISTS() = 1
ink rgb(50,50,255),rgb(0,0,0)
text 0,y, "Net game started."
ELSE
ink rgb(50,50,255),rgb(0,0,0)
text 0,y, "Net game down."
endif
y=y+30
rem Find all current players in game
perform checklist for net players
text 0, y, "List of players!"
for c=1 to checklist quantity()
y = y + 15
text 0, y, str$(c) + ". " + checklist string$(c) + " ID:" + str$(checklist value a(c)) + " UNIQUE:" + str$(checklist value b(c)) + " "
y = y +15
if checklist value c(c)=1 then text 0, y, "(me) ";
y = y + 15
if checklist value d(c)=1 then text 0, y, "(host) ";
y = y + 15
next c
ENDFUNCTION
^^ There's the huge wad of code. If any of you spot the mistake, please help!
Turbosmoothed Realism(tm)