Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: arj0n on Sun 04/12/2016 23:29:44

Title: set TextColor for Text Window GUI from within a script?
Post by: arj0n on Sun 04/12/2016 23:29:44
Is it possible to change the Text Color attribute of a Text Window GUI from within a script?
(Found this post (http://www.adventuregamestudio.co.uk/forums/index.php?topic=33569.msg435715) from 2008, but no definitive answer was provided.)

Thanx,
-arj0n
Title: Re: set TextColor for Text Window GUI from within a script?
Post by: tor.brandt on Mon 05/12/2016 00:48:15
Can't you just use
Code (ags) Select
textBoxName.TextColor = int color
where you switch "textBoxName" with the name of the text window, and "int color" with the number of the color you want to change to?
Title: Re: set TextColor for Text Window GUI from within a script?
Post by: arj0n on Mon 05/12/2016 01:02:06
Nope, that would only work for a regular GUI that does contain a text box.
In my case it's about a Text Window GUI, which does has a text property which apparently cannot be set/changed via scripting (?)
Title: Re: set TextColor for Text Window GUI from within a script?
Post by: tor.brandt on Mon 05/12/2016 01:18:50
I see ???
Title: Re: set TextColor for Text Window GUI from within a script?
Post by: Cassiebsg on Mon 05/12/2016 14:59:42
I'm using these for my dialog text GUI (that what you are after? if not ignore me (laugh)).

game.read_dialog_option_color
game.dialog_options_highlight_color

Title: Re: set TextColor for Text Window GUI from within a script?
Post by: arj0n on Mon 05/12/2016 17:42:23
Sorry, Cassiebsg, that's not what I am after.

In the editor, go to the 'explore project' panel.
In the GUIs section, rightmouse click on GUIs and add New Text Window GUI.
When you open this new gui, you will see the following attributes in the Appearance section:
* BackgroundColour
* BackgroundColourNumber
* BackgroundImage
* Padding
* TextColor

Now when you are in a script, either global or local, you can't set these Appearance attributes for this (type of) GUI.
(You can set the BackgroundGraphic though.)
Title: Re: set TextColor for Text Window GUI from within a script?
Post by: Slasher on Mon 05/12/2016 19:43:46
You can of course change in-game the text window to use as the Display which has the color you want.

Something like:
Code (ags) Select

SetTextWindowGUI(14); // change 14 to the text window gui number you want to use.
Title: Re: set TextColor for Text Window GUI from within a script?
Post by: arj0n on Mon 05/12/2016 20:09:11
Yeh, that's what I've done, but I was still wondering if it's possible to change the textcolor attribute from within a script...
I guess it cannot be done that way...
Title: Re: set TextColor for Text Window GUI from within a script?
Post by: dayowlron on Tue 06/12/2016 02:49:32
Only way I can see to do that is create a different text window gui with each of the different colors you will use then switch between them.
Title: Re: set TextColor for Text Window GUI from within a script?
Post by: arj0n on Tue 06/12/2016 10:51:08
That's what I did. But that way I had to create 10 variants for each only because of a different text color... :(