[ERROR] Incorrect # of parameters

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

[ERROR] Incorrect # of parameters

Post by metal_head »

Hey, I was wondering what could this mean:
[ERROR] Incorrect # of parameters in command 'DistanceBetweenEntities' in Script 'ObjectivePawn' Order 'execute'
I was trying to edit a script that Juutis and JAy helped me out for. It's for displaying a flipbook, which shows the direction of a pawn on the screen, I now want to make a text instead of a flipbook, but I got this problem, here's the script:

Code: Select all

{

   SCREENX       [0]
   SCREENY       [0]
   TEXT          [lol]

Spawn[ ()
{
   Console(true);
   LowLevel("execute");
} ]

execute[ ()
{
   ThinkTime = 0;

   if(GetEventState("objective1"))
   {
      SCREENX=GetEntityScreenX("ObjectivePawn");
      SCREENY=GetEntityScreenY("ObjectivePawn");
      TEXT=DistanceBetweenEntities("Player", "ObjectivePawn");
      ShowText(0, "", "", TEXT, 6, "", SCREENX, SCREENY, "", 200); 

   }

} ]

}
The script should get the distance between the player and the "ObjectivePawn" entity, which is the pawn, that holds the spcript, but instead of that, when I trigger the trigger "objective1" the game crashes.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: [ERROR] Incorrect # of parameters

Post by QuestOfDreams »

There's a bug in the script command. It currently expects 3 parameters (whereas the manual also specifies a version with only 2 parameters). Workaround:
Instead of

Code: Select all

DistanceBetweenEntities("Player", "ObjectivePawn");
use

Code: Select all

DistanceBetweenEntities("Player", "ObjectivePawn", false);
Will be fixed in the next release.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: [ERROR] Incorrect # of parameters

Post by metal_head »

Thanks QoD, now there are no errors!
Amm... I now wanna ask about this:

Code: Select all

ShowText(0, "", "", TEXT, 6, "", SCREENX, SCREENY, "", 200); 
Am I using the command correctly, because no text appears when I trigger the "objective1" trigger?
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: [ERROR] Incorrect # of parameters

Post by QuestOfDreams »

DistanceBetweenEntities returns a (floating point) number but TEXT should be a string. I suppose that's the problem. Try

Code: Select all

TEXT = toString(DistanceBetweenEntities("Player", "ObjectivePawn", false));
and make sure the font you're using is defined in the menu.ini file.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: [ERROR] Incorrect # of parameters

Post by metal_head »

Thanks QoD, that helped! I didn't know that the variables can be converted to different types.
Just one more thing: How many texels equals one meter :lol: ? No, really, I need to know it so I can try to convert the texels to meters in the game. Is there something speciffic, or I'll have to let my imagination do it :D
Attachments
text.jpg
(51.12 KiB) Downloaded 5 times
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: [ERROR] Incorrect # of parameters

Post by QuestOfDreams »

There is no fixed factor to convert level units to meters as this strongly depends on the scale of your actors.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: [ERROR] Incorrect # of parameters

Post by metal_head »

Oh yeah... I should have though of this in first place. THanks QoD, one more thing's done here!
Post Reply