Little Question
Blitz3D Forums/Blitz3D Beginners Area/Little Question
| ||
Okay before I add more on to my chat program I wanted to know is there just a way to Clear the input thing off the screen without clearing the messages that have been sent? I don't want to go back and rescript a Whole nother window to send it to the chat window if I aint got to.Any and all help is appreciated thanks :D |
| ||
Of course, I would think you would simply need to store each line of text in a 'type' for instance, displaying when and if you needed to. |
| ||
Use an array to record the messages or write to a file. |
| ||
Thanks guys will try both I was thinking of trying something like u both said. |
| ||
Type MessageList Field Message$ End Type Function AddMessage(Message$) M.MessageList=new MessageList M\Message=Message Count=0 For M.MessageList=each MessageList Count=Count+1 next if Count>20 then M.MessageList=first MessageList delete M endif End Function Function DrawMessage() For M.MessageList=each MessageList Text 0,graphicsheight()-Count*20,M\Message Next End Function In your main loop: Repeat ;do whatever you normally do. ;When a message is received use AddMessage("pass string here") cls color 255,255,255 DrawMessage() flip Until KeyDown(1) something like that perhaps... |
| ||
That was quick matty o.o I'll try it thanks. |
| ||
Ya it don't work it just makes none of it work XD. I'm about to try something myself. |
| ||
I found a way to fix my problem but now I need to know when I have the input it makes the Line that I inputed move down a space is there a way to get rid of that? I was thinking of like Reseting the X of the input to 1,1 by using Write instead of print Then everytime so on it'd +the x by 1 Would this kinda work? After this is fixed thats all I need thanks guys. |
| ||
I believe using the Locate command could help you here. http://www.blitzbasic.com/b3ddocs/command.php?name=Locate&ref=2d_a-z |
| ||
C = "0" Function TextMove() Y="1" If C = "1" Then Y= Y+1 End Function I tried this and just to call the function but It eventually adds up to were it skips lines and stuff :(. |
| ||
"C" will always be zero in the function you've posted - firstly because it is a local variable inside TextMove() and also because in that code snippet there you've done nothing to cause C to change. |
| ||
Y = 1 Y = Y+1 Text 1,Y,Name$ + " Says:" + Message$,False,False See this makes it do this: line 1.Prints Line 2.Prints Line 3.skip Line 4.skip Line 5.Prints Any ideas? |
| ||
That small code snipped will not do the steps you've just outlined. Post the rest of your code and we may be able to help. I think you'll find the code I posted earlier does work - when you apply it correctly. |
| ||
See no I think you read my statement wrong.Thats what it IS doing but not what I want it to do also I will send my code ;-more boxing----; Graphics 300,300 AppTitle "Revenge studios Chatroom" ;---boxing----------------------; ;---Boxing out Login stuff---; Name$=Input("Name:") ;---Boxing out stuff---; ;-xx-xx--Boxing out Joining stuff--xx-xx- Ip$="192.168.0.100" GameName$="Revenge Studios" Join=JoinNetGame(GameName$,Ip$) Select Join Case 1 Print ("Joined Revenge Studios Chatroom Succesfully") Player$=CreateNetPlayer(Name$) Cls Case 2 Print ("Failed to join") WaitKey() End End Select ;-xx-xx--Boxing out Joining stuff--xx-xx- While 1 ;--Sending message--------; Color 0,0,0 Message$=Input() SendNetMsg(1,Message$,Name$,0,1) ;--Sending message--------; ;--Reciving---; If RecvNetMsg() Then msgType$=NetMsgType() EndIf If msgType$>0 And msgType$<100 Then msgFrom$=NetMsgFrom() msgData$=NetMsgData$() EndIf Color 255,0,0 Y$ = "1" Text 1,Y$,Name$ + " Says:" + Message$,False,False Y$ = Y$ + 1 ;--Reciving---; Wend Here if anyone copies it or wants to use it go on ahead like I give a damn lol |
| ||
I have fixed the entire thing will a couple of test. Thanks for all help and feedback :). |