Weird coding 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: Weird coding errors? (/thread-30525.html) |
Weird coding errors? - goalreadymc - 09-07-2015 Hi, I'm trying to script my HPS file and I keep getting weird crashes when I open my custom story, so I was wondering if anybody can check my code. Thank you! Code: void OnStart() RE: Weird coding errors? - Mudbill - 09-07-2015 You're using double-slash instead of brackets? What? No, a function looks like this: PHP Code: void MyFunc() Not this: PHP Code: void MyFunc() Not sure where you got this from but that's your crash at least. RE: Weird coding errors? - 7heDubz - 09-07-2015 For debugging your own code you can take the error code and find the corresponding (12,36) (line, character) is you get a line and a 0 for example, (12,0), try checking the line of code before it the one it returned with. But yeah, you were way mistaken, the double forward slash is used for commenting lines of code. Brackets contain groupings of code such as the kind you find in a function. RE: Weird coding errors? - SwingsDarkCreeps - 09-07-2015 hi, so this: //(double slash)- corresponds at commentaries inside the script(like 7he Dubz said before); {}(brackets)-corresponds at function branch or offshoot (like Mugbill said before); A functions usually start with a bracket and end with another bracket(exceptions if you don't use break function) like this: void TheSpecificCallbackFunction(...) { here you write the code; } that is the general structure of a function; |