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.
Error: Functions passed to Filter or Condition must return a boolean.
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