Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: xev on Thu 01/11/2018 00:59:07

Title: SOLVED: DisplayAt breaking lines of text too early
Post by: xev on Thu 01/11/2018 00:59:07
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) Select

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...
(https://image.ibb.co/fAVY00/text-auto-line.png)
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! :)
Title: Re: DisplayAt breaking lines of text too early
Post by: Arcangel on Thu 01/11/2018 15:30:36
Try change DisplayAt (172,555,635 .....
DisplayAt(int x, int y, int width, string message, ...)
Title: Re: DisplayAt breaking lines of text too early
Post by: Crimson Wizard on Thu 01/11/2018 15:48:24
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?
Title: Re: DisplayAt breaking lines of text too early
Post by: xev on Fri 02/11/2018 02:19:12
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.
Title: Re: SOLVED: DisplayAt breaking lines of text too early
Post by: 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.
Title: Re: SOLVED: DisplayAt breaking lines of text too early
Post by: xev on Mon 05/11/2018 08:51:12
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.