Frictional Games Forum (read-only)

Full Version: Weird error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to get a door open itself when a player walks trough an area:

Script:
Code:
void OnStart()
{
    AddEntityCollideCallback("Player", "Scriptarea_1", "dooropen", true, 0);
}

void dooropen(string &in asParent, string &in asChild, int alState)
{
    SetSwingDoorDisableAutoClose("mansion_1", true);
    SetSwingDoorClosed("mansion_1", false, false);
    
    for (int i = 0; i = 10; i++)
    {
    AddPropForce("mansion_1", 800, 0, 0, "world");
    }

}

I copied everything from here, so that shouldn't be the problem.
But everytime I try to reload or enter the map, this happens:

main (6, 1) : INFO : Compiling void dooropen(string&in, string&in, int)
main (11, 18) : ERR : Expression must be of boolean type

I've tried everything but I just can't see the error... I used these commands on other maps and they always worked. Could someone help me out?
I'm not sure but i think the for-script should be like this:



for (int i = 0; i = 10; i++) AddPropForce("mansion_1", 800, 0, 0, "world");

And then you need +i somewhere inside AddPropForce
(02-21-2013, 03:52 PM)BeeKayK Wrote: [ -> ]I'm not sure but i think the for-script should be like this:



for (int i = 0; i = 10; i++) AddPropForce("mansion_1", 800, 0, 0, "world");

And then you need +i somewhere inside AddPropForce

That isn't the problem.. I used it this way before and it worked.. It has to be something else or a bug..
Well it is the for script it is referring to...
im sorry, but im curious what you need a loop for. why dont you just let it open when he walks into the area. is there any reason? im just learning right now and maybe this is a special way to do someting and it might get useful for me Smile
(02-21-2013, 07:03 PM)tonitoni1998 Wrote: [ -> ]im sorry, but im curious what you need a loop for. why dont you just let it open when he walks into the area. is there any reason? im just learning right now and maybe this is a special way to do someting and it might get useful for me Smile

It's just a bit more smooth.. AddPropForce just gives it 1 blast.

(02-21-2013, 06:50 PM)BeeKayK Wrote: [ -> ]Well it is the for script it is referring to...

I noticed that, but I got it from this tutorial, and it worked before. I changed nothing. But where do I have to put the i+ then?
The issue is that your for loop has a variable assignment for the second expression where it requires a boolean operator or something that returns true or false.

In other words, for (int i = 0; i = 10; ++i), the bold part is the problem. The assignment operator is not a boolean operator, so it doesn't return true or false. If you had < or <= instead of =, then it would work.
(02-21-2013, 09:43 PM)Your Computer Wrote: [ -> ]The issue is that your for loop has a variable assignment for the second expression where it requires a boolean operator or something that returns true or false.

In other words, for (int i = 0; i = 10; ++i), the bold part is the problem. The assignment operator is not a boolean operator, so it doesn't return true or false. If you had < or <= instead of =, then it would work.

Thank you! It worked right away