Frictional Games Forum (read-only)
If All Candles Inactive, Fade To Black Script? - 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: If All Candles Inactive, Fade To Black Script? (/thread-21388.html)

Pages: 1 2


RE: If All Candles Inactive, Fade To Black Script? - Tomato Cat - 05-04-2013

Specifically what?


RE: If All Candles Inactive, Fade To Black Script? - CarnivorousJelly - 05-04-2013

(05-04-2013, 03:52 PM)FurtherGames Wrote: Doesn't seem to be working. I keep getting fatal errors

A couple questions:
1. Do you have a dev environment set up?
2. Are you using the dev environment to test changes?

Alright, if the answer to both of those is yes then do this:

- Remove the script file from the map's folder (put it on your desktop for now) so that it won't run
- Launch Amnesia in window mode and load your map
- DO NOT CLOSE AMNESIA just minimize to go to your desktop
- drag your script file into the map folder again
- Reload the map (using the Quick Map Reload button)
- Tell us exactly what the error says

Having the map open before you start scripting will cause the game to just bark an error at you, but it won't crash Amnesia. Instead of having to relaunch each time something happens, you just close the error window and click the reload button once you think you've fixed the script


RE: If All Candles Inactive, Fade To Black Script? - OriginalUsername - 05-04-2013

I'm not sure what the difference between === and == is.. I took a online course and they said I had to do ===


RE: If All Candles Inactive, Fade To Black Script? - Tomato Cat - 05-04-2013

I've seen === in JScript before. Though precisely what it does escapes me.


RE: If All Candles Inactive, Fade To Black Script? - TheGreatCthulhu - 05-05-2013

In languages like AngelScript, C/C++, Java, C#, etc, there's only the == comparison operator.
They make an important distinction between the assignment operator (=), and the comparison operator (==). Assignment is used to assign values to variables, like in:
PHP Code:
int remainingPuzzlePieces 5

In almost every case, it is an error to use the = operator in an if-statement. For example, if you wrote:
PHP Code:
if (remainingPuzzlePieces 3)
{
    
// do something ...


it would NOT check if the value is 3, but it would assign the value of 3 to the variable, instead, the whole assignment expression would evaluate to true or false, in a language-specific way. For example in C++, the whole remainingPuzzlePieces = 3 thing would evaluate to the number 3, as if you've written if(3); and in C++ any non-zero value is treated as true - so it transforms to if(true), which means that it will always execute.
I'm not sure how AngelScript treats this case, but you could write a simple function to check.

Now, those were all so-called statically typed languages. In dynamically typed languages, values can easily "transform" into one another. You can put a string into a variable that held a float, or an int, things like that. This is common in scripting languages, often used with games, but it's not the case with AngelScript.
Both the == and === operators appear in the languages of this other kind, and they have a slightly different meaning.

For example, in PHP, unlike in AngelScript:
5 == "5" evaluates to true ("5" is converted (cast) to 5, and then they are compared)
5 === "5" returns false, since the left one is a number 5, and the right one is a string (text) "5"; but
5 === 5 evaluates to true.

So, === of PHP is more akin to == in AngelScript. It takes type information into consideration.


RE: If All Candles Inactive, Fade To Black Script? - Statyk - 05-05-2013

Just a tip. Next time make a single thread containing all your questions instead of making a bunch of different ones and pushing other threads down...


RE: If All Candles Inactive, Fade To Black Script? - Tomato Cat - 05-05-2013

(05-05-2013, 12:22 AM)TheGreatCthulhu Wrote: For example, in PHP, unlike in AngelScript:
5 == "5" evaluates to true ("5" is converted (cast) to 5, and then they are compared)
5 === "5" returns false, since the left one is a number 5, and the right one is a string (text) "5"; but
5 === 5 evaluates to true.

That's what it was! =p

Anyhow, I checked whether or not a non-zero value returns true and the compiler threw an error at me and demanded a boolean operator.


RE: If All Candles Inactive, Fade To Black Script? - PutraenusAlivius - 05-05-2013

If you ever wonder, check this thread out.