JASS Error...

n00b1l1ty

Lєgєπd of Mysтicfаlcoи
Reaction score
46
I'm using textsplat library. When I'm saving my map on normal world editor there aren't any problem. But I need to use New Gen Pack. When I save the map in new gen 2 errors appear. My problem is here, how can I solve it?

Error: Functions passed to Filter or Condition must return a boolean.
Code:
function ts_CreateTextSplat takes string text,real baseX,real baseY,string font,integer size,integer valign,integer halign,integer color returns integer
 local integer id= GetFreeArrayIndex(TS_ARRAY_NAME())
 local string ref= TS_INSTANCE() + I2S(id)
 local image img= null
 local trigger t= null
 local conditionfunc c= null
 local integer length= StringLength(text)
 local real sizePerUnit= ( size * 4.0 ) / 32.0
 local real curSize= 0
 local integer maxWidth= 0
 local integer curWidth= 0
 local integer overall= 0
 local integer lnr= 0
 local integer count= 0
 local integer r= ColorIntegerGetRed(color)
 local integer g= ColorIntegerGetGreen(color)
 local integer b= ColorIntegerGetBlue(color)
 local integer a= ColorIntegerGetAlpha(color)
 local integer temp= 0
 local integer i= 0
 local string cur= ""
 local string next= SubString(text , 0 , 1)
	loop
		set cur = next
		exitwhen ( cur == "" or cur == null )
		set next = SubString(text , i + 1 , i + 2)
		if ( ( cur == "|" and next == "n" ) or cur == "\n" or cur == "\r" ) then
			call StoreInteger(udg_TextSplatCache , ref , "LetterCount" + I2S(lnr) , count)
			call StoreInteger(udg_TextSplatCache , ref , "LineWidth" + I2S(lnr) , curWidth)
			call FlushStoredInteger(udg_TextSplatCache , ref , "StartIndex" + I2S(lnr))
			if ( curWidth > maxWidth ) then
				set maxWidth = curWidth
			endif
			set overall = overall + count
			set count = 0
			set curWidth = 0
			set lnr = lnr + 1
			if ( cur == "|" ) then
				set i = i + 1
				set next = SubString(text , i + 1 , i + 2)
			endif
		elseif ( cur == "|" and next == "r" ) then
			if ( length > i + 1 ) then
				call StoreInteger(udg_TextSplatCache , ref , "ColorTag" + I2S(count) + "Line" + I2S(lnr) , 2)
			endif
			set r = ColorIntegerGetRed(color)
			set g = ColorIntegerGetGreen(color)
			set b = ColorIntegerGetBlue(color)
			set a = ColorIntegerGetAlpha(color)
			set i = i + 1
			set next = SubString(text , i + 1 , i + 2)
		elseif ( cur == "|" and next == "c" and length > i + 9 and IsHexadecimal(SubString(text , i + 2 , i + 10)) ) then
			set temp = ColorString2ColorInteger(SubString(text , i + 2 , i + 10))
			set r = ColorIntegerGetRed(temp)
			set g = ColorIntegerGetGreen(temp)
			set b = ColorIntegerGetBlue(temp)
			set a = ColorIntegerGetAlpha(temp)
			call StoreInteger(udg_TextSplatCache , ref , "ColorTag" + I2S(count) + "Line" + I2S(lnr) , 1)
			call StoreInteger(udg_TextSplatCache , ref , "Color" + I2S(count) + "Line" + I2S(lnr) , temp)
			set i = i + 9
			set next = SubString(text , i + 1 , i + 2)
		else
			set temp = Asc(cur)
			if ( temp >= 32 and temp <= 127 ) then
				set curSize = GetStoredInteger(udg_TextSplatCache , "Font::" + font , "Width" + I2S(temp)) * sizePerUnit
				set curWidth = curWidth + GetStoredInteger(udg_TextSplatCache , "Font::" + font , "Width" + I2S(temp))
				if ( temp != 32 ) then
					set img = CreateImageEx(TS_FONTSPATH() + font + "\\" + I2S(temp) + ".blp" , 32 * sizePerUnit , 32 * sizePerUnit , 0 , 0 , 0 , true)
					call SetImageColor(img , r , g , b , a)
					call StoreInteger(udg_TextSplatCache , ref , "Image" + I2S(count) + "Line" + I2S(lnr) , H2I(img))
				endif
				call StoreInteger(udg_TextSplatCache , ref , "Letter" + I2S(count) + "Line" + I2S(lnr) , temp)
				set count = count + 1
			endif
		endif
		set i = i + 1
	endloop
	call StoreInteger(udg_TextSplatCache , ref , "LetterCount" + I2S(lnr) , count)
	call StoreInteger(udg_TextSplatCache , ref , "LineWidth" + I2S(lnr) , curWidth)
	call FlushStoredInteger(udg_TextSplatCache , ref , "StartIndex" + I2S(lnr))
        if ( curWidth > maxWidth ) then
		set maxWidth = curWidth
	endif
        set overall = overall + count
        set lnr = lnr + 1
	call StoreBoolean(udg_TextSplatCache , ref , "Visible" , true)
	call StoreString(udg_TextSplatCache , ref , "Font" , font)
	call StoreInteger(udg_TextSplatCache , ref , "Size" , size)
	call StoreInteger(udg_TextSplatCache , ref , "Valign" , valign)
	call StoreInteger(udg_TextSplatCache , ref , "Halign" , halign)
	call StoreInteger(udg_TextSplatCache , ref , "DefaultColor" , color)
	call StoreInteger(udg_TextSplatCache , ref , "LetterCount" , overall)
	call StoreInteger(udg_TextSplatCache , ref , "LineCount" , lnr)
	call StoreInteger(udg_TextSplatCache , ref , "MaxWidth" , maxWidth)
	call StoreReal(udg_TextSplatCache , ref , "BaseX" , baseX)
	call StoreReal(udg_TextSplatCache , ref , "BaseY" , baseY)
	call StoreReal(udg_TextSplatCache , ref , "OffsetX" , 0)
	call StoreReal(udg_TextSplatCache , ref , "OffsetY" , 0)
	set t = CreateTrigger()
	[B][COLOR="Red"][B]set c = Condition(function ts_UpdateTextSplatPosition)[/B][/COLOR][/B]
	call TriggerAddCondition(t , c)
	call StoreInteger(udg_TextSplatCache , ref , "Dispatcher" , H2I(t))
	call StoreInteger(udg_TextSplatCache , ref , "DispatcherCondition" , H2I(c))
	set bj_enumDestructableRadius = baseX
	set bj_meleeNearestMineDist = baseY
	set bj_groupEnumTypeId = id
	call TriggerEvaluate(t)
	set img = null
	set t = null
	set c = null
	return id
