Computer Science Canada Turing Chat - Emotion Problem |
Author: | Tycoon [ Fri Feb 17, 2006 10:35 pm ] | ||
Post subject: | Turing Chat - Emotion Problem | ||
NOTE: This was a chat program I found on the forums and to get more involved with Turing I am changing it around to my needs. The Problem: I want the user to be able to enter emotions and as you can see I coded ![]() Can anyone help me?
Thank you for the origonal code and in advace for the help Tycoon ^_^ |
Author: | Delos [ Sat Feb 18, 2006 10:58 am ] | ||
Post subject: | |||
Well yes it's going to appear at (0,0) since that's where you've told it to appear ![]() Tycoon wrote:
You'll want to change those 0's to variables instead, then you'll need to figure out where the typing is currently occuring, and draw accordingly. If you're using pure text, you can use the 'whatcol' and 'whatrow' functions - rather nifty they are! - to get your bearings. As a side note, this really isn't the sort of programme to use to orient yourself with Turing. Looking through the Tutorials might be a better idea. Another note: Yes this is from [Turing Source Code] but it would still be polite to acredit this code to its original author...you know, one of those "based on the code of..." type things. |
Author: | Cervantes [ Sat Feb 18, 2006 11:09 am ] |
Post subject: | |
The text you type should be sent to the other computer without rendering it. That is, if I type "Hey Tycoon! :)" it should be sent through to you as is, without changing the ":)" to a smilie graphic. You should have a render_text procedure, or some such, to search through the text and change all emoticons to their appropriate graphics. It should also draw the text in the appropriate location. The server and client should run this procedure each time a new message appears, either a message from themselves or from the other one. Also, you could use a less invasive method to get input. The "if hasch then" is a good start, but it only works well enough with getch. Sticking a get inside the "if hasch then" will only make getting the first character painless; you're still going to have to wait to get the rest of the characters. I suggest you use a text field to get user input. This could be a Turing's GUI Textfield, or you could try making one of your own. Alternatively, you could use mine[/shameless plug]. |
Author: | MysticVegeta [ Sat Feb 18, 2006 4:20 pm ] |
Post subject: | |
Hmm well for the smilies, you can always export all the words into a flex array and check for emoticons... Its somewhere on the source code I posted a String.split(x:string) module... |
Author: | Cervantes [ Sat Feb 18, 2006 4:49 pm ] |
Post subject: | |
MysticVegeta wrote: Hmm well for the smilies, you can always export all the words into a flex array and check for emoticons... Its somewhere on the source code I posted a String.split(x:string) module...
How does your String.split function return a flexible array? So far as I know, that's not permitted. Why split it into a flexible array? You've got the message as a string, and you can do plenty of string manipulation on that message without splitting it up into a flexy array. Though it would work, it takes unnecessary memory to store the (essentially) same message again, as a flexy array. I've searched around for this much fabled String module of yours, and have yet to find anything. The closest I got was a "stringSplit" function, that is hugely redundant (you could take out those first two for loops entirely). The only string module I've found is my own. ![]() |