Snippet String2PlayerColoredString

He means;

JASS:
globals
    private string array PlayerColor
    private player array PLAYER
    private constant string EndColor = "|r"
endglobals

function S2PCS takes string s, integer playerId returns string    
    return PlayerColor[GetHandleId( GetPlayerColor(PLAYER[playerId]))] + s + EndColor
endfunction

function GetPlayerColorString takes player p returns string   
    return PlayerColor[GetHandleId( GetPlayerColor(p))]
endfunction

function GetPlayerColorStringById takes integer playerId returns string    
    return PlayerColor[GetHandleId( GetPlayerColor(PLAYER[playerId]))]
endfunction

private function Init takes nothing returns nothing
    local integer i = 0
    loop
        exitwhen i > 10
        set PLAYER<i> = Player(i)
        set i = i + 1
    endloop
    set PlayerColor[0] = &quot;|c00ff0202&quot;
    set PlayerColor[1] = &quot;|c000041ff&quot;
    set PlayerColor[2] = &quot;|c001be5b8&quot;
    set PlayerColor[3] = &quot;|c00530080&quot;
    set PlayerColor[4] = &quot;|c00fffc00&quot;
    set PlayerColor[5] = &quot;|c00fe890d&quot;
    set PlayerColor[6] = &quot;|c001fbf00&quot;
    set PlayerColor[7] = &quot;|c00e45aaf&quot;
    set PlayerColor[8] = &quot;|c00949596&quot;
    set PlayerColor[9] = &quot;|c007dbef1&quot;
    set PlayerColor[10] = &quot;|c000f6145&quot;
    set PlayerColor[11] = &quot;|c004d2903&quot;
    
endfunction

endlibrary</i>
 
Ok, changed that now :D Thanks !

Though, I've now discovered that the GetPlayerColorString doesn't really work :S

Here's how I test it, and nothing shows...
Trigger:
  • For each (Integer A) from 0 to 11, do (Actions)
    • Loop - Actions
      • Custom script: call BJDebugMsg(GetPlayerColorString(Player(bj_forLoopAIndex)))
      • Wait 0.10 seconds


Oh, btw... Here's how the code looks like now:
JASS:
library PlayerColors initializer Init


///////////////////////////////////////////////////////////////////////////////////////////////////
//                               //String2PlayerColoredString\\                                  //
//                                  //Made by, Komaqtion\\                                       //
//                                                                                               //
//                                                                                               //
//                                        Purpose:                                               //
//                                                                                               //
//             ¤ This snippet is supposed to help people to, with ease, convert                  //
//               a string to use a desired player&#039;s own color!                                   //
//                                                                                               //
//                                         Usage:                                                //
//                                                                                               //
//             ¤ To use this snipper, simply type &quot;call S2PCS(string, playerid)&quot;                 //
//               where &quot;string&quot; is the string you want to colorize, and &quot;playerid&quot;               //
//               is the player number of the player, whose color you wan to use.                 //
//               Note: This uses JASS&#039; player number range, meaning that                         //
//               Player 1(Red)&#039;s number is 0, and Player 2(Blue)&#039;s number is 1,                  //
//               and so on...                                                                    //
//               You can also get only the players color-string for own usage...                 //
//               This is accomplished by using the function &quot;GetPlayerColorString&quot;               //
//               which takes the player to get the string, or you can also use                   //
//               the GetPlayerColorStringById function, which takes the player&#039;s                 //
//               Id, or number instead <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />                                                        //
//                                                                                               //                                                                                //
//                                    Requirements:                                              //
//                                                                                               //
//             ¤ This snippet&#039;s only requirement is vJASS compilement, which is                  //
//               easiest achieved by downloading JASS Newgen Pack, at                            //
//               <a href="http://www.thehelper.net/forums/showthread.php?t=73936" class="link link--internal">http://www.thehelper.net/forums/showthread.php?t=73936</a>                          //
//                                                                                               //
//                                        Credits:                                               //
//                                                                                               //
//             ¤ Well, at the moment, not that many has helped me really, so no                  //
//               credits has been given yet                                                      //
//                                                                                               //
//               And credits, if you use this that is, is not needed to give me                  //
//               though it&#039;s always welcome <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink    ;)" loading="lazy" data-shortname=";)" />                                                   //
//                                                                                               //
///////////////////////////////////////////////////////////////////////////////////////////////////