endfunction

Error: Functions passed to Filter or Condition must return a boolean.
Code:
function TextSplatCreateGradient takes string text,real baseX,real baseY,string font,integer size,integer valign,integer halign,integer colorFrom,integer colorTo returns integer
 local integer id= 0
 local trigger t= null
 local conditionfunc c= null
	if ( StringLength(text) <= 0xFF ) then
		set id = ts_CreateTextSplat(text , baseX , baseY , font , size , valign , halign , CreateColorInteger(255 , 255 , 255 , 255))
		set t = CreateTrigger()
		[B][B][COLOR="Red"]set c = Condition(function ts_SetTextSplatColorGradient)[/COLOR][/B][/B]
		call TriggerAddCondition(t , c)
		set bj_groupEnumTypeId = id
		set bj_groupCountUnits = colorFrom
		set bj_forceCountPlayers = colorTo
		call TriggerEvaluate(t)
		call DestroyTrigger(t)
		call DestroyCondition(c)
		set t = null
		set c = null
	endif
	return id
endfunction
 

Kenny

Back for now.
Reaction score
202
ts_UpdateTextSplatPosition and ts_SetTextSplatColorGradient must return boolean.

so:

JASS:
function ts_UpdateTextSplatPosition takes nothing returns boolean // see the boolean at the end..
    return true // or false, but it must return one or the other
endfunction


it can also return stuff like:



Because it is still checking for true or false statements.
 

n00b1l1ty

Lєgєπd of Mysтicfаlcoи
Reaction score
46
Code:
function ts_UpdateTextSplatPosition takes nothing returns nothing
	local string ref = TS_INSTANCE() + I2S(bj_groupEnumTypeId)
	local integer size = GetStoredInteger(udg_TextSplatCache, ref, "Size")
	local integer valign = GetStoredInteger(udg_TextSplatCache, ref, "Valign")
	local integer halign = GetStoredInteger(udg_TextSplatCache, ref, "Halign")
	local integer lineCount = GetStoredInteger(udg_TextSplatCache, ref, "LineCount")
	local string font = "Font::" + GetStoredString(udg_TextSplatCache, ref, "Font")
	local real widthPerUnit = (size * 4.0) / 32.0
	local real heightPerUnit = (size * 4.0) / 32.0
	local real maxWidth = GetStoredInteger(udg_TextSplatCache, ref, "MaxWidth") * widthPerUnit
	local real maxHeight = lineCount * 32 * heightPerUnit
	local integer nrLetters = 0
	local real lineWidth = 0
	local real letterWidth = 0
	local real xOffset = 0
	local real yOffset = 0
	local real curX = 0
	local real curY = 0
	local integer i = GetStoredInteger(udg_TextSplatCache, ref, "StartIndex")
        local integer count = 0
	local integer cur = 0
	local integer j = 0
	loop
		exitwhen count == lineCount
		set j = 0
		set xOffset = 0
		if (valign == 0) then
			set curY = bj_meleeNearestMineDist - yOffset // otherwise +
		elseif (valign == 1) then
			set curY = bj_meleeNearestMineDist + ((lineCount / 2) - count) * 32 * heightPerUnit // otherwise (lineCount / 2) - (lineCount - count)
		else
			set curY = bj_meleeNearestMineDist + (lineCount - 1) * 32 * heightPerUnit - yOffset
		endif
		set cur = GetStoredInteger(udg_TextSplatCache, ref, "StartIndex" + I2S(i))
		set lineWidth = GetStoredInteger(udg_TextSplatCache, ref, "LineWidth" + I2S(i)) * widthPerUnit
		set nrLetters = GetStoredInteger(udg_TextSplatCache, ref, "LetterCount" + I2S(i))
		loop
			exitwhen j == nrLetters
			set letterWidth = GetStoredInteger(udg_TextSplatCache, font, "Width" + I2S(GetStoredInteger(udg_TextSplatCache, ref, "Letter" + I2S(cur) + "Line" + I2S(i)))) * widthPerUnit
			if (halign == 0) then
				set curX = bj_enumDestructableRadius + xOffset
			elseif (halign == 1) then
				set curX = bj_enumDestructableRadius + (maxWidth / 2) - (lineWidth / 2) + xOffset
			else
				set curX = bj_enumDestructableRadius + maxWidth - lineWidth + xOffset
			endif
			call SetImagePosition(I2Img(GetStoredInteger(udg_TextSplatCache, ref, "Image" + I2S(cur) + "Line" + I2S(i))), curX, curY, 0)
			set xOffset = xOffset + letterWidth
			set cur = ModuloInteger(cur + 1, nrLetters)
			set j = j + 1
		endloop
		set yOffset = yOffset + (32 * heightPerUnit)
                set count = count + 1
		set i = ModuloInteger(i + 1, lineCount)
	endloop
