SOLVED: DisplayAt breaking lines of text too early

Started by xev, Thu 01/11/2018 00:59:07

Previous topic - Next topic

xev

My game is in pre-development while I work on the custom GUIs.
Here, text is displayed when using "look" on an inventory item. 
Code: ags

function iScalpel_Look()
{
DisplayAt (172,555,525, "The scalpel's tempered steel is cold, the blood is still wet. You never did like sharp things.");
}

It displays in this black box...

The xy coordinates are perfect but the text is breaking to a new line too early.  In the above example, it could still fit "blood is" before breaking a line. I need some help to tell the engine when to break a line; not too early, not too late.  I should note that the gTextBorder GUI is using a blank 10x10 png for its border, with no background image.  The black box is part of the room's background. Any help would be greatly appreciated. Thanks! :)

Arcangel

Try change DisplayAt (172,555,635 .....
DisplayAt(int x, int y, int width, string message, ...)

Crimson Wizard

#2
There is a way to manually split the text in lines using "[" character, but that might be very inconvenient to use in a large scale instead of automatic wrap.

Quote from: xev on Thu 01/11/2018 00:59:07I should note that the gTextBorder GUI is using a blank 10x10 png for its border, with no background image.  The black box is part of the room's background.

Could you explain in more detail, how do you make this background box, or rather how do you connect it with the text display? Is it a TextWindow kind of GUI or normal GUI, do you show it up yourself, or set up as a custom text-window in the General Settings?

Also, as Arcangel refered to, maybe you are not setting big enough width value in DisplayAt?

xev

Quote from: Arcangel on Thu 01/11/2018 15:30:36
Try change DisplayAt (172,555,635 .....
DisplayAt(int x, int y, int width, string message, ...)

Thank you! Silly me, I thought the third parameter was for z, not width and I had trouble finding the documentation for DisplayAt. Problem solved, thank you so much.

Khris

Just move the cursor over a command and press F1, and the manual will open the documentation to the command's page.
Also, the names of the parameters are displayed as soon as you type the opening parens, with the current parameter highlighted in red on top.

xev

Quote from: Khris on Fri 02/11/2018 10:14:20
Just move the cursor over a command and press F1, and the manual will open the documentation to the command's page.
Also, the names of the parameters are displayed as soon as you type the opening parens, with the current parameter highlighted in red on top.
I've always been terribly unobservant. All of this is so helpful, thank you so much.

SMF spam blocked by CleanTalk