[SCRIPT] So many errors - 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: [SCRIPT] So many errors (/thread-20276.html) Pages:
1
2
|
RE: So many errors - CarnivorousJelly - 02-13-2013 Ohhh that's what float is. I was a little bit confused; thanks for clarifying RE: So many errors - CarnivorousJelly - 02-14-2013 Fixed; sorry for the accidental thread bump. RE: So many errors - TheGreatCthulhu - 02-14-2013 To add to what others have said - just a quick info on how to read script function "definitions" at the Engine Scripts page, so that you know how to use them in a script. As you know, some functions take one or more input parameters (which are those things between '(' and ')', right after the name of the function), like the FadeOut function you asked about. PHP Code: void FadeOut(float afTime); The meaning of all that is: PHP Code: returnType FunctionName(parameterType parameterName); Or, to connect the two:
PHP Code: FadeOut(2.5); Some functions can return a value which you can then use for something else - you'll recognise them on the Engine Scripts page by the fact that there's something other than "void" in front of them. For example: PHP Code: float RandFloat(float afMin, float afMax); PHP Code: RandFloat(1, 10); This would return a random decimal number between 1 and 10, but that number has to go somewhere to be useful. Think of this function call as a place from which its result (the generated random number) flows out - with that in mind you can use it in place of a parameter to, say, FadeOut: PHP Code: FadeOut(RandFloat(1, 10)); This is the same as before, except that now the result of RandFloat call is passed, so sometimes it might fade out faster, sometimes slower. Finally, there are only 4 data types you really need to be aware about in order to be able to use the engine functions - these are:
PHP Code: void TypesDemo(float a, int b, bool c, string d); PHP Code: TypesDemo(0.5, 256, false, "whatever"); P.S. Note that callbacks (like Script_VisionTrigger from the code a few posts back) are functions you define yourself that are then called by the game when something of interest happens, that is, they aren't function calls - this is why you see the whole "void FuncName(parameters...) {}" construct with them. To get a better grasp of how the game and a map script work together, and to have a better idea about where to put what, see this . |