• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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 11
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
543
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