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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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