• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our next favorite protagonist poll is now up, this time for the Almia region from Pokémon Ranger 2! This poll is only lasting 2 days, so don't forget to cast your vote for your favorite protagonist!
  • 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

  • 153
    Posts
    5
    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