Добавлен , опубликован
Алгоритмы, Наработки и Способности
Способ реализации:
Jass
Тип:
Алгоритм
радужный текст:
  • реализован в статичном виде и в движущемся виде
  • три цветовых режима - черно-белый, радуга7, радуга12
  • изменение скорости
  • изменение направления
команды:
-help or -h = этот список
-test = тест длинной строки
-test AAA = тест введённой строки
-go = дискотека
-t TEXT = сменить текст
-r = направо
-l = налево
-s 0.5 = скорость
-m 12 = цветовой режим [2, 7, 12]
коды цветов

таблица цветов 2

HEX RGB цвет
FFFFFF rgb(255,255,255) белый
000000 rgb(0,0,0) черный

таблица цветов 7

HEX RGB цвет
FF0000 rgb(255,0,0) красный
FF8000 rgb(255,128,0) оранжевый
FFFF00 rgb(255,255,0) желтый
00FF00 rgb(0,255,0) зеленый
00FFFF rgb(0,255,255) голубой
0000FF rgb(0,0,255) синий
FF00FF rgb(255,0,255) фиолетовый

таблица цветов 12

HEX RGB цвет
FF0000 rgb(255,0,0) красный
FF8000 rgb(255,128,0) оранжевый
FFFF00 rgb(255,255,0) желтый
80FF00 rgb(128,255,0)
00FF00 rgb(0,255,0) зеленый
00FF80 rgb(0,255,128)
00FFFF rgb(0,255,255) голубой
0080FF rgb(0,128,255)
0000FF rgb(0,0,255) синий
8000FF rgb(128,0,255)
FF00FF rgb(255,0,255) фиолетовый
FF0080 rgb(255,0,128)
код карты:
globals
	integer PLAYERS=12
	unit array u

	trigger RainbowText_Trg1=CreateTrigger()
	trigger RainbowText_Trg2=CreateTrigger()
	trigger RainbowText_Trg3=CreateTrigger()
	string RainbowText_s=""
	integer RainbowText_shift=0
	integer RainbowText_mode=7
	integer RainbowText_d=0
	integer RainbowText_i=0
	string RainbowText_abc=""
	string RainbowText_ss=""

	trigger Dancer_t=CreateTrigger()
	triggeraction Dancer_Act0 = null
	string Dancer_text="0123456789"
	texttag Dancer_textTag=CreateTextTag()
	string Dancer_direction="Left"
	integer Dancer_i=0
	real Dancer_speed=0.20
	integer Dancer_mode=7
	integer Dancer_ON=0
endglobals

//host--pi

function FirstSymbolLength takes string s returns integer
	local integer i=1
	local integer j=1
	local string array Alphabet
	set Alphabet[1]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234 56789!\"#$%&'()*+:;<=>?@,-./[\\]^_`{|}~" //en-1 //len 95
	set Alphabet[2]="АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩабвгдеёжзийклмнопрстуфхцчшщЪЫЬЭЮЯъыьэюя" //ru-2 // len 66
	set Alphabet[3]="№" //ru-3
	if StringLength(s)>0 then
		loop
			exitwhen j>3
			set i=1
			loop
				exitwhen i>StringLength(Alphabet[j])/j
				//call BJDebugMsg(SubString(s,0,j)+" - "+SubString(Alphabet[j],(i-1)*j,i*j)+" i - "+I2S(i)+" j - "+I2S(j)+" s - "+s)
				if SubString(s,0,j)==SubString(Alphabet[j],(i-1)*j,i*j) then
					return j
				endif
				set i=i+1
			endloop
			set j=j+1
		endloop
		return 3
	else
		return 0
	endif
endfunction

function ColorWhite takes string s returns string // 255,255,255
	return "|c"+"ff"+"FFFFFF"+s+"|r"
endfunction
function ColorBlack takes string s returns string // 0,0,0
	return "|c"+"ff"+"000000"+s+"|r"
endfunction

function ColorRed takes string s returns string // 255,0,0
	return "|c"+"ff"+"FF0000"+s+"|r"
endfunction
function ColorOrange takes string s returns string // 255,128,0
	return "|c"+"ff"+"FF8000"+s+"|r"
