Chatbox

by Jemai1
An on-screen chat box that is easy to add into your game.
ID:1061331
 
This is an on-screen chat box that I made from an earlier time. Bravo1 suggested that I make it into a library.

Well, here it is. I hope you like it.


Version 1d (revised):
  • Optimized version of 1d

Version 1d:
  • Added font-size support.
  • Few fixes

Version 1c:
  • Other values as msg for the _message() proc are now allowed.
  • Minor internal changes regarding the _message() proc

Version 1b:
  • Added text-shadow support for better readability. (FIREking)
  • Better handling for unclosed text macros. e.g. \b, \i, \red
  • Few internal changes

Version 1:
  • Initial release
This is really well done!
Nice work!
- Writting a huge word (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) will not split the text to the next line unlike with space-separated words.

Good work!
In response to Fushimi
Fushimi wrote:
- Writting a huge word (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) will not split the text to the next line unlike with space-separated words.

Good work!

That's because maptext is supposed to line break at width but doesn't right now. Tom knows about it.
Yes, that is a maptext issue. Let's wait for a fix. ;)

Thank you guys.
I woke up last night thinking I would make a onscreen chatbox and not use the output, wondering where I was gonna get started on it, making the box but not the text yet I got bored working on it, and than I seen this just posted yesterday.... WoW, thanks and its a great library, credit will be given.
It looks really great. I wondered if there was a way to make it so you could select with the mouse the chat so you could move it without clicking up / down (the buttons on the right), but I think that's not possible yet. Anyway, it's awesome!
In response to Eternal_Memories
Eternal_Memories wrote:
It looks really great. I wondered if there was a way to make it so you could select with the mouse the chat so you could move it without clicking up / down (the buttons on the right), but I think that's not possible yet. Anyway, it's awesome!

Maptext selection is not going to happen, pretty sure of that. But I'm sure Jemai1 could add a button on there that would bring the text into a new browser window.
Nice and easy to use library. Keep it up!
In response to FIREking
FIREking wrote:
Eternal_Memories wrote:
It looks really great. I wondered if there was a way to make it so you could select with the mouse the chat so you could move it without clicking up / down (the buttons on the right), but I think that's not possible yet. Anyway, it's awesome!

Maptext selection is not going to happen, pretty sure of that. But I'm sure Jemai1 could add a button on there that would bring the text into a new browser window.

For that you can make a window in your skin file (or during runtime) containing an output control. Then, set chatlog to point at that output control. Finally, use winshow to show/hide the window.
Thank you for the thumbs up!
New version is out!

Version 1b:
  • Added text-shadow support for better readability. (FIREking)
  • Better handling for unclosed text macros. e.g. \b, \i, \red
  • Few internal changes


Screenshot:
+1
This is awesome :)
Great work! This has to be the first chat box I have seen that's rendered with maptext. It's things like this that can make you forget you are just running a "BYOND game".

Now we just need to figure out how to create an on-screen input bar. That's right, typing directly onto the map! First, you would need some kind of overlay object, similar to the arrows, stretched to the size of the input bar, to use for making it "active" by clicking it. Then, there would be macros coded in for every single letter and number, that activate or deactivate depending on whether the input bar is "active" or not. Each macro would then output the character corresponding to the pressed key, directly to the screen, as maptext. It would also need to add each letter or number to a stored list, that way, you can backspace if needed, and of course so you can press Enter to send the typed text wherever it needs to go.

I can only think of a couple limitations to using maptext. You wouldn't be able to move the "cursor" around for editing with either arrow keys or mouse, unless you simulated that with an object and some advanced string/list operations. You also wouldn't be able to paste something into the box, since to my knowledge, DM doesn't have a way to access the contents of the clipboard, unless it's hiding in the interface somewhere.

I don't even think it would lag too much. If done right, typing with it would probably be more responsive than a lot of MMOs out there that use on-screen chat boxes.
In response to Multiverse7
Multiverse7 wrote:
Great work! This has to be the first chat box I have seen that's rendered with maptext.

Now we just need to figure out how to create an on-screen input bar. That's right, typing directly onto the map! First, you would need some kind of overlay object, similar to the arrows, stretched to the size of the input bar, to use for making it "active" by clicking it. Then, there would be macros coded in for every single letter and number, that activate or deactivate depending on whether the input bar is "active" or not. Each macro would then output the character corresponding to the pressed key, directly to the screen, as maptext. It would also need to add each letter or number to a stored list, that way, you can backspace if needed, and of course so you can press Enter to send the typed text wherever it needs to go.

I can only think of a couple limitations to using maptext. You wouldn't be able to move the "cursor" around for editing with either arrow keys or mouse, unless you simulated that with an object and some advanced string/list operations. You also wouldn't be able to paste something into the box, since to my knowledge, DM doesn't have a way to access the contents of the clipboard, unless it's hiding in the interface somewhere.

I don't even think it would lag too much. If done right, typing with it would probably be more responsive than a lot of MMOs out there that use on-screen chat boxes.

Using the interface for input is the way to go. Using any combination of HUD or MAPTEXT isn't really ideal. But if you're looking for something already completed, forum_account's (HUD Groups) already does everything THIS library does as well as all types of windows input controls (text boxes, combo boxes) all on the HUD.

The best way to go about it though, is to just switch focus to an interface control that pops up at the bottom or somewhere clever in your game window layout (it can even show up over top of the map control in the same spot that would line up with the bottom of the map below the chat box, for example), and then allow typing. When they hit enter, you would switch focus back to the map, clear the input, and then hide the interface control again.

Using HUD or any combination of huds and maptext for text input will just waste bandwidth.
In response to Multiverse7
Using maptext for input will require server-side processing for every key you press which is not good for your game. I recommend using input controls that are placed over the map instead.
Jemai1 wrote:
Using maptext for input will require server-side processing for every key you press which is not good for your game.

That's an excellent point. I wasn't really thinking about it that much, but we should probably make use of whatever client-side interfaces we possibly can. Until DM gets client-side capabilities, maptext input would only lower the performance of a server.

That said, I do think it would still be pretty awesome to see a maptext input in action.
Nice Work, sir! I'll add it into my game! It looks like Minecraft Bukkit with Essentials. I like that!
Page: 1 2