HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Concentrating Strings Problem

08-13-2005, 10:14 PM#1
shadow1500
it seems that when u concentrate a string with a % (precentage mark) it will return a very wierd value:

it says
Quote:
Poison Resistance +30
57 2.591602E-308xtra Gold From
but shud say
Quote:
Poison Resistance +30%
57% Extra Gold from monsters
any idea how can i fix it?

here is the function that i use
Quote:
Originally Posted by Code
function GetSuffixDisplayName takes integer bonustype, integer amount returns string
local integer temp = R2I(amount*0.25)
local integer temp2 = R2I(amount+(amount*0.25))
local integer temp3 = amount*5
local string amount2 = I2S(amount)
if bonustype == 2 then
return "Life +"+amount2
...
...
elseif bonustype == 40 then
return amount2+"% Extra Gold from monsters"

...
...
endif
endfunction
this isnt caused by the multiboard, or any other functions.
08-15-2005, 08:44 AM#2
EdwardSwolenToe
Quote:
elseif bonustype == 40 then
return amount2+"%"+ "Extra Gold from monsters"

Try that.
08-16-2005, 01:53 AM#3
shadow1500
doesnt work,
Quote:
" "+amount2+"% "+" "+"Extra Gold from monsters"
doesnt work either, i was thinking of maybe there is a way to use a % without acctualy using it, like Chr(x) or something like that.
08-16-2005, 06:53 AM#4
EdwardSwolenToe
Try putting a 'colour' infront of the %, maybe one that cant really be noticeable. like |nccff % |r something like that?
08-17-2005, 09:12 PM#5
shadow1500
nothing seems to work, i guess that the % symbol is used to describe a certain value in the game and will always get replaced...
08-19-2005, 08:01 PM#6
Vexorian
Don't use % on the Custom script section, it is safe to use it on a custom trigger but using it on the custom script secton makes world editor replace it with funny, random values.

I think I forgot to say a word about this bug?

08-20-2005, 12:03 AM#7
PitzerMike
You have to escape it with a second % character.

So having "5%%" in your code will give you 5% in game.
08-21-2005, 01:13 AM#8
shadow1500
yay thx it works
08-22-2005, 12:01 AM#9
Vexorian
Quote:
Originally Posted by PitzerMike
You have to escape it with a second % character.

So having "5%%" in your code will give you 5% in game.

obvious c rule I forgot.

It is lame that this doesn't happen with custom text triggers. They just forgot to check for percentages on custom script section? that's funny