endfunction
function ColorYellow takes string s returns string // 255,255,0
	return "|c"+"ff"+"FFFF00"+s+"|r"
endfunction
function ColorYellowGreen takes string s returns string // 128,255,0
	return "|c"+"ff"+"80FF00"+s+"|r"
endfunction
function ColorGreen takes string s returns string // 0,255,0
	return "|c"+"ff"+"00FF00"+s+"|r"
endfunction
function ColorGreenCyan takes string s returns string // 0,255,128
	return "|c"+"ff"+"00FF80"+s+"|r"
endfunction
function ColorCyan takes string s returns string // 0,255,255
	return "|c"+"ff"+"00FFFF"+s+"|r"
endfunction
function ColorCyanBlue takes string s returns string // 0,128,255
	return "|c"+"ff"+"0080FF"+s+"|r"
endfunction
function ColorBlue takes string s returns string // 0,0,255
	return "|c"+"ff"+"0000FF"+s+"|r"
endfunction
function ColorBlueViolet takes string s returns string // 128,0,255
	return "|c"+"ff"+"8000FF"+s+"|r"
endfunction
function ColorViolet takes string s returns string // 255,0,255
	return "|c"+"ff"+"FF00FF"+s+"|r"
endfunction
function ColorVioletRed takes string s returns string // 255,0,128
	return "|c"+"ff"+"FF0080"+s+"|r"
endfunction

function RainbowText_Act3 takes nothing returns boolean
	set RainbowText_ss=RainbowText_ss+RainbowText_abc
	return false
endfunction
function RainbowText_Act2 takes nothing returns boolean
	set RainbowText_d=FirstSymbolLength(SubString(RainbowText_s,RainbowText_i,RainbowText_i+3))
	return false
endfunction
function RainbowText_Act1 takes nothing returns boolean
	local integer i=0
	local integer j=1
	local integer decode=0
	local integer color=0
	local string abc=""
	set RainbowText_ss=""
	if StringLength(RainbowText_s)>0 then
		loop
			exitwhen i+1>StringLength(RainbowText_s)
			set RainbowText_i=i
			call TriggerEvaluate(RainbowText_Trg2)
			set decode=RainbowText_d
			set abc=SubString(RainbowText_s,i,i+1*decode)
			set color=ModuloInteger(j+RainbowText_shift,RainbowText_mode)
			if 1==0 then
			elseif RainbowText_mode==2 then
				if color==1 then
					set abc=ColorWhite(abc)
				elseif color==0 then
					set abc=ColorBlack(abc)
				endif
			elseif RainbowText_mode==7 then
				if 1==0 then
				elseif color==1 then
					set abc=ColorRed(abc)
				elseif color==2 then
					set abc=ColorOrange(abc)
				elseif color==3 then
					set abc=ColorYellow(abc)
				elseif color==4 then
					set abc=ColorGreen(abc)
				elseif color==5 then
					set abc=ColorCyan(abc)
				elseif color==6 then
					set abc=ColorBlue(abc)
				elseif color==0 then
					set abc=ColorViolet(abc)
				endif
			elseif RainbowText_mode==12 then
				if 1==0 then
				elseif color==1 then
					set abc=ColorRed(abc)
				elseif color==2 then
					set abc=ColorOrange(abc)
				elseif color==3 then
					set abc=ColorYellow(abc)
				elseif color==4 then
					set abc=ColorYellowGreen(abc)
				elseif color==5 then
					set abc=ColorGreen(abc)
				elseif color==6 then
					set abc=ColorGreenCyan(abc)
				elseif color==7 then
					set abc=ColorCyan(abc)
				elseif color==8 then
					set abc=ColorCyanBlue(abc)
				elseif color==9 then
					set abc=ColorBlue(abc)
				elseif color==10 then
					set abc=ColorBlueViolet(abc)
				elseif color==11 then
					set abc=ColorViolet(abc)
				elseif color==0 then
					set abc=ColorVioletRed(abc)
				endif
			endif
			set RainbowText_abc=abc
			call TriggerEvaluate(RainbowText_Trg3)
			if StringLength(RainbowText_ss)>4000 then
				call BJDebugMsg("Rainbow Length 4000")
				set RainbowText_ss=""
				return false
			endif
			set i=i+1*decode
			set j=j+1
		endloop
		return false
	else
		call BJDebugMsg("Rainbow Length 0")
		set RainbowText_ss=""
		return false
	endif
	return false
