Frictional Games Forum (read-only)
Weird error - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Weird error (/thread-20428.html)



Weird error - OriginalUsername - 02-21-2013

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?


RE: Weird error - FlawlessHappiness - 02-21-2013

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


RE: Weird error - OriginalUsername - 02-21-2013

(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..


RE: Weird error - FlawlessHappiness - 02-21-2013

Well it is the for script it is referring to...


RE: Weird error - tonitoni1998 - 02-21-2013

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


RE: Weird error - OriginalUsername - 02-21-2013

(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?


RE: Weird error - Your Computer - 02-21-2013

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.


RE: Weird error - OriginalUsername - 02-22-2013

(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