• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] The "%" character

Status
Not open for further replies.
Level 6
Joined
Jun 20, 2005
Messages
108
I'm trying to use this function:
JASS:
call DisplayTimedTextToForce( p_force, 20.00, "|cffffcc00You picked a Random Hero. You will receive 2 healing potions now and 50% bonus gold each wave." )

but when I run the function, it displays "You picked a Random Hero. You will receive 2 healing potions now and 50 bonus gold each wave."

it should be "50% bonus"

what am I doing wrong?
 
Level 10
Joined
Mar 31, 2009
Messages
732
In some languages, % is a reserved character for wildcard or control, I guess based on what Shadow Daemon said, in JASS it is control (eg %n for newline?).

I'm still learning JASS myself, but take php for example, and backspace. In php, strings enclosed in double quotes are checked for any special characters, and processed.
If you write:
Code:
echo 'blah \n blah';
The output will be:
blah \n blah

If you write:
Code:
echo "blah \n blah";
The output will be:
blah
blah
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
In jass % is no reserved char. (ok there is one(?) function that uses %s. and in the game interface)
But there is a bug that single % will removed in the header.
So in the header you have to write two %. In your trigger on %.
(I dont know what you have to do in libraries but i think one % should enough there)
 
Status
Not open for further replies.
Top