Page 1 of 1

Draw Text Parse Error

Posted: Fri Dec 21, 2012 11:30 am
by wabogenadod
What is wrong with the command:

DrawText(GetAttribute("points","Player",48,48,255,10,255,255,255);

All that happens when i do it is that the pawn can't move and the console just says " :11: Parse error near "
I have declared points in player.ini and I can't see what could be wrong.
Thanks

Re: Draw Text Parse Error

Posted: Fri Dec 21, 2012 12:02 pm
by steven8
wabogenadod wrote:What is wrong with the command:

DrawText(GetAttribute("points","Player",48,48,255,10,255,255,255);

All that happens when i do it is that the pawn can't move and the console just says " :11: Parse error near "
I have declared points in player.ini and I can't see what could be wrong.
Thanks
Should there be another bracket the end?

DrawText(GetAttribute("points","Player",48,48,255,10,255,255,255));

Re: Draw Text Parse Error

Posted: Fri Dec 21, 2012 12:43 pm
by QuestOfDreams
That should be:

Code: Select all

DrawText(toString(GetAttribute("points","Player")), 48,48, 255, 10, 255,255,255);

Re: Draw Text Parse Error

Posted: Fri Dec 21, 2012 1:37 pm
by wabogenadod
QuestOfDreams wrote:That should be:

Code: Select all

DrawText(toString(GetAttribute("points","Player")), 48,48, 255, 10, 255,255,255);
Why "toString()"

What does that do?

Re: Draw Text Parse Error

Posted: Fri Dec 21, 2012 2:32 pm
by QuestOfDreams
toString is a Simkin method, which converts any type of variable to a string.
Why use it? Because the DrawText method expects the first argument to be a string while the GetAttribute method returns an integer value.
The current version of RF also accepts the integer value and converts it internally, but future versions may do a more rigid type checking of parameters, thus it's a cleaner style of scripting.