ID:2376313
 
I'm having some severe issues trying to grasp the concept of the integrated map text functions. I've gone through every library I can find, and I can't even implement those into my own Demo let alone draft up my own system for it.
My favorite so far is Woo's HUD Windows library, but I cannot seem to get very far with that either. I've tried to reverse engineer with control F on the variables within the events to see where the event text is even designated, but I don't even see where the demo's NPC's speech text is assigned.

Are there any super basic demo's so I can begin to develop even the most basic of understandings for this? Any help is appreciated.

Have you read the DM reference for all the maptext variables? All you have to do to see an example is set the width and height (so the text fits), and the text itself, for any atom. The text is basically an overlay.
In response to Kaiochao
Kaiochao wrote:
Have you read the DM reference for all the maptext variables? All you have to do to see an example is set the width and height (so the text fits), and the text itself, for any atom. The text is basically an overlay.

I haven't yet. But I'll take a look into that. Maybe that'll help some of this make sense.
In response to Ko Senpai
The DM reference (hit F1 in the code editor) contains the full documentation on every built-in feature (whereas the Guide is just an introduction to everything that existed in BYOND 2.0, which was like ~15 years ago). It should be the first place you check for everything.
In response to Kaiochao
Kaiochao wrote:
The DM reference (hit F1 in the code editor) contains the full documentation on every built-in feature (whereas the Guide is just an introduction to everything that existed in BYOND 2.0, which was like ~15 years ago). It should be the first place you check for everything.

So I've been toying with it, and I'm understanding the variables a bit better, but I'm not understanding how I can apply this to a HUD.
In response to Ko Senpai
It's no different from objects in the world that aren't in the HUD.

HUDs are built by adding movable atoms (primarily objs) to a client's screen variable and setting their screen_loc var to position them visibly within the map display.

With an object in the HUD, you can set its maptext variables the same as you would any other atom, and the text will appear as an overlay of the object.
In response to Kaiochao
Kaiochao wrote:
It's no different from objects in the world that aren't in the HUD.

HUDs are built by adding movable atoms (primarily objs) to a client's screen variable and setting their screen_loc var to position them visibly within the map display.

With an object in the HUD, you can set its maptext variables the same as you would any other atom, and the text will appear as an overlay of the object.

So is it essenially a matter of getting a character count for the message to figure out the size of the window, then using the x, y offsets to position the map text correctly within the screen object?
In response to Ko Senpai
Ko Senpai wrote:
Kaiochao wrote:
It's no different from objects in the world that aren't in the HUD.

HUDs are built by adding movable atoms (primarily objs) to a client's screen variable and setting their screen_loc var to position them visibly within the map display.

With an object in the HUD, you can set its maptext variables the same as you would any other atom, and the text will appear as an overlay of the object.

So is it essenially a matter of getting a character count for the message to figure out the size of the window, then using the x, y offsets to position the map text correctly within the screen object?


You shouldn't need to get the character count. You should be able to align maptext with the top of the text area using the vertical-align CSS property, and the horizontal alignment via text-align CSS property.

You can embed this in a span:

String example:
"<span style='vertical-align:top;text-align:left'>SOME TEXT</span>"


Or you can use the map's stylesheet in the interface editor:

Stylesheet:
.someclass {
text-align: left;
vertical-align: top;
}


String examples:
"<span class='someclass'>SOME TEXT</span>"


If you want to get real fancy, you can actually do multiple CSS class inheritance to make your text more flexible on the fly:

stylesheet:
.red {
color: rgb(255,0,0);
}

.center {
text-align: center;
}

.right {
text-align: right;
}

.top {
vertical-align: top;
}

.middle {
vertical-align: middle;
}


String examples:
"<span class='top right red'>SOME TEXT</span>"
"<span class='center middle'> SOME TEXT</span>"


From there, you just need to set maptext_width and maptext_height accordingly.

Like I said, you shouldn't need to count characters for most anything you are doing. Writing code that will count the width/height of maptext contents is a one-way ticket to insanity, because of all the variables in play.
In response to Ko Senpai
The maptext_width and maptext_height vars define a bounding box for where the text automatically wraps to the next line or cuts off. They're the limits for where the text can be.

For example, if you have a HUD text box, you'd set the maptext width and height to the size of the text box. You might want a bit of empty space (padding) on the inside, which you can get by shrinking the size by some amount and increasing the maptext_x/y offsets by half that amount.