endfunction
function RainbowText_Init takes nothing returns nothing
	call TriggerAddCondition(RainbowText_Trg1, Condition(function RainbowText_Act1))
	call TriggerAddCondition(RainbowText_Trg2, Condition(function RainbowText_Act2))
	call TriggerAddCondition(RainbowText_Trg3, Condition(function RainbowText_Act3))
endfunction
function RainbowText takes string s, integer shift, integer mode returns string
	set RainbowText_s=s
	set RainbowText_shift=shift
	set RainbowText_mode=mode
	call TriggerEvaluate(RainbowText_Trg1)
	return RainbowText_ss
endfunction

function Dancer_Main takes nothing returns nothing
	local string ss=RainbowText(Dancer_text,Dancer_i,Dancer_mode)
	call SetTextTagText(Dancer_textTag,ss,TextTagSize2Height(15))
	//call SetTextTagPos(Dancer_textTag,GetCameraTargetPositionX(),GetCameraTargetPositionY(),0)
	call SetTextTagPos(Dancer_textTag,-800,-50,0)
	call BJDebugMsg(ss)
	if Dancer_direction=="Left" then
		set Dancer_i=Dancer_i+1
	else
		set Dancer_i=Dancer_i-1
	endif
	if Dancer_i==1000000 or Dancer_i==-1000000 then
		set Dancer_i=0
	endif
endfunction

function Dancer_init takes nothing returns nothing
	call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
	set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
	call DisableTrigger(Dancer_t)
	//call EnableTrigger(Dancer_t)
	call SetTextTagVisibility(Dancer_textTag,false)
	//call SetTextTagVisibility(Dancer_textTag,true)
endfunction

function Start_msg takes nothing returns nothing
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg("Map Rainbow Text")
	call BJDebugMsg("Command examples:")
	call BJDebugMsg("-help or -h = this info")
	call BJDebugMsg("-test = test long string")
	call BJDebugMsg("-test AAA = test AAA string")
	call BJDebugMsg("-go = go disco dance")
	call BJDebugMsg("-t TEXT = change disco text")
	call BJDebugMsg("-r = right direction")
	call BJDebugMsg("-l = left direction")
	call BJDebugMsg("-s 0.5 = speed")
	call BJDebugMsg("-m 12 = color mode [2, 7, 12]")
endfunction

function Start takes nothing returns nothing
	local string ss=GetEventPlayerChatString()
	local string s=StringCase(ss,false)
	if 1==0 then
	elseif s=="-test" then
		set s="WWWWWWWWWWWWWWWяяяяяяяяяяяяяя❤❤❤❤❤❤❤❤❤❤"
		call BJDebugMsg(RainbowText(s,0,2))
		call BJDebugMsg(RainbowText(s,0,7))
		call BJDebugMsg(RainbowText(s,0,12))
	elseif SubString(s,0,6)=="-test " then
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,2))
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,7))
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,12))
	elseif s=="-go" then
		if Dancer_ON==0 then
			set Dancer_ON=1
			call EnableTrigger(Dancer_t)
			//set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
			call SetTextTagVisibility(Dancer_textTag,true)
		elseif Dancer_ON==1 then
			set Dancer_ON=0
			call DisableTrigger(Dancer_t)
			//call TriggerRemoveAction(Dancer_t, Dancer_Act0)
			call SetTextTagVisibility(Dancer_textTag,false)
		endif
	elseif SubString(s,0,3)=="-t " then
		set Dancer_text=SubString(ss,3,999)
	elseif s=="-right" or s=="-r" then
		set Dancer_direction="Right"
	elseif s=="-left" or s=="-l" then
		set Dancer_direction="Left"
	elseif SubString(s,0,3)=="-s " then
if S2R(SubString(s,3,999))>0 and S2R(SubString(s,3,999))<101 then
		set Dancer_speed=S2R(SubString(s,3,999))
		call DisableTrigger(Dancer_t)
		call TriggerRemoveAction(Dancer_t, Dancer_Act0)
		set Dancer_t=CreateTrigger()
		call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
		set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
