Conditional statements on text entries for TextBox

0 favourites
  • 5 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • Hi all,

    When i'm pushing text to the textbox, it only seems to be in the one colour as defined within the CSS. If you don't define it, it's just black I think.

    To my knowledge there doesn't appear to be any conditional statement on CSS that I can use to make different entries in to the textbox different colours.

    As an example to what i'm looking for when the player is looking at the textbox:

    You are hit for x damage.

    You hit for x damage.

    x mob dies

    x mob drops x loot

    Is it not possible, or am I missing something very simple? I'm not an expert in CSS so i'm hoping it's something I just don't know yet!

    Thanks for your time.

  • I don't think this is possible in C2. This plugin ( ) might do it in the same textbox, I don't know for sure.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If that plugin doesn't work... the only way to do it is to make a custom text feed using a bunch of boxes stacked on top of each other (one for each line)... then push the text and css styling to each box going up/down each "row".

    It can definitely be done, but it will be a fun job to make it happen. Probably a simple state machine to store each text value and style, then bump it up to the box above or whatever - until all boxes for your chosen number of lines is completed.

    ~Sol

  • Thanks both. I will give this is a try when I get home. The plug in, looks like it might work for me.

    The text boxes could also work but shit that don't half look like an unfun job! Also I want the user to be able to scroll through the past text which is easier in the textbox (that I can see).

  • Conditionals:

    hp<10 ?rgb(255,0,0) :rgb(0,0,0)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)