Author Topic: Weird color issue with SetDescription and StringToRBG  (Read 724 times)

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Weird color issue with SetDescription and StringToRBG
« on: July 29, 2010, 11:34:38 am »


               Sooo. I don't know if this is just me or what. I made a script that creates an item and sets its description and changes the color of the letters where i need them changed. All that is working fine. However when I then scroll down at all, a bunch of letters change colors. Mainly the white all the sudden changes to a purplish color. And then some of the colors that were changed, change to some other color. When i scroll back up to the top all the colors return to what they are supposed to be. I can post the script if need be. I was mainly just curious as to whether or not anyone else has experienced this and if there is anything that can be done to fix it. Is it a known bug of some kind?

Thanks in advance.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Weird color issue with SetDescription and StringToRBG
« Reply #1 on: July 29, 2010, 12:09:02 pm »


               I know this bug, once you scroll out of color tag color then screw out. The best solution for this is to color every line of text, I don't know how many characters get into line, maybe its quite dependant on used characters. Or you can color word, that would be doable within nwscript if you don't know exactly what the text is...
               
               

               
            

Legacy_TheSpiritedLass

  • Hero Member
  • *****
  • Posts: 1118
  • Karma: +0/-0
Weird color issue with SetDescription and StringToRBG
« Reply #2 on: July 29, 2010, 02:08:36 pm »


               Heya Ghost and ShaDoOow =)



It may not be the same issue, but I've seen this on Mythos before with color text in the combat window.  When my DM tool spits out a ton of information and I have to scroll to see it.  The text changes colors.  One of the players actually isolated what the problem was in the code.  I was not closing the color tag at the end of the string.   The following sample code uses a library based color function, but I think it is enough that you will get the idea.



Naughty code:



SendMessageToPC(oTarget, GetRGB(1,15,15) + GetName(oPlayer) + " really needs some chocolate, BAD!");



Corrected code with the closing tag </c> at the end of the string:



SendMessageToPC(oTarget, GetRGB(1,15,15) + GetName(oPlayer) + " really needs some chocolate, BAD!" + "</c>");



I wish this had busted before we published the final Lexicon version, I would have updated the page to include the </c> info.  DOH! '<img'>



Hope that helps,

-- Mistress
               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Weird color issue with SetDescription and StringToRBG
« Reply #3 on: July 29, 2010, 02:26:23 pm »


               It would be best to do a function to loop through the description and every 10 letters or so, add the tag & the closing tag for color, and yes I've seen this bug as well, however using the closing tag may not stop it, as I always use the closing tag and I was unable to stop it in long descriptions..



Bioware warned against using color in modules, I for one have always hated following rules.. '<img'>
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Weird color issue with SetDescription and StringToRBG
« Reply #4 on: July 29, 2010, 09:16:31 pm »


               Thank you all for the replies. Sadly closing "<c>" didn't seem to make any difference for me. Oh well. I just opted to shorten the description so that you don't need to scroll. Thanks again though.
               
               

               
            

Legacy_TheSpiritedLass

  • Hero Member
  • *****
  • Posts: 1118
  • Karma: +0/-0
Weird color issue with SetDescription and StringToRBG
« Reply #5 on: July 30, 2010, 02:44:53 pm »


               Heya Ghost,



Just checking for a possible typo... you did include a / in the closing color tag, right?  So </c> not just <c>.



-- Mistress, 4 hours to Alps and counting.  *blissful smile*



               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Weird color issue with SetDescription and StringToRBG
« Reply #6 on: July 30, 2010, 03:08:11 pm »


               He is correct a closing tag does NOT stop the bug, the only true solution is to reapply the color tag (with the closer) every line, unfortunately.
               
               

               


                     Modifié par Genisys, 30 juillet 2010 - 02:08 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Weird color issue with SetDescription and StringToRBG
« Reply #7 on: July 30, 2010, 07:41:52 pm »


               

TheSpiritedLass wrote...

Heya Ghost,

Just checking for a possible typo... you did include a / in the closing color tag, right?  So  not just .

-- Mistress, 4 hours to Alps and counting.  *blissful smile*


I double checked just to make sure. I just typoed it here.