endif
	elseif SubString(s,0,3)=="-m " then
		set Dancer_mode=S2I(SubString(s,3,999))
	elseif s=="-help" or s=="-h" then
		call Start_msg()
	endif
endfunction

function Ch_init takes nothing returns nothing
	local trigger t=CreateTrigger()
	local integer i=1
	loop
		exitwhen i>PLAYERS
		call TriggerRegisterPlayerChatEvent(t,Player(i-1),"-",false)
		set i=i+1
	endloop
	call TriggerAddAction(t,function Start)
endfunction

function Start_init takes nothing returns nothing
	call Ch_init()
	call Start_msg()
	call RainbowText_Init()
	call Dancer_init()
endfunction

function CreateAllUnits takes nothing returns nothing
	set u[1] = CreateUnit(Player(0), 'Hblm', -800, -50, 3.977)
endfunction
function InitCustomPlayerSlots takes nothing returns nothing
	// Player 0
	call SetPlayerStartLocation( Player(0), 0 )
	call SetPlayerColor( Player(0), ConvertPlayerColor(0) )
	call SetPlayerRacePreference( Player(0), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(0), false )
	call SetPlayerController( Player(0), MAP_CONTROL_USER )
	// Player 1
	call SetPlayerStartLocation( Player(1), 1 )
	call SetPlayerColor( Player(1), ConvertPlayerColor(1) )
	call SetPlayerRacePreference( Player(1), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(1), false )
	call SetPlayerController( Player(1), MAP_CONTROL_USER )
	// Player 11
	call SetPlayerStartLocation( Player(11), 2 )
	call ForcePlayerStartLocation( Player(11), 2 )
	call SetPlayerColor( Player(11), ConvertPlayerColor(11) )
	call SetPlayerRacePreference( Player(11), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(11), false )
	call SetPlayerController( Player(11), MAP_CONTROL_COMPUTER )
endfunction
function InitCustomTeams takes nothing returns nothing
	call SetPlayerTeam( Player(0), 0 )
	call SetPlayerTeam( Player(1), 0 )
	call SetPlayerAllianceStateAllyBJ( Player(0), Player(1), true )
	call SetPlayerAllianceStateAllyBJ( Player(1), Player(0), true )
	call SetPlayerAllianceStateVisionBJ( Player(0), Player(1), true )
	call SetPlayerAllianceStateVisionBJ( Player(1), Player(0), true )
	call SetPlayerTeam( Player(11), 1 )
endfunction
function InitAllyPriorities takes nothing returns nothing
	call SetStartLocPrioCount( 0, 1 )
	call SetStartLocPrio( 0, 0, 1, MAP_LOC_PRIO_HIGH )
	call SetStartLocPrioCount( 1, 1 )
	call SetStartLocPrio( 1, 0, 0, MAP_LOC_PRIO_HIGH )
endfunction

