Problem adding a diary page (i'm nooby) - 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: Problem adding a diary page (i'm nooby) (/thread-9911.html) |
Problem adding a diary page (i'm nooby) - Fetishman - 08-22-2011 Hello, I'm making my first real map, and I haven't been able to find ANY tutorials on adding diary entries. So basically, I'm playing it by ear. When I run my map, the error that shows is a fatal error on line 15,28. Here is the segment of code that I have. Note: The name of the diary page is "diarypage1" and the CustomSubItemTypeName is "servantdiary". Some help in this matter would be appreciated. RE: Problem adding a diary page (i'm nooby) - Your Computer - 08-22-2011 Your main issue deals with syntax errors. In order to help you solve your own problems, you would have to learn how to properly define a function, how to properly declare variables, how to properly call a function, et cetera; pretty much, you'd have to learn a few things about programming. I'm not going to try to teach you everything (since there are better places to learn from than from me), but i'll mention a couple of things. Variables Think of a variable as a container for data. Each variable contains a specific type of data (search "data types"). A valid variable name consists of letters, which could also include either underscores (_) and numbers. When storing information in a variable, you must specify the type of data you're storying (again, see "data types"). Example: Code: int number = 0; Functions A function can be considered a group of statements that can be executed by calling the function. A function can be declared with or without parameters. Parameters are a comma-delimited list of expressions. An expression is basically a line of code to be executed (usually ending with a semicolon). Functions can also return a certain data type. Example functions: Code: // Without parameters Calling one of the example functions: Code: int state = function_name("object_1", 1); In any given script, there cannot be two functions with the same name with the same return type and with the same kind of parameters. This confuses the parser (or compiler) and will toss out an error. The HPL2 engine (the engine of Amnesia) already has functions reserved for use. Overriding these functions will confuse the engine. Try to figure out what you did wrong. RE: Problem adding a diary page (i'm nooby) - JetlinerX - 08-22-2011 Hint: You have more info than you need in each of the peramaters. Take a look at this, and compair it to yours: (DO NOT USE THIS CODE, IT WONT WORK FOR YOU) Code: void FirstScriptArea(string &in asParent, string &in asChild, int alState) Now try to see what is different besides the obvious difference in code. RE: Problem adding a diary page (i'm nooby) - Fetishman - 08-22-2011 (08-22-2011, 05:06 AM)JetlinerX Wrote: Hint: Thanks for your initial reply! I have made a few changes after looking thought what you have said. This is what I have: Code: void SetEntityCallbackFunc("diarypage1", "OnPickup") Now the error says that it is "Expected data type." Does this mean I have to indicate whether it is int, f, bool, or string?[/code] |