RPG Chat Window
RPG Chat Window
RPG Chat Window
RPG Chat Window
RPG Chat Window
RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window
RPG Chat Window RPG Chat Window
RPG Chat Window
Go Back  Xtreme Visual Basic Talk > > > RPG Chat Window


Reply
 
Thread Tools Display Modes
  #1  
Old 07-12-2005, 01:06 PM
notoriousbig notoriousbig is offline
Newcomer
 
Join Date: Jul 2005
Posts: 9
Default RPG Chat Window


I am creating an rpg and in it i have a chat window that is going to tell you all of your quests and npc dialoges as well is let you type a message into a box click send and it gets displayed in the chat chat window. my problem is when i type a message in and click send that works fine but when i type another that message gets erased and the new gets displayed. i would like to have it so all the messages i send get displayed.
Reply With Quote
  #2  
Old 07-12-2005, 02:22 PM
DKF295's Avatar
DKF295 DKF295 is offline
Centurion
 
Join Date: May 2004
Location: La Crosse, WI
Posts: 180
Default

Thereis almost no way for us to help you if you dont show us HOW you are doing this. The easiest way to do that would be to post the related code. Be sure to use the [vb][/vb] tags
__________________
http://imgs.xkcd.com/comics/goto.png
Fear the raptors.
Reply With Quote
  #3  
Old 07-12-2005, 02:30 PM
Klodo's Avatar
Klodo Klodo is offline
Centurion
 
Join Date: Mar 2004
Location: Brussels
Posts: 135
Default

You probably are doing something like that:

Code:
ChatBox.Text = NewMessage

When you should be doing something like that:

Code:
ChatBox.Text = ChatBox.Text & vbCrLf & NewMessage
__________________
"More than one mage has been driven insane by the sound of the millstone relentlessly grinding away." - Millstone
Reply With Quote
  #4  
Old 07-12-2005, 02:41 PM
notoriousbig notoriousbig is offline
Newcomer
 
Join Date: Jul 2005
Posts: 9
Default

ya thats exacly what i was doing. i tryed what u said i should do and it worked perfectly. i just couldnt remember the vbcrlf command. thanks alot for your help. One other thing is there a way i could just press enter instead of clicking send?
Reply With Quote
  #5  
Old 07-13-2005, 04:00 PM
AASoft's Avatar
AASoft AASoft is offline
Centurion
 
Join Date: Dec 2003
Location: Canada, BC
Posts: 112
Default

Code:
Private Sub txtMessageBox_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then ChatBox.Text = ChatBox.Text & vbCrLf & txtMessageBox.Text End If End Sub

where txtMessageBox is you message textbox
__________________
NOTE: I may be wrong. No warranties are given for the above post. :D
Reply With Quote
  #6  
Old 07-13-2005, 06:09 PM
DubbleClick's Avatar
DubbleClick DubbleClick is offline
Contributor
 
Join Date: Mar 2005
Location: Tennessee
Posts: 511
Default

And you may want to blank out the textbox when you press enter as well.
... and, you want the old text to scroll up out of the view of your textbox, so set the selstart at the end too.
Code:
Private Sub txtMessageBox_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then ChatBox.Text = ChatBox.Text & vbCrLf & txtMessageBox.Text ChatBox.SelStart = Len(ChatBox.Text) txtMessageBox.SetFocus txtMessageBox.Text = "" End If End Sub
Reply With Quote
  #7  
Old 07-13-2005, 06:13 PM
DubbleClick's Avatar
DubbleClick DubbleClick is offline
Contributor
 
Join Date: Mar 2005
Location: Tennessee
Posts: 511
Default

Quote:
Originally Posted by notoriousbig
One other thing is there a way i could just press enter instead of clicking send?
I would do away with a "send" button altogether. Using the enter key should be sufficient enough. Keep it simple as possible. The fewer the controls you can get away with, the more desirable the game interface.
Reply With Quote
  #8  
Old 07-14-2005, 05:04 PM
AASoft's Avatar
AASoft AASoft is offline
Centurion
 
Join Date: Dec 2003
Location: Canada, BC
Posts: 112
Default

and ALSO i would suggest you have a separate function for adding chate text, and not referencing the textboxes every time
__________________
NOTE: I may be wrong. No warranties are given for the above post. :D
Reply With Quote
  #9  
Old 07-18-2005, 11:19 AM
notoriousbig notoriousbig is offline
Newcomer
 
Join Date: Jul 2005
Posts: 9
Default

Now that i have my chat working i want to make it so if you type something like /race into the chat bar a a message box will pop up telling you your race or whatever. i am doing this by storing the race in a dimed global variables. here is the code i have and it works the first time you type in something but if you want to find out any other info it just displayes what i typed in the chat bar:

Private Sub chatbar_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then



If chatbar.Text = "/race" Then
ok = MsgBox(race)
chatbar.Text = ""
ElseIf chatbar.Text = "/profession" Then
ok = MsgBox(profession)
chatbar.Text = ""
ElseIf chatbar.Text = "/alignment" Then
ok = MsgBox(alignment)
chatbar.Text = ""
Else
chatwindow.Text = chatwindow.Text & username & ": " & chatbar.Text + vbNewLine

chatwindow.SelStart = Len(chatwindow.Text)
chatbar.SetFocus
chatbar.Text = ""


End If
End If

End Sub
Reply With Quote
  #10  
Old 07-18-2005, 02:42 PM
AASoft's Avatar
AASoft AASoft is offline
Centurion
 
Join Date: Dec 2003
Location: Canada, BC
Posts: 112
Default

hmm, first of all, make sure that MultiLine of the chatbar is set to False. Second, try changing the code to this:

Code:
Private Sub chatbar_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If chatbar.Text = "/race" Then ok = MsgBox(race) ElseIf chatbar.Text = "/profession" Then ok = MsgBox(profession) ElseIf chatbar.Text = "/alignment" Then ok = MsgBox(alignment) Else chatwindow.Text = chatwindow.Text & username & ": " & chatbar.Text + vbNewLine chatwindow.SelStart = Len(chatwindow.Text) End If chatbar.SetFocus chatbar.Text = "" End If End Sub
__________________
NOTE: I may be wrong. No warranties are given for the above post. :D
Reply With Quote
  #11  
Old 07-18-2005, 04:54 PM
notoriousbig notoriousbig is offline
Newcomer
 
Join Date: Jul 2005
Posts: 9
Default

Ya that code worked perfect plus the muliline was turned to true. thanks alot for the help.
Reply With Quote
  #12  
Old 07-18-2005, 04:59 PM
AASoft's Avatar
AASoft AASoft is offline
Centurion
 
Join Date: Dec 2003
Location: Canada, BC
Posts: 112
Default

i missed a line there...take out the SelStart line:
Code:
Private Sub chatbar_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If chatbar.Text = "/race" Then ok = MsgBox(race) ElseIf chatbar.Text = "/profession" Then ok = MsgBox(profession) ElseIf chatbar.Text = "/alignment" Then ok = MsgBox(alignment) Else chatwindow.Text = chatwindow.Text & username & ": " & chatbar.Text + vbCrLf End If chatbar.SetFocus chatbar.Text = "" End If End Sub
edit: and change vbnewLine to vbCrLf, its more correct that way
__________________
NOTE: I may be wrong. No warranties are given for the above post. :D
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
RPG Chat Window
RPG Chat Window
RPG Chat Window RPG Chat Window
RPG Chat Window
RPG Chat Window
RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window RPG Chat Window
RPG Chat Window
RPG Chat Window
 
RPG Chat Window
RPG Chat Window
 
-->