function main takes nothing returns nothing
	call Start_init()
	call SetCameraBounds(-3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
	call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
	call NewSoundEnvironment("Default")
	call SetAmbientDaySound("LordaeronSummerDay")
	call SetAmbientNightSound("LordaeronSummerNight")
	call SetMapMusic("Music", true, 0)
	call CreateAllUnits()
	call InitBlizzard()
endfunction
function config takes nothing returns nothing
	call SetMapName( "TRIGSTR_001" )
	call SetMapDescription( "TRIGSTR_003" )
	call SetPlayers( 3 )
	call SetTeams( 3 )
	call SetGamePlacement( MAP_PLACEMENT_TEAMS_TOGETHER )
	call DefineStartLocation( 0, -800.0, -50.0 )
	call DefineStartLocation( 1, -800.0, -50.0 )
	call DefineStartLocation( 2, -800.0, -50.0 )
	call InitCustomPlayerSlots(  )
	call InitCustomTeams(  )
	call InitAllyPriorities(  )
endfunction
доп ссылки:
скачать карту - тут
цвета радуги инфо - тут
цвета игроков инфо - тут
batch HEX2RGB - тут
batch RGB2HEX - нет ссылки
демонстрация работы:
`
ОЖИДАНИЕ РЕКЛАМЫ...
Ответы (3)
36
Можно ли такое проделать с никами игроков?
15
  1. написать -name слово - навести мышку на синего
  2. написать -go - и над крестьянином и в F11 ник будет меняться, для мультибоарда должен тоже работать
функция и писалась как раз для подобных операций
код мода на имя 2го игрока
globals
	integer PLAYERS=12
	unit array u

	trigger RainbowText_Trg1=CreateTrigger()
	trigger RainbowText_Trg2=CreateTrigger()
	trigger RainbowText_Trg3=CreateTrigger()
	string RainbowText_s=""
	integer RainbowText_shift=0
	integer RainbowText_mode=7
	integer RainbowText_d=0
	integer RainbowText_i=0
	string RainbowText_abc=""
	string RainbowText_ss=""

	trigger Dancer_t=CreateTrigger()
	triggeraction Dancer_Act0 = null
	string Dancer_text="0123456789"
	texttag Dancer_textTag=CreateTextTag()
	string Dancer_direction="Left"
	integer Dancer_i=0
	real Dancer_speed=0.20
	integer Dancer_mode=7
	integer Dancer_ON=0
endglobals

//host--pi

function FirstSymbolLength takes string s returns integer
	local integer i=1
	local integer j=1
	local string array Alphabet
	set Alphabet[1]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234 56789!\"#$%&'()*+:;<=>?@,-./[\\]^_`{|}~" //en-1 //len 95
	set Alphabet[2]="АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩабвгдеёжзийклмнопрстуфхцчшщЪЫЬЭЮЯъыьэюя" //ru-2 // len 66
	set Alphabet[3]="№" //ru-3
	if StringLength(s)>0 then
		loop
			exitwhen j>3
			set i=1
			loop
				exitwhen i>StringLength(Alphabet[j])/j
				//call BJDebugMsg(SubString(s,0,j)+" - "+SubString(Alphabet[j],(i-1)*j,i*j)+" i - "+I2S(i)+" j - "+I2S(j)+" s - "+s)
				if SubString(s,0,j)==SubString(Alphabet[j],(i-1)*j,i*j) then
					return j
				endif
				set i=i+1
			endloop
			set j=j+1
		endloop
		return 3
	else
		return 0
	endif
endfunction

function ColorWhite takes string s returns string // 255,255,255
	return "|c"+"ff"+"FFFFFF"+s+"|r"
endfunction
function ColorBlack takes string s returns string // 0,0,0
	return "|c"+"ff"+"000000"+s+"|r"
endfunction

function ColorRed takes string s returns string // 255,0,0
	return "|c"+"ff"+"FF0000"+s+"|r"
endfunction
function ColorOrange takes string s returns string // 255,128,0
	return "|c"+"ff"+"FF8000"+s+"|r"
endfunction
function ColorYellow takes string s returns string // 255,255,0
	return "|c"+"ff"+"FFFF00"+s+"|r"
endfunction
function ColorYellowGreen takes string s returns string // 128,255,0
	return "|c"+"ff"+"80FF00"+s+"|r"
endfunction
function ColorGreen takes string s returns string // 0,255,0
	return "|c"+"ff"+"00FF00"+s+"|r"
endfunction
function ColorGreenCyan takes string s returns string // 0,255,128
	return "|c"+"ff"+"00FF80"+s+"|r"
endfunction
function ColorCyan takes string s returns string // 0,255,255
	return "|c"+"ff"+"00FFFF"+s+"|r"
endfunction
function ColorCyanBlue takes string s returns string // 0,128,255
	return "|c"+"ff"+"0080FF"+s+"|r"
endfunction
function ColorBlue takes string s returns string // 0,0,255
	return "|c"+"ff"+"0000FF"+s+"|r"
endfunction
function ColorBlueViolet takes string s returns string // 128,0,255
	return "|c"+"ff"+"8000FF"+s+"|r"
endfunction
function ColorViolet takes string s returns string // 255,0,255
	return "|c"+"ff"+"FF00FF"+s+"|r"
endfunction
function ColorVioletRed takes string s returns string // 255,0,128
	return "|c"+"ff"+"FF0080"+s+"|r"
endfunction

function RainbowText_Act3 takes nothing returns boolean
	set RainbowText_ss=RainbowText_ss+RainbowText_abc
	return false
endfunction
function RainbowText_Act2 takes nothing returns boolean
	set RainbowText_d=FirstSymbolLength(SubString(RainbowText_s,RainbowText_i,RainbowText_i+3))
	return false
endfunction
function RainbowText_Act1 takes nothing returns boolean
	local integer i=0
	local integer j=1
	local integer decode=0
	local integer color=0
	local string abc=""
	set RainbowText_ss=""
	if StringLength(RainbowText_s)>0 then
		loop
			exitwhen i+1>StringLength(RainbowText_s)
			set RainbowText_i=i
			call TriggerEvaluate(RainbowText_Trg2)
			set decode=RainbowText_d
			set abc=SubString(RainbowText_s,i,i+1*decode)
			set color=ModuloInteger(j+RainbowText_shift,RainbowText_mode)
			if 1==0 then
			elseif RainbowText_mode==2 then
				if color==1 then
					set abc=ColorWhite(abc)
				elseif color==0 then
					set abc=ColorBlack(abc)
				endif
			elseif RainbowText_mode==7 then
				if 1==0 then
				elseif color==1 then
					set abc=ColorRed(abc)
				elseif color==2 then
					set abc=ColorOrange(abc)
				elseif color==3 then
					set abc=ColorYellow(abc)
				elseif color==4 then
					set abc=ColorGreen(abc)
				elseif color==5 then
					set abc=ColorCyan(abc)
				elseif color==6 then
					set abc=ColorBlue(abc)
				elseif color==0 then
					set abc=ColorViolet(abc)
				endif
			elseif RainbowText_mode==12 then
				if 1==0 then
				elseif color==1 then
					set abc=ColorRed(abc)
				elseif color==2 then
					set abc=ColorOrange(abc)
				elseif color==3 then
					set abc=ColorYellow(abc)
				elseif color==4 then
					set abc=ColorYellowGreen(abc)
				elseif color==5 then
					set abc=ColorGreen(abc)
				elseif color==6 then
					set abc=ColorGreenCyan(abc)
				elseif color==7 then
					set abc=ColorCyan(abc)
				elseif color==8 then
					set abc=ColorCyanBlue(abc)
				elseif color==9 then
					set abc=ColorBlue(abc)
				elseif color==10 then
					set abc=ColorBlueViolet(abc)
				elseif color==11 then
					set abc=ColorViolet(abc)
				elseif color==0 then
					set abc=ColorVioletRed(abc)
				endif
			endif
			set RainbowText_abc=abc
			call TriggerEvaluate(RainbowText_Trg3)
			if StringLength(RainbowText_ss)>4000 then
				call BJDebugMsg("Rainbow Length 4000")
				set RainbowText_ss=""
				return false
			endif
			set i=i+1*decode
			set j=j+1
		endloop
		return false
	else
		call BJDebugMsg("Rainbow Length 0")
		set RainbowText_ss=""
		return false
	endif
	return false
endfunction
function RainbowText_Init takes nothing returns nothing
	call TriggerAddCondition(RainbowText_Trg1, Condition(function RainbowText_Act1))
	call TriggerAddCondition(RainbowText_Trg2, Condition(function RainbowText_Act2))
	call TriggerAddCondition(RainbowText_Trg3, Condition(function RainbowText_Act3))
endfunction
function RainbowText takes string s, integer shift, integer mode returns string
	set RainbowText_s=s
	set RainbowText_shift=shift
	set RainbowText_mode=mode
	call TriggerEvaluate(RainbowText_Trg1)
	return RainbowText_ss
endfunction

function Dancer_Main takes nothing returns nothing
	local string ss=RainbowText(Dancer_text,Dancer_i,Dancer_mode)
	call SetTextTagText(Dancer_textTag,ss,TextTagSize2Height(15))
	//call SetTextTagPos(Dancer_textTag,GetCameraTargetPositionX(),GetCameraTargetPositionY(),0)
	call SetTextTagPos(Dancer_textTag,-800,-50,0)
	call BJDebugMsg(ss)
	if Dancer_direction=="Left" then
		set Dancer_i=Dancer_i+1
	else
		set Dancer_i=Dancer_i-1
	endif
	if Dancer_i==1000000 or Dancer_i==-1000000 then
		set Dancer_i=0
	endif
call SetPlayerName(Player(1),ss)
endfunction

function Dancer_init takes nothing returns nothing
	call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
	set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
	call DisableTrigger(Dancer_t)
	//call EnableTrigger(Dancer_t)
	call SetTextTagVisibility(Dancer_textTag,false)
	//call SetTextTagVisibility(Dancer_textTag,true)

endfunction

function Start_msg takes nothing returns nothing
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg("Map Rainbow Text")
	call BJDebugMsg("Command examples:")
	call BJDebugMsg("-help or -h = this info")
	call BJDebugMsg("-test = test long string")
	call BJDebugMsg("-test AAA = test AAA string")
	call BJDebugMsg("-go = go disco dance")
	call BJDebugMsg("-t TEXT = change disco text")
	call BJDebugMsg("-r = right direction")
	call BJDebugMsg("-l = left direction")
	call BJDebugMsg("-s 0.5 = speed")
	call BJDebugMsg("-m 12 = color mode [2, 7, 12]")
	call BJDebugMsg("-name text = 2nd player name")
endfunction

function Start takes nothing returns nothing
	local string ss=GetEventPlayerChatString()
	local string s=StringCase(ss,false)
	if 1==0 then
	elseif s=="-test" then
		set s="WWWWWWWWWWWWWWWяяяяяяяяяяяяяя❤❤❤❤❤❤❤❤❤❤"
		call BJDebugMsg(RainbowText(s,0,2))
		call BJDebugMsg(RainbowText(s,0,7))
		call BJDebugMsg(RainbowText(s,0,12))
	elseif SubString(s,0,6)=="-test " then
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,2))
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,7))
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,12))
	elseif s=="-go" then
		if Dancer_ON==0 then
			set Dancer_ON=1
			call EnableTrigger(Dancer_t)
			//set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
			call SetTextTagVisibility(Dancer_textTag,true)
		elseif Dancer_ON==1 then
			set Dancer_ON=0
			call DisableTrigger(Dancer_t)
			//call TriggerRemoveAction(Dancer_t, Dancer_Act0)
			call SetTextTagVisibility(Dancer_textTag,false)
		endif
	elseif SubString(s,0,3)=="-t " then
		set Dancer_text=SubString(ss,3,999)
	elseif s=="-right" or s=="-r" then
		set Dancer_direction="Right"
	elseif s=="-left" or s=="-l" then
		set Dancer_direction="Left"
	elseif SubString(s,0,3)=="-s " then
