centered messages

m4u
10 Sept 2013, 16:09
Hi guys,

How can i center messages from scripts like Show menu with caption and the "continue" from Wait for key press?

Thank you,

jaynabonne
10 Sept 2013, 17:33
For the continue message, you can do this:

request (SetInterfaceString, "ContinueLabel=<center>[ContinueLabel]</center>")


Since it contains < > characters, it needs to be within a CDATA block.

I'm still looking at the menu. That one might not be as easy.

jaynabonne
10 Sept 2013, 17:49
You can center the menu caption by including the <center>... </center> tags in your caption string. But I don't see a way to center the menu without importing ShowMenu into your game and modifying it to center the text.

It would be handy if Quest assigned CSS classes to these UI elements. Then you could just muck with CSS to reformat them. Alas... :)

m4u
11 Sept 2013, 20:17
It works with the menu, but I couldn't make it work with the continue:

<template name="ContinueLabel"><![CDATA[request (SetInterfaceString, "ContinueLabel=<center>[ContinueLabel]</center>")]]></template>

jaynabonne
11 Sept 2013, 20:23
The line I gave you was a script line. It didn't modify the template. If you want to modify the template, then just do:

<template name="ContinueLabel"><![CDATA[<center>Continue...</center>]]></template>

That's just putting the center tags around the string.

m4u
11 Sept 2013, 21:49
I did but the message doesn't dissappeared after clicking....

m4u
16 Sept 2013, 19:41
Sooo... do you know how to center the continue label without getting the message stuck on screen?

jaynabonne
17 Sept 2013, 10:03
You can add this line to your start script (instead of the previous non-solution):

 JS.eval("$('#txtCommandDiv').css('text-align', 'center')")


That will center the command/input div, which will center the "Continue" message. It will also have the effect of centering the type-in area, which you may or may not want. :) If you don't want that, you can always have a function to wrap "wait" where you first set the align to "center" before the wait, and then set it back to "left" after.

m4u
17 Sept 2013, 17:48
Cool! I like that way, thanks a lot!