Azlier
Old World Ghost
- Reaction score
- 461
The player array is only used once on Init, since updates have been made. Which means that it should be removed.
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's own color! //
// //
// Usage: //
// //
// ¤ To use this snippet, simply type "call PlayerColoredString(playerid, string)" //
// where "string" is the string you want to colorize, and "playerid" //
// is the player number of the player, whose color you wan to use. //
// Note: This uses JASS' player number range, meaning that //
// Player 1(Red)'s number is 0, and Player 2(Blue)'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 "GetPlayerColorString" //
// which takes the player to get the string, or you can also use //
// the GetPlayerColorStringById function, which takes the player'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'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> //
// You'll also have to update JASS Helper to the latest version... //
// //
// //
// Credits: //
// //
// ¤ Azlier, for helpong me out alot with several bugfixes and tweaking ! //
// Jesus4Lyf, for also helping me out alot ! <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" /> //
// //
// And credits, if you use this that is, is not needed to give me //
// though it'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 string array PlayerColor
private string array PlayerColorString
private constant string EndString = "|r"
endglobals
function PlayerColoredString takes integer playerId, string s returns string
return PlayerColor[playerId] + s + EndString
endfunction
function GetPlayerColorString takes player p returns string
return PlayerColor[GetPlayerId(p)]
endfunction
function GetPlayerColorStringById takes integer playerId returns string
return 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 = 15
set PlayerColorString[0] = "|c00ff0202"
set PlayerColorString[1] = "|c000041ff"
set PlayerColorString[2] = "|c001be5b8"
set PlayerColorString[3] = "|c00530080"
set PlayerColorString[4] = "|c00fffc00"
set PlayerColorString[5] = "|c00fe890d"
set PlayerColorString[6] = "|c001fbf00"
set PlayerColorString[7] = "|c00e45aaf"
set PlayerColorString[8] = "|c00949596"
set PlayerColorString[9] = "|c007dbef1"
set PlayerColorString[10] = "|c000f6145"
set PlayerColorString[11] = "|c004d2903"
loop
exitwhen i < 0
set PlayerColor<i> = PlayerColorString[GetHandleId(GetPlayerColor(Player(i)))]
set i = i - 1
endloop
endfunction
endlibrary</i>
BumP... I really want to extend this with even more features !
So, please come with suggestions, and I'll try to make them as good as I can !
(Even if this is going to be graveyard'ed, I really want to test my skills with this ! )
Could have a tint text tag with player colour function?
(Off memory text tags can be tinted with integers.)
How many features could this possibly have? How about related functions?
function PlayerColoredTextTag takes texttag tag, integer playerId, string s returns nothing
call SetTextTagText( tag, PlayerColor[playerId] + s + EndString, 10. )
endfunction
function PlayerColoredTextTag takes integer playerId, integer alpha, texttag tag returns nothing
call SetTextTagColor( tag, S2I("0x" + SubString( PlayerColor[playerId], 5, 6 )), S2I("0x" + SubString( PlayerColor[playerId], 7, 8 )), S2I("0x" + SubString( PlayerColor[playerId], 9, 10 )), alpha )
endfunction
//...
set PlayerColorString[0] = "|c00ff0202"
set Red[0] = 0xff
set Green[0] = 0x02
set Blue[0] = 0x02
//...
private function Init takes nothing returns nothing
local integer i = 11
set PlayerColorString[0] = "|c00ff0202"
set Red[0] = 0xff
set Green[0] = 0x02
set Blue[0] = 0x02
set PlayerColorString[1] = "|c000041ff"
set Red[0] = 0x00
set Green[0] = 0x41
set Blue[0] = 0xff
set PlayerColorString[2] = "|c001be5b8"
set Red[0] = 0x1b
set Green[0] = 0xe5
set Blue[0] = 0xb8
set PlayerColorString[3] = "|c00530080"
set Red[0] = 0x53
set Green[0] = 0x00
set Blue[0] = 0x80
set PlayerColorString[4] = "|c00fffc00"
set Red[0] = 0xff
set Green[0] = 0xfc
set Blue[0] = 0x00
set PlayerColorString[5] = "|c00fe890d"
set Red[0] = 0xfe
set Green[0] = 0x89
set Blue[0] = 0x0d
set PlayerColorString[6] = "|c001fbf00"
set Red[0] = 0x1f
set Green[0] = 0xbf
set Blue[0] = 0x00
set PlayerColorString[7] = "|c00e45aaf"
set Red[0] = 0xe4
set Green[0] = 0x5a
set Blue[0] = 0xaf
set PlayerColorString[8] = "|c00949596"
set Red[0] = 0x94
set Green[0] = 0x95
set Blue[0] = 0x96
set PlayerColorString[9] = "|c007dbef1"
set Red[0] = 0x7d
set Green[0] = 0xbe
set Blue[0] = 0xf1
set PlayerColorString[10] = "|c000f6145"
set Red[0] = 0x0f
set Green[0] = 0x61
set Blue[0] = 0x45
set PlayerColorString[11] = "|c004d2903"
set Red[0] = 0x4d
set Green[0] = 0x29
set Blue[0] = 0x03
loop
exitwhen i < 0
set PlayerColor<i> = PlayerColorString[GetHandleId(GetPlayerColor(Player(i)))]
set i = i - 1
endloop
endfunction</i>
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's own color! //
// //
// Usage: //
// //
// ¤ To use this snippet, simply type "call PlayerColoredString(playerid, string)" //
// where "string" is the string you want to colorize, and "playerid" //
// is the player number of the player, whose color you wan to use. //
// Note: This uses JASS' player number range, meaning that //
// Player 1(Red)'s number is 0, and Player 2(Blue)'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 "GetPlayerColorString" //
// which takes the player to get the string, or you can also use //
// the GetPlayerColorStringById function, which takes the player'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'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> //
// You'll also have to update JASS Helper to the latest version... //
// //
// //
// Credits: //
// //
// ¤ Azlier, for helpong me out alot with several bugfixes and tweaking ! //
// Jesus4Lyf, for also helping me out alot ! <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" /> //
// //
// And credits, if you use this that is, is not needed to give me //
// though it'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 string array PlayerColor
private string array PlayerColorString
private integer array Red
private integer array Green
private integer array Blue
private constant string EndString = "|r"
endglobals
function PlayerColoredString takes integer playerId, string s returns string
return PlayerColor[playerId] + s + EndString
endfunction
function PlayerColoredTextTag takes integer alpha, integer playerId, texttag tag returns nothing
call SetTextTagColor( tag, Red[playerId], Green[playerId], Blue[playerId], alpha )
endfunction
function GetPlayerColorString takes player p returns string
return PlayerColor[GetPlayerId(p)]
endfunction
function GetPlayerColorStringById takes integer playerId returns string
return 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 = 11
set PlayerColorString[0] = "|c00ff0202"
set Red[0] = 0xff
set Green[0] = 0x02
set Blue[0] = 0x02
set PlayerColorString[1] = "|c000041ff"
set Red[0] = 0x00
set Green[0] = 0x41
set Blue[0] = 0xff
set PlayerColorString[2] = "|c001be5b8"
set Red[0] = 0x1b
set Green[0] = 0xe5
set Blue[0] = 0xb8
set PlayerColorString[3] = "|c00530080"
set Red[0] = 0x53
set Green[0] = 0x00
set Blue[0] = 0x80
set PlayerColorString[4] = "|c00fffc00"
set Red[0] = 0xff
set Green[0] = 0xfc
set Blue[0] = 0x00
set PlayerColorString[5] = "|c00fe890d"
set Red[0] = 0xfe
set Green[0] = 0x89
set Blue[0] = 0x0d
set PlayerColorString[6] = "|c001fbf00"
set Red[0] = 0x1f
set Green[0] = 0xbf
set Blue[0] = 0x00
set PlayerColorString[7] = "|c00e45aaf"
set Red[0] = 0xe4
set Green[0] = 0x5a
set Blue[0] = 0xaf
set PlayerColorString[8] = "|c00949596"
set Red[0] = 0x94
set Green[0] = 0x95
set Blue[0] = 0x96
set PlayerColorString[9] = "|c007dbef1"
set Red[0] = 0x7d
set Green[0] = 0xbe
set Blue[0] = 0xf1
set PlayerColorString[10] = "|c000f6145"
set Red[0] = 0x0f
set Green[0] = 0x61
set Blue[0] = 0x45
set PlayerColorString[11] = "|c004d2903"
set Red[0] = 0x4d
set Green[0] = 0x29
set Blue[0] = 0x03
loop
exitwhen i < 0
set PlayerColor<i> = PlayerColorString[GetHandleId(GetPlayerColor(Player(i)))]
set i = i - 1
endloop
endfunction
endlibrary</i>
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's own color! //
// //
// Usage: //
// //
// ¤ To use this snippet, simply type "call PlayerColoredString(playerid, string)" //
// where "string" is the string you want to colorize, and "playerid" //
// is the player number of the player, whose color you wan to use. //
// Note: This uses JASS' player number range, meaning that //
// Player 1(Red)'s number is 0, and Player 2(Blue)'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 "GetPlayerColorString" //
// which takes the player to get the string, or you can also use //
// the GetPlayerColorStringById function, which takes the player'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'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> //
// You'll also have to update JASS Helper to the latest version... //
// //
// //
// Credits: //
// //
// ¤ Azlier, for helpong me out alot with several bugfixes and tweaking ! //
// Jesus4Lyf, for also helping me out alot ! <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" /> //
// //
// And credits, if you use this that is, is not needed to give me //
// though it'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 string array PlayerColor
private string array PlayerColorString
private integer array Red
private integer array Green
private integer array Blue
private constant string EndString = "|r"
endglobals
function PlayerColoredString takes integer playerId, string s returns string
return PlayerColor[playerId] + s + EndString
endfunction
function PlayerColoredTextTag takes integer alpha, player p, texttag tag returns nothing
call SetTextTagColor( tag, Red[GetPlayerId(p)], Green[GetPlayerId(p)], Blue[GetPlayerId(p)], alpha )
endfunction
function PlayerColoredTextTagById takes integer alpha, integer playerId, texttag tag returns nothing
call SetTextTagColor( tag, Red[playerId], Green[playerId], Blue[playerId], alpha )
endfunction
function GetPlayerColorString takes player p returns string
return PlayerColor[GetPlayerId(p)]
endfunction
function GetPlayerColorStringById takes integer playerId returns string
return 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 = 11
set PlayerColorString[0] = "|c00ff0202"
set Red[0] = 0xff
set Green[0] = 0x02
set Blue[0] = 0x02
set PlayerColorString[1] = "|c000041ff"
set Red[0] = 0x00
set Green[0] = 0x41
set Blue[0] = 0xff
set PlayerColorString[2] = "|c001be5b8"
set Red[0] = 0x1b
set Green[0] = 0xe5
set Blue[0] = 0xb8
set PlayerColorString[3] = "|c00530080"
set Red[0] = 0x53
set Green[0] = 0x00
set Blue[0] = 0x80
set PlayerColorString[4] = "|c00fffc00"
set Red[0] = 0xff
set Green[0] = 0xfc
set Blue[0] = 0x00
set PlayerColorString[5] = "|c00fe890d"
set Red[0] = 0xfe
set Green[0] = 0x89
set Blue[0] = 0x0d
set PlayerColorString[6] = "|c001fbf00"
set Red[0] = 0x1f
set Green[0] = 0xbf
set Blue[0] = 0x00
set PlayerColorString[7] = "|c00e45aaf"
set Red[0] = 0xe4
set Green[0] = 0x5a
set Blue[0] = 0xaf
set PlayerColorString[8] = "|c00949596"
set Red[0] = 0x94
set Green[0] = 0x95
set Blue[0] = 0x96
set PlayerColorString[9] = "|c007dbef1"
set Red[0] = 0x7d
set Green[0] = 0xbe
set Blue[0] = 0xf1
set PlayerColorString[10] = "|c000f6145"
set Red[0] = 0x0f
set Green[0] = 0x61
set Blue[0] = 0x45
set PlayerColorString[11] = "|c004d2903"
set Red[0] = 0x4d
set Green[0] = 0x29
set Blue[0] = 0x03
loop
exitwhen i < 0
set PlayerColor<i> = PlayerColorString[GetHandleId(GetPlayerColor(Player(i)))]
set i = i - 1
endloop
endfunction
endlibrary</i>