if S2R(SubString(s,3,999))>0 and S2R(SubString(s,3,999))<101 then
		set Dancer_speed=S2R(SubString(s,3,999))
		call DisableTrigger(Dancer_t)
		call TriggerRemoveAction(Dancer_t, Dancer_Act0)
		set Dancer_t=CreateTrigger()
		call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
		set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
endif
	elseif SubString(s,0,3)=="-m " then
		set Dancer_mode=S2I(SubString(s,3,999))
	elseif s=="-help" or s=="-h" then
		call Start_msg()

	elseif SubString(s,0,6)=="-name " then
	set s=RainbowText(SubString(s,6,999),0,7)
	call SetPlayerName(Player(1),s)
	call BJDebugMsg("player 2 name "+s)
	endif
endfunction

function Ch_init takes nothing returns nothing
	local trigger t=CreateTrigger()
	local integer i=1
	loop
		exitwhen i>PLAYERS
		call TriggerRegisterPlayerChatEvent(t,Player(i-1),"-",false)
		set i=i+1
	endloop
	call TriggerAddAction(t,function Start)
endfunction

function Start_init takes nothing returns nothing
	call Ch_init()
	call Start_msg()
	call RainbowText_Init()
	call Dancer_init()
endfunction

function CreateAllUnits takes nothing returns nothing
	set u[1] = CreateUnit(Player(0), 'Hblm', -800, -50, 3.977)
	set u[2] = CreateUnit(Player(1), 'hpea', -400, -50, 3.977)
