PDA

View Full Version : Novashell Scripting Reference



sirlich
10-19-2009, 03:11 PM
Having some problems with the syntax or parameters of certain calls...

At the moment,

IsCloseToEntity
"boolean IsCloseToEntity(Entity ent, number distance"
and,

IsCloseToEntityByID
"boolean IsCloseToEntity(number entityID, number distance"
I've tried the following and get errors like
-1: no overload of 'Entity:IsCloseToEntityByID' matched the arguments (Entity, Entity, number). Did you forget a parm?
Brain: Unknown LUA error (Invalid return type maybe?) in Entity 2753 (scalpel) : OnMouseRight
-1: no overload of 'Entity:IsCloseToEntity' matched the arguments (Entity, number, number). Did you forget a parm?


if (this:IsCloseToEntityByID(GetPlayer:GetID(), 10)) then

if (this:IsCloseToEntity(GetPlayer, 10)) then

Probably something stupid but I can't figure it out...

Seth
10-20-2009, 03:43 AM
Hmm.. you seem to be using it right, I scanned existing scripts I can see IsCloseToEntity is used in RT_StrongAI\script\ents\turret\turret.lua like this:


if (this:IsCloseToEntity(GetPlayer, m_eyesight))then

Wait..

-1: no overload of 'Entity:IsCloseToEntityByID' matched the arguments (Entity, Entity, number). Did you forget a parm?

You should be sending Entity, number, number here. (The first Entity is covered by the this: part)

And look at this error:
-1: no overload of 'Entity:IsCloseToEntity' matched the arguments (Entity, number, number). Did you forget a parm?

Here, you should be sending Entity, Entity, number.

Is it possible on your test you used IsCloseToEntityByID and IsCloseToEntity in reverse? (Ie, you sent the Entity to the one that wanted the ID and vice-versa?)

What's weird is your example is written right. :confused:

sirlich
10-20-2009, 11:09 AM
...

What's weird is your example is written right. :confused:

Thank's for replying.. and yes it was right... it seems I forgot to put in the "return true;" now it looks like "return"(s) are now my next challenge..

if (this:Data():Get("ObjType") == "action") then
if (this:IsCloseToEntityByID(GetPlayer:GetID(), 100)) then
GetTextManager:Add("Do what???", GetPlayer);
return true;
else
GetTextManager:Add("Need to get closer", GetPlayer);
return true;
end
return true; // Not working... need to find way of returning so that once a object is determined
// to be close enough... that other objects aren't returned the same when they really aren't
end