endfunction

and

Code:
function SetTextSplatColorGradient takes integer textSplat, integer colorFrom, integer colorTo returns nothing
	local string ref = TS_INSTANCE() + I2S(textSplat)
	local integer r = ColorIntegerGetRed(colorFrom)
	local integer g = ColorIntegerGetGreen(colorFrom)
	local integer b = ColorIntegerGetBlue(colorFrom)
	local integer a = ColorIntegerGetAlpha(colorFrom)
	local integer count = GetStoredInteger(udg_TextSplatCache, ref, "LetterCount")
	local real dr = (ColorIntegerGetRed(colorTo) - r) / I2R(count)
	local real dg = (ColorIntegerGetGreen(colorTo) - g) / I2R(count)
	local real db = (ColorIntegerGetBlue(colorTo) - b) / I2R(count)
	local real da = (ColorIntegerGetAlpha(colorTo) - a) / I2R(count)
	local integer temp = 0
	local integer lines = GetStoredInteger(udg_TextSplatCache, ref, "LineCount")
	local integer letters = 0
	local integer i = 0
	local integer j = 0
	set count = 0
	call StoreInteger(udg_TextSplatCache, ref, "DefaultColor", CreateColorInteger((r + ColorIntegerGetRed(colorTo)) / 2, (g + ColorIntegerGetGreen(colorTo)) / 2, (b + ColorIntegerGetBlue(colorTo)) / 2, (a + ColorIntegerGetAlpha(colorTo)) / 2))
	call ts_FadeCleanup(GetStoredInteger(udg_TextSplatCache, ref, "FadeTimer"), true)
	loop
		exitwhen i == lines
		set letters = GetStoredInteger(udg_TextSplatCache, ref, "LetterCount" + I2S(i))
		set j = 0
		loop
			exitwhen j == letters
			call StoreInteger(udg_TextSplatCache, ref, "Color" + I2S(j) + "Line" + I2S(i), CreateColorInteger(R2I(r + dr * count + 0.5), R2I(g + dg * count + 0.5), R2I(b + db * count + 0.5), R2I(a + da * count + 0.5)))
			call SetImageColor(I2Img(GetStoredInteger(udg_TextSplatCache, ref, "Image" + I2S(j) + "Line" + I2S(i))), R2I(r + dr * count + 0.5), R2I(g + dg * count + 0.5), R2I(b + db * count + 0.5), R2I(a + da * count + 0.5))
			set count = count + 1
			set j = j + 1
		endloop
		set i = i + 1
	endloop
	call StoreInteger(udg_TextSplatCache, ref, "ColorType", 1)
endfunction

and

Code:
function ts_SetTextSplatColorGradient takes nothing returns nothing
	call SetTextSplatColorGradient(bj_groupEnumTypeId, bj_groupCountUnits, bj_forceCountPlayers)
endfunction
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
Did you make the system yourself, or did you download it somewhere? If you downloaded it somewhere, then it's very strange (since noone would be dumb enough to upload a clearly not-working system, would they?)

Seems very, very, very odd that this system wouldn't work, as the TextSplat library being used is made by PitzerMike... He definietly wouldn't upload a system that doesn't work.
 

n00b1l1ty

Lєgєπd of Mysтicfаlcoи
Reaction score
46
I was using normal world editor, and I needed to use this library, so I put code in the map custom script. It was working without any error. When I started to use New Gen, these 2 compile errors showed up...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top