• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] how to change text color with variable

  • 151
    Posts
    6
    Years
    • Seen Feb 4, 2020
    So I asked for it before somewhere else but I'll make my own thread because I can't solve this.

    I want the player to chose the text color when his/her character speaks. So I made an event which is asking this to the player then stores the answer in a variable (assigning the numbers corresponding to colors in text \C[X])

    However calling
    Code:
    \C[pbGet(X)]
    doesn't work and
    Code:
    \C[\v[X]]Blablabla
    is giving \C[1]Blablabla instead of Blablabla in blue.

    I thought I might look how \pg and \pog was defined to create my own function but I can't find them in the script.

    Plz do you have a clue?
     
    Solved

    by adding these lines in the Message script section

    Code:
      text.gsub!(/\\[Hh]/,"\\C[1]") if pbGet(60)==1
      text.gsub!(/\\[Hh]/,"\\C[3]") if pbGet(60)==3
      text.gsub!(/\\[Hh]/,"\\C[5]") if pbGet(60)==5
      text.gsub!(/\\[Hh]/,"\\C[6]") if pbGet(60)==6

    now when i start the text with \h or \H or /h or /H the text is in the color defined here above depending on variable 60
     
    Last edited:
    Back
    Top