endfunction
function InitCustomPlayerSlots takes nothing returns nothing
	// Player 0
	call SetPlayerStartLocation( Player(0), 0 )
	call SetPlayerColor( Player(0), ConvertPlayerColor(0) )
	call SetPlayerRacePreference( Player(0), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(0), false )
	call SetPlayerController( Player(0), MAP_CONTROL_USER )
	// Player 1
	call SetPlayerStartLocation( Player(1), 1 )
	call SetPlayerColor( Player(1), ConvertPlayerColor(1) )
	call SetPlayerRacePreference( Player(1), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(1), false )
	call SetPlayerController( Player(1), MAP_CONTROL_COMPUTER )
	// Player 11
	call SetPlayerStartLocation( Player(11), 2 )
	call ForcePlayerStartLocation( Player(11), 2 )
	call SetPlayerColor( Player(11), ConvertPlayerColor(11) )
	call SetPlayerRacePreference( Player(11), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(11), false )
	call SetPlayerController( Player(11), MAP_CONTROL_COMPUTER )
endfunction
function InitCustomTeams takes nothing returns nothing
	call SetPlayerTeam( Player(0), 0 )
	call SetPlayerTeam( Player(1), 0 )
	call SetPlayerAllianceStateAllyBJ( Player(0), Player(1), true )
	call SetPlayerAllianceStateAllyBJ( Player(1), Player(0), true )
	call SetPlayerAllianceStateVisionBJ( Player(0), Player(1), true )
	call SetPlayerAllianceStateVisionBJ( Player(1), Player(0), true )
	call SetPlayerTeam( Player(11), 1 )
endfunction
function InitAllyPriorities takes nothing returns nothing
	call SetStartLocPrioCount( 0, 1 )
	call SetStartLocPrio( 0, 0, 1, MAP_LOC_PRIO_HIGH )
	call SetStartLocPrioCount( 1, 1 )
	call SetStartLocPrio( 1, 0, 0, MAP_LOC_PRIO_HIGH )
endfunction

function main takes nothing returns nothing
	call Start_init()
	call SetCameraBounds(-3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
	call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
	call NewSoundEnvironment("Default")
	call SetAmbientDaySound("LordaeronSummerDay")
	call SetAmbientNightSound("LordaeronSummerNight")
	call SetMapMusic("Music", true, 0)
	call CreateAllUnits()
	call InitBlizzard()
endfunction
function config takes nothing returns nothing
	call SetMapName( "TRIGSTR_001" )
	call SetMapDescription( "TRIGSTR_003" )
	call SetPlayers( 3 )
	call SetTeams( 3 )
	call SetGamePlacement( MAP_PLACEMENT_TEAMS_TOGETHER )
	call DefineStartLocation( 0, -800.0, -50.0 )
	call DefineStartLocation( 1, -800.0, -50.0 )
	call DefineStartLocation( 2, -800.0, -50.0 )
	call InitCustomPlayerSlots(  )
	call InitCustomTeams(  )
	call InitAllyPriorities(  )
endfunction
endfunction
Загруженные файлы
10
Наес, теперь буду за бабки менять ники игрокам на карте
15
чтобы не текло - нужно заменить это
	elseif SubString(s,0,3)=="-s " then
if S2R(SubString(s,3,999))>0 and S2R(SubString(s,3,999))<101 then
		set Dancer_speed=S2R(SubString(s,3,999))
		call DisableTrigger(Dancer_t)
		call TriggerRemoveAction(Dancer_t, Dancer_Act0)
		set Dancer_t=CreateTrigger()
		call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
		set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
endif
на это
	elseif SubString(s,0,3)=="-s " then
if S2R(SubString(s,3,999))>0 and S2R(SubString(s,3,999))<101 then
		set Dancer_speed=S2R(SubString(s,3,999))
		call DisableTrigger(Dancer_t)
		call TriggerRemoveAction(Dancer_t, Dancer_Act0)
		call DestroyTrigger(Dancer_t)
		set Dancer_t=null			
		set Dancer_Act0=null
		set Dancer_t=CreateTrigger()
		call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
		set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
endif
Чтобы оставить комментарий, пожалуйста, войдите на сайт.