globals
    private player array Players
    private string array PlayerColor
    private constant string EndString = &quot;|r&quot;
    private constant string StartString = &quot;|c&quot;
endglobals

function S2PCS takes string s, integer playerId returns string    
    return StartString + PlayerColor[GetHandleId( GetPlayerColor(Players[playerId]))] + s + EndString
endfunction

function GetPlayerColorString takes player p returns string   
    return StartString + PlayerColor[GetHandleId( GetPlayerColor(p))]
endfunction

function GetPlayerColorStringById takes integer playerId returns string    
    return StartString + PlayerColor[GetHandleId( GetPlayerColor(Players[playerId]))]
endfunction

private function Init takes nothing returns nothing
    local integer i = 0
    loop
        set Players<i> = Player(i)
        set i = i + 1
        exitwhen i == 12
    endloop
    
    set PlayerColor[0] = &quot;00ff0202&quot;
    set PlayerColor[1] = &quot;000041ff&quot;
    set PlayerColor[2] = &quot;001be5b8&quot;
    set PlayerColor[3] = &quot;00530080&quot;
    set PlayerColor[4] = &quot;00fffc00&quot;
    set PlayerColor[5] = &quot;00fe890d&quot;
    set PlayerColor[6] = &quot;001fbf00&quot;
    set PlayerColor[7] = &quot;00e45aaf&quot;
    set PlayerColor[8] = &quot;00949596&quot;
    set PlayerColor[9] = &quot;007dbef1&quot;
    set PlayerColor[10] = &quot;000f6145&quot;
    set PlayerColor[11] = &quot;004d2903&quot;
    
endfunction

endlibrary</i>



EDIT: Nvw... Artificial "helped" me XD


EDIT2: Btw, what takes for this to get approved (If it's even approvable XD :S) ? :eek:
 
Yeah, sure :D Will use then ;)

Is it ok if I use "PlayerColoredString" ? :eek:
 
Adding an Endstring there would just negate the color code, making the call pointless.
 
:confused:

This
Trigger:
  • For each (Integer A) from 0 to 11, do (Actions)
    • Loop - Actions
      • Custom script: call BJDebugMsg(GetPlayerColorString(Player(bj_forLoopAIndex)))
      • Wait 0.10 seconds

does not work because of missing Endstring?
 
Read what I posted, lol. The entire point of that call is to cause text following it to be colored in the color of the entered player.
GetPlayerColorString(Player(bj_forLoopAIndex)) just causes any text following it in that string to be colored in whatever color the current player is.

Try GetPlayerColorString(Player(bj_forLoopAIndex)) + "HELLO WORLD".

:)

Should display a bunch of coloured 'HELLO WORLD's.
 
Ok... But any thoughts about the actuall code ? :eek:
Any chance of approving it ? :eek:
 
Instead of calling GetHandleId(GetPlayerColor()), you could hook SetPlayerColor() (or whatever the native is) and save the proper things in an array. You get a nice efficiency gain there.
 
Actuallt, I've never used the "Hook" functionality :S

But I'll try :D Thanks :thup:
 
Ok, got the "Hook" stuff working now, I believe :S

Please take a look ;)

JASS:
library PlayerColors initializer Init


///////////////////////////////////////////////////////////////////////////////////////////////////
//                                  //PlayerColoredString\\                                      //
//                                  //Made by, Komaqtion\\                                       //
//                                                                                               //
//                                                                                               //
//                                        Purpose:                                               //
//                                                                                               //
//             ¤ This snippet is supposed to help people to, with ease, convert                  //
//               a string to use a desired player&#039;s own color!                                   //
//                                                                                               //
//                                         Usage:                                                //
//                                                                                               //
//             ¤ To use this snippet, simply type &quot;call PlayerColoredString(string, playerid)&quot;   //
//               where &quot;string&quot; is the string you want to colorize, and &quot;playerid&quot;               //
//               is the player number of the player, whose color you wan to use.                 //
//               Note: This uses JASS&#039; player number range, meaning that                         //
//               Player 1(Red)&#039;s number is 0, and Player 2(Blue)&#039;s number is 1,                  //
//               and so on...                                                                    //
//               You can also get only the players color-string for own usage...                 //
//               This is accomplished by using the function &quot;GetPlayerColorString&quot;               //
//               which takes the player to get the string, or you can also use                   //
//               the GetPlayerColorStringById function, which takes the player&#039;s                 //
//               Id, or number instead <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />                                                        //
//                                                                                               //                                                                                //
//                                    Requirements:                                              //
//                                                                                               //
//             ¤ This snippet&#039;s only requirement is vJASS compilement, which is                  //
//               easiest achieved by downloading JASS Newgen Pack, at                            //
//               <a href="http://www.thehelper.net/forums/showthread.php?t=73936" class="link link--internal">http://www.thehelper.net/forums/showthread.php?t=73936</a>                          //
//                                                                                               //
//                                        Credits:                                               //
//                                                                                               //
//             ¤ Well, at the moment, not that many has helped me really, so no                  //
//               credits has been given yet                                                      //
//                                                                                               //
//               And credits, if you use this that is, is not needed to give me                  //
//               though it&#039;s always welcome <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink    ;)" loading="lazy" data-shortname=";)" />                                                   //
//                                                                                               //
///////////////////////////////////////////////////////////////////////////////////////////////////


globals
    private player array Players
    private string array PlayerColor
    private string array PlayerColorString
    private constant string EndString = &quot;|r&quot;
    private constant string StartString = &quot;|c&quot;
endglobals

function PlayerColoredString takes string s, integer playerId returns string    
    return StartString + PlayerColor[GetPlayerId(Players[playerId])] + s + EndString
endfunction

function GetPlayerColorString takes player p returns string   
    return StartString + PlayerColor[GetPlayerId(p)]
endfunction

function GetPlayerColorStringById takes integer playerId returns string    
    return StartString + PlayerColor[GetPlayerId(Players[playerId])]
endfunction

private function OnColorChange takes player whichplayer, playercolor color returns nothing
    set PlayerColor[GetPlayerId(whichplayer)] = PlayerColorString[GetHandleId(color)]
endfunction

hook SetPlayerColor OnColorChange

private function Init takes nothing returns nothing
    local integer i = 0
    loop
        set Players<i> = Player(i)
        set i = i + 1
        exitwhen i == 12
    endloop
    
    set PlayerColorString[0] = &quot;00ff0202&quot;
    set PlayerColorString[1] = &quot;000041ff&quot;
    set PlayerColorString[2] = &quot;001be5b8&quot;
    set PlayerColorString[3] = &quot;00530080&quot;
    set PlayerColorString[4] = &quot;00fffc00&quot;
    set PlayerColorString[5] = &quot;00fe890d&quot;
    set PlayerColorString[6] = &quot;001fbf00&quot;
    set PlayerColorString[7] = &quot;00e45aaf&quot;
    set PlayerColorString[8] = &quot;00949596&quot;
    set PlayerColorString[9] = &quot;007dbef1&quot;
    set PlayerColorString[10] = &quot;000f6145&quot;
    set PlayerColorString[11] = &quot;004d2903&quot;
    
    set i = 0
    loop
        set PlayerColor<i> = PlayerColorString<i>
        set i = i + 1
        exitwhen i == 12
    endloop
    
endfunction

endlibrary</i></i></i>
 
JASS:
function GetPlayerColorStringById takes integer playerId returns string    
    return StartString + PlayerColor[GetPlayerId(Players[playerId])]
endfunction

I should hit you!
JASS:
function GetPlayerColorStringById takes integer playerId returns string    
    return StartString + PlayerColor[playerId]
endfunction
 
Ouch :(

Sorry 'bout that XD

This then ? :S
JASS:
library PlayerColors initializer Init


///////////////////////////////////////////////////////////////////////////////////////////////////
//                                  //PlayerColoredString\\                                      //
//                                  //Made by, Komaqtion\\                                       //
//                                                                                               //
//                                                                                               //
//                                        Purpose:                                               //
//                                                                                               //
//             ¤ This snippet is supposed to help people to, with ease, convert                  //
//               a string to use a desired player&#039;s own color!                                   //
//                                                                                               //
//                                         Usage:                                                //
//                                                                                               //
//             ¤ To use this snippet, simply type &quot;call PlayerColoredString(string, playerid)&quot;   //
//               where &quot;string&quot; is the string you want to colorize, and &quot;playerid&quot;               //
//               is the player number of the player, whose color you wan to use.                 //
//               Note: This uses JASS&#039; player number range, meaning that                         //
//               Player 1(Red)&#039;s number is 0, and Player 2(Blue)&#039;s number is 1,                  //
//               and so on...                                                                    //
//               You can also get only the players color-string for own usage...                 //
//               This is accomplished by using the function &quot;GetPlayerColorString&quot;               //
//               which takes the player to get the string, or you can also use                   //
//               the GetPlayerColorStringById function, which takes the player&#039;s                 //
//               Id, or number instead <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />                                                        //
//                                                                                               //                                                                                //
//                                    Requirements:                                              //
//                                                                                               //
//             ¤ This snippet&#039;s only requirement is vJASS compilement, which is                  //
//               easiest achieved by downloading JASS Newgen Pack, at                            //
//               <a href="http://www.thehelper.net/forums/showthread.php?t=73936" class="link link--internal">http://www.thehelper.net/forums/showthread.php?t=73936</a>                          //
//                                                                                               //
//                                        Credits:                                               //
//                                                                                               //
//             ¤ Well, at the moment, not that many has helped me really, so no                  //
//               credits has been given yet                                                      //
//                                                                                               //
//               And credits, if you use this that is, is not needed to give me                  //
//               though it&#039;s always welcome <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink    ;)" loading="lazy" data-shortname=";)" />                                                   //
//                                                                                               //
///////////////////////////////////////////////////////////////////////////////////////////////////


globals
    private player array Players
    private string array PlayerColor
    private string array PlayerColorString
    private constant string EndString = &quot;|r&quot;
    private constant string StartString = &quot;|c&quot;
endglobals

function PlayerColoredString takes string s, integer playerId returns string    
    return StartString + PlayerColor[playerId] + s + EndString
endfunction

function GetPlayerColorString takes player p returns string   
    return StartString + PlayerColor[GetPlayerId(p)]
endfunction

function GetPlayerColorStringById takes integer playerId returns string    
    return StartString + PlayerColor[playerId]
endfunction

private function OnColorChange takes player whichplayer, playercolor color returns nothing
    set PlayerColor[GetPlayerId(whichplayer)] = PlayerColorString[GetHandleId(color)]
endfunction

hook SetPlayerColor OnColorChange

private function Init takes nothing returns nothing
    local integer i = 0
    loop
        set Players<i> = Player(i)
        set i = i + 1
        exitwhen i == 12
    endloop
    
    set PlayerColorString[0] = &quot;00ff0202&quot;
    set PlayerColorString[1] = &quot;000041ff&quot;
    set PlayerColorString[2] = &quot;001be5b8&quot;
    set PlayerColorString[3] = &quot;00530080&quot;
    set PlayerColorString[4] = &quot;00fffc00&quot;
    set PlayerColorString[5] = &quot;00fe890d&quot;
    set PlayerColorString[6] = &quot;001fbf00&quot;
    set PlayerColorString[7] = &quot;00e45aaf&quot;
    set PlayerColorString[8] = &quot;00949596&quot;
    set PlayerColorString[9] = &quot;007dbef1&quot;
    set PlayerColorString[10] = &quot;000f6145&quot;
    set PlayerColorString[11] = &quot;004d2903&quot;
    
    set i = 0
    loop
        set PlayerColor<i> = PlayerColorString<i>
        set i = i + 1
        exitwhen i == 12
    endloop
    
endfunction

endlibrary</i></i></i>
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    Or even third party. Like if you don't have an original one in a functional condition, you cannot play this game properly. Like yeah the keyboard mods exist, but I think those are BARELY functional
  • Varine Varine:
    And since almost all of my programming experience is with defunct shit now, I figure my best place is helping preserve legacy stuff. Which I don't know how to do necessarily, but I need some kind of a hobby and figuring out how older things worked is the only shit that really interests me. Well soldering and restoration is fun too, but no one is bringing me new stuff to fix and restore, so it's mostly old shit, and I LOVE OG Xbox so much. I want to make sure it can function as long as possible, until someone can effectively emulate it at least. I have like 15 I was going to fix over the winter and didn't get to.
    +1
  • Varine Varine:
    I also have a couple OG gameboys, but idk if I can do that without like, manufacturing new parts that no one makes anymore and I can't do that right now
  • tom_mai78101 tom_mai78101:
    Currently in the middle of getting the probate process going. We're doing the informal probate process.
    +3
  • Varine Varine:
    A probate is usually done with a will, yes? If so I am sorry for your loss
    +1
  • The Helper The Helper:
    Yeah Tom, me too sorry for your loss buddy my mom told me she finds out her olds friend died from Google searching them. She had not talked to one of her old friends in a year and found out she died from Google. Also another one in the same session. RIP all of them my sincere condolences Tom
    +1
  • Varine Varine:
    We have some elderly guests that regularly come hang out at the bar at the end of the night, and every once in a while we don't see someone for a few weeks and then someone shows up with their obituary.
  • Varine Varine:
    We usually let them do their memorials there in the morning if they want to and I'll make them some snacks and drinks. There was one guy named Tom that came in like every night and would sit by himself and get a bunch of soup and a glass of wine. idk why but he LOVED our fucking soup, like he would order a fucking quart of it at a time and would always get so sad when we stop doing it for the summer.
    +1
  • Varine Varine:
    But he also loved our calamari, which is another thing I hate but it sells super well so I can't change it. There was one day he came in and was asking me how to make it, because he tried to at home once in the off season when we stop running it and he really wanted it lol
  • Varine Varine:
    I think he's one of the only people I've made recipes for for free because he really wanted a broccoli cheddar, and it was like dude I don't have a recipe, it's just whatever I have, but here, this is how you do it
  • Varine Varine:
    I don't think he ever figured out how to do the calamari in a pan though, like idk how to do that either. He was afraid of the at home deep fryers though and it's like yeah, that's fair, I am too
  • Varine Varine:
    He was just such a sweet old man, we had two servers pregnant and they held a baby shower together, he was soooooo fucking excited to get to see a baby. Unfortunately he died a month or so before they were born
  • The Helper The Helper:
    So I decided to Google some people that I had not seen or heard from in a while and sure enough one of my old best friends, we had a falling out years ago but whatever, find out he died of Pancreatic Cancer in January. I have also lost a few of my closer acquaintances from growing up the last year. Getting old - people die - I kinda thought it was going to be this way a few years ago....
    +2
  • The Helper The Helper:
    Forum running super slow again
  • Ghan Ghan:
    Not really clear from the stats as to what is causing the slowness.
  • Ghan Ghan:
    We get a lot of guest traffic so it may just be the load is getting too high and not from any particular source.
  • Ghan Ghan:
    Looks like the server is maxed out on CPU.
  • Ghan Ghan:
    Oh it looks like a lot of the traffic is Silkroad Forums. That domain isn't protected by Cloudflare.
  • Ghan Ghan:
    But the old Silkroad site is still on its own server. I just had a test site set up on this server for it.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top