What means this error???

Topics regarding Scripting with Reality Factory
Post Reply
Kite_eop
Posts: 1
Joined: Sat Oct 18, 2008 5:16 pm

What means this error???

Post by Kite_eop » Sat Oct 18, 2008 5:30 pm

hello everybody! well, i make a scripted player but when I touch the key 16 skips the following error
ERROR Scripts/Kite.s/Normal:162 Method (something xD) not found*

this is the order of the keypressed
if (IsKeyDown(16))
{
self.think("NormalSword");
}
}]


And this is the order "NormalSword"
NormalSword[()
{
walkmove(self.current_yaw+DIR, VEL );
self.yaw_speed=9999;
self.current_yaw=self.ideal_yaw;
ChangeYaw();
PlayerRender(false);
Kite.PawnRender(false);
KiteSword.PawnRender(true);
if (self.IsFalling=true)
{
self.think="FallingwithSword";
}
else
{

(... the rest of the script)

I dont know what happens please help!!

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: What means this error???

Post by Juutis » Sat Oct 18, 2008 9:18 pm

Kite_eop wrote:self.think("NormalSword");
Should be:
self.think = "NormalSword";

***EDIT***
Welcome to the forums, mate. :)
Last edited by Juutis on Sun Oct 19, 2008 12:39 am, edited 1 time in total.
Pain is only psychological.

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: What means this error???

Post by metal_head » Sat Oct 18, 2008 9:24 pm

Sorry for interrupting,not that I'm using theese commands yet,but I want to ask.

When do I write

Code: Select all

self.think("NormalSword");
and when do I write

Code: Select all

self.think = "NormalSword";
and what's the difference? Just..i've seen theese in scripts and I've always asked myself about that.

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: What means this error???

Post by Allanon » Sat Oct 18, 2008 9:38 pm

Don't really know this scripting language but I am a programmer and it seem the difference is:

Code: Select all

self.think("NormalSword");
self.think is a function and "NormalSword" is a parameter being passed to the function self.think.

Code: Select all

self.think = "NormalSword";
self.think is a variable and "NormalSword" is being assigned to self.think.

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: What means this error???

Post by metal_head » Sat Oct 18, 2008 9:58 pm

hmmm,I'm not really sure about that,I'm not a programmer yet,but I have the feeling that this is not a variable.
slef.think is a command,right? I have the feeling that it has something to do with the low level and the high level,but I may be totally wrong.

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: What means this error???

Post by Allanon » Sat Oct 18, 2008 10:45 pm

I just looked at the RF code and it's a lot more complicated than I thought but for simplicity sake you can think of self.think as a variable and every time self.think is assigned a value the RF code will assign that value to the object's Order variable.

Here is the setvalue code from the ControllerObject, I think this code gets called when self.think is assigned a value. Other objects have similar code:

Code: Select all

/* ------------------------------------------------------------------------------------ */
//	setValue
/* ------------------------------------------------------------------------------------ */
bool ControllerObject::setValue(const skString& fieldName, const skString& attribute, const skRValue& value)
{
	if(fieldName == "think")
	{
		strcpy(Order, value.str());
		return true;
	}
	else if(fieldName == "ThinkTime")
	{
		ThinkTime = value.floatValue();
		return true;
	}	
	else if(fieldName == "time")
	{
		ElapseTime = value.floatValue();
		return true;
	}
	else
		return skScriptedExecutable::setValue(fieldName, attribute, value);
}

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: What means this error???

Post by Juutis » Sun Oct 19, 2008 12:42 am

metal_head wrote:Sorry for interrupting,not that I'm using theese commands yet,but I want to ask.

and what's the difference? Just..i've seen theese in scripts and I've always asked myself about that.
The difference is, there's no such command as self.think(). Switching between low level orders is done only with the variable style ('self.think = ...' , or 'think = ...').
Pain is only psychological.

Post Reply