ID:815103
 
(See the best response by Forum_account.)
Problem description:
How would I go about creating a dialogue with the new maptext? I would like to go to the next sentence with any key of your choice getting pressed. Does somebody have an idea?

PS. : If there are any other ways to easily create on-screen dialogues with the option of pressing a key to go to the next piece of text available, you can also recommend me it here.
I would suggest you take a look at a resource Albro1 Created, http://www.byond.com/developer/Albro1/MaptextLibrary
In response to The Motto
The Motto wrote:
I would suggest you take a look at a resource Albro1 Created, http://www.byond.com/developer/Albro1/MaptextLibrary

I stumbled upon that library/demo earlier this day. I'm still confused on how I would use maptext on creating an on-screen dialogue.
ahh i see, take a look at this 1 http://www.byond.com/developer/Shadowdarke/MapText you should be able to implement this into what ur trying to do
In response to The Motto
The Motto wrote:
ahh i see, take a look at this 1 http://www.byond.com/developer/Shadowdarke/MapText you should be able to implement this into what ur trying to do

That's an older library that manually implements a "maptext" system with screen objects. It won't have the same performance or features of a system using the new, built-in maptext variable.
In response to DarkCampainger
DarkCampainger wrote:
The Motto wrote:
ahh i see, take a look at this 1 http://www.byond.com/developer/Shadowdarke/MapText you should be able to implement this into what ur trying to do

That's an older library that manually implements a "maptext" system with screen objects. It won't have the same performance or features of a system using the new, built-in maptext variable.

I figured that out. Do you have any way how to go about this?
Well, assuming you're already familiar with how to position, size, and format maptext; this question is really more about detecting input and managing a list of dialogue text strings.

One way to do it would be to use a system similar to Garthor's GetClick, but instead of waiting for a mouse click, wait for keyboard input. You'll probably want to drop the "any key" option, and just choose a key for simplicity (otherwise you'll have to macro every key on the keyboard. But, if you really want it, I'm sure F_A has a library that can detect "any key"). Basically, you lay out your conversation in one long process, and create a "GetAnyKey" object between each line that blocks the process from continuing (such as with an infinite loop in New()) until the user presses the key. You'll need to have each player track all of their "GetAnyKey" objects so they can be cleared when a key is pressed.

You can also create a utility process that both updates the maptext and automatically creates the "GetAnyKey" object for each line of text, so you can just do:
mob/NPC/Banker
proc/converse(mob/M)
DisplayAndWait(M, "Why hello there, friend. Come in, come in!")
DisplayAndWait(M, "What brings you to my fine establishment this day? Perhaps a deposit?")
DisplayAndWait(M, "Oh? A withdrawal in fact? Of.. all the money in the vault?")
DisplayAndWait(M, "Do you mean to rob me, sir?!?")
DisplayAndWait(M, "GUARDS! GUARDS!")


This also makes it easier to insert input options between certain dialogue outputs.

Another option would be to store the dialogue elements in a list, but I find that less flexible unless you wrap everything in some sort of a "dialogue" datum so you can insert inputs, delays, branches, and other special effects (a timed explosion, maybe?).
I have found some issues with trying to create dialog with maptext in that the maptext goes higher instead of lower. For example:
I have a dialog box, and want to fill it with text.
|---------------------------|
| Text Here
|
|
|---------------------------|

However, when I set the maptext_height to the proper height, the text scrolls up. So instead of this:
|---------------------------|
| Text Here. Text here.
| Text Here. Text here.
| Text Here. Text here.
|---------------------------|

I get this:
Text Here. Text here.
Text Here. Text here.
|---------------------------|
| Text Here. Text here.
|
|
|---------------------------|

In other words, the text wont go below the atom it is attached to. Which means even if I move the atom to the bottom left of the box to fix this, a short amount of text is going to start at the bottom left instead of the top left.
In BYOND, the origin is in the bottom-left corner and the "positive" y-axis goes up, so that makes sense.

There may be some vertical-align option you can use to make it easier to work with, or maybe you should request one. I can't find any documentation for maptext or what attributes it supports, so I don't really know.
I know that it is proper that it works that way, it just doesn't make things easier for me. I'd like the text to extend down, which in many cases would be the logical way of doing things. I'll request it.
Best response
You can set object.maptext = "<text align=top>text here.</text>" to make text properly aligned (you can also use "middle" to center text vertically). The default alignment makes no sense at all but what do you expect? =)
In response to Forum_account
Forum_account wrote:
You can set object.maptext = "<text align=top>text here.</text>" to make text properly aligned (you can also use "middle" to center text vertically). The default alignment makes no sense at all but what do you expect? =)

Perfect. Thanks!
sooo... could you perhaps give an example of having dialogue done via maptext? Or (for a more accurate request) would you be fine with providing some code that shows how you've implemented the system (like a demo/library type thing?) to give others some code as a reference/guide on how to go about creating such?

...DC's post attempting to give a general/appropriate approach to take for creating maptext dialogue, is fairly helpful in itself though, so if it's a negative, then i guess this'll have to do.
In response to Turboskill
Forum_account's HUD Groups library has HUD-based dialogue boxes using maptext.
Oh yeah. I didn't know that it did, but thanks for mentioning the library in general: i'd intended to find and download it, and see what it provided since i'd been seeing it mentioned one or twice (either here or elsewhere), but then it seems that i just forgot amidst the other stuff i was doing.