ID:122482
 


A great thanks to Forum_Account's Keyboard library, which makes stuff like this really easy to do.

You can now press Enter to open the chat-line and press Enter again to send your message. Enter also closes the chat-line if the line is left empty. Please excuse the output, that was just to test it out.

The big advantage to this system is that you don't have to click on a different window element to make it the active element, you only need a map element! (:

-Oasiscircle
Very nicely put onscreen input. I can understand about the output for testing as that usually requires special work (such as word wrapping).

This should definitely encourage others to utilize onscreen input. :D
Yeah, I'll probably have to spend the rest of tonight working on getting the messages to appear correctly on the screen.
I might also move the input/output to the center of the screen and allow it to go to the height of the dogtag.
What shape am I?
@Kaigne: Oh, at first I was like, "What is he asking.." but then I remembered that was the name of the default rank.
I don't know what shape you are, you can be any shape you want.
tbh I am waiting for atom.map_text to be officially released before I attempt any sort of chat. You can potentially make some of the fastest and sexiest on screen chat with atom.map_text.

It's supposed to be nearly as fast as sending stuff to output elements; map_text is rendered by the client so only strings need to be sent. No more bandwidth bottlenecks because of client.screen.
@D4RK3 54B3R: Well, isn't client.screen also getting a speed-boost as well?
Not in this upcoming update, but sometime?
Not that I know of, anyhow. I'm not as well informed on the development of BYOND as I used to be.

[EDIT]: It should still be better, regardless. You need to instantiate a fuckton of text objects if you were going to do this through client.screen the traditional way.

With atom.map_text, you can just instantiate one set of chat text atoms with each representing a single line of text, share them with all of the clients in the game, and then just update the map_text of the atoms as people chat.
D4RK3 54B3R wrote:
With atom.map_text, you can just instantiate one set of chat text atoms with each representing a single line of text, share them with all of the clients in the game, and then just update the map_text of the atoms as people chat.

Not even that, you can use just one shared screen object while updating the maptext accordingly. Rather than tracking each individual line you can simply keep a numbered variable and truncate the maptext whenever it has too many lines.

Oasiscircle wrote:
Well, isn't client.screen also getting a speed-boost as well?

No, the maptext doesn't have anything to do with a performance tweak relating to screen objects. What makes maptext so fast is BYOND need only send the actual output text rather than a string of screen objects.
The real question is, can maptext only be used with fonts that already exist in .tff files? Because the font there is custom and is only in a .dmi file.
Native map text would help you make a map-based output control, but would be less useful for making a map-based input control.

Not only does the keyboard library make it easy, the his groups library has a demo of on-screen input like this :-)
@Forum_Account: I'll definitely take a look at it, thanks. (:
It's in the library's "interface-demo" demo. It contains objects for creating on-screen labels, buttons, text boxes, check boxes, and radio buttons.