Draw Text Parse Error

Topics regarding Scripting with Reality Factory
Post Reply
wabogenadod
Posts: 18
Joined: Mon Dec 17, 2012 9:59 pm

Draw Text Parse Error

Post 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
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Re: Draw Text Parse Error

Post 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));
Steve Dilworth - Resisting change since 1965!
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Draw Text Parse Error

Post by QuestOfDreams »

That should be:

Code: Select all

DrawText(toString(GetAttribute("points","Player")), 48,48, 255, 10, 255,255,255);
wabogenadod
Posts: 18
Joined: Mon Dec 17, 2012 9:59 pm

Re: Draw Text Parse Error

Post 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?
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Draw Text Parse Error

Post 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.
Post Reply