Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / basic in game chat, no network

Author
Message
Orion Pax
20
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 18th Sep 2003 05:45
this is a bit of code i finally came up with to make a chat routine in DBC
it allows you to type and the game still updates and runs
the coordinates for the chat are based on 800x600 screen and are on the bottom of the screen

i have tried for/next loops to just eliminate the repeating of the two areas but it just doesnt work

Orion Pax
20
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 18th Sep 2003 16:10
does any one know how to do a loop in my code up there so you wont have to repeat those commands up there?
waffle
21
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 18th Sep 2003 17:09
i do not understand the question. perhaps this should be in the newcombers section. If your code works, just drop it into a function and forget about it until needed. If you just wish to have someone show you how to make it neater, thats a newbe question.

the way i would place it into a function is.....
dim Chat$(5)
function GetUserChat()
rem chat routine
if returnkey()=1
for n=5 to 1 step -1
Chat$(n)=Chat$(n-1)
next n
Chat$(0)=""
else
new$=entry$()
for n=1 to len(new$)
if asc(mid$(new$,n))=8
Chat$(0)=left$(Chat$(0),len(Chat$(0))-1)
else
Chat$(0)=Chat$(0)+mid$(new$,n)
endif
next n
clear entry buffer
endif

endfunction
function ShowChat(x#,y#)
yp#=0
for n=5 to 0 step -1
text x#,y#+yp#,chat$(n)
yp#=yp#+15
next n

endfunction

in this manner, you can display your text anywhere just by changing the x/y in the function call.

internet gaming group

Login to post a reply

Server time is: 2024-04-20 17:22:52
Your offset time is: 2024-04-20 17:22:52