Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If All Candles Inactive, Fade To Black Script?
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#11
RE: If All Candles Inactive, Fade To Black Script?

Specifically what?
05-04-2013, 07:01 PM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#12
RE: If All Candles Inactive, Fade To Black Script?

(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

[Image: quote_by_rueppells_fox-d9ciupp.png]
(This post was last modified: 05-05-2013, 09:15 PM by CarnivorousJelly.)
05-04-2013, 07:49 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#13
RE: If All Candles Inactive, Fade To Black Script?

I'm not sure what the difference between === and == is.. I took a online course and they said I had to do ===
(This post was last modified: 05-04-2013, 09:40 PM by OriginalUsername.)
05-04-2013, 09:40 PM
Find
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#14
RE: If All Candles Inactive, Fade To Black Script?

I've seen === in JScript before. Though precisely what it does escapes me.
05-04-2013, 11:48 PM
Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#15
RE: If All Candles Inactive, Fade To Black Script?

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: (Select All)
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: (Select All)
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.
(This post was last modified: 05-05-2013, 12:32 AM by TheGreatCthulhu.)
05-05-2013, 12:22 AM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#16
RE: If All Candles Inactive, Fade To Black Script?

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...
05-05-2013, 01:40 AM
Find
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#17
RE: If All Candles Inactive, Fade To Black Script?

(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.
05-05-2013, 01:56 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#18
RE: If All Candles Inactive, Fade To Black Script?

If you ever wonder, check this thread out.

"Veni, vidi, vici."
"I came, I saw, I conquered."
05-05-2013, 11:11 AM
Find




Users browsing this thread: 3 Guest(s)