![]() |
[SPOILER] Some Script-Problems - 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: [SPOILER] Some Script-Problems (/thread-20257.html) |
Some Script-Problems - BlueRsX - 02-09-2013 Hey Guys! Im working on a custom story in Amnesia. So I've watched tutorials and guides, on the wiki too. So... For my map I need some scripts and functions. And I dont find it so easy to write them, so I've copied the "Door-Smash"-Code from the Wiki. Thanks for it! So heres my question: I have a code. How can I write 2 codes one after another? I tried just to seperate them with a } one after another, but I got every time an error like "ERROR" "Unexpected end of file" or something. I will post the code here for you: Quote://////////////////////////// So heres the error, if i dont put the } between[/quote]: http://prntscr.com/s3vwb Can someone tell me what is wrong or how can i save to scripts without an error? Thank you! -Blue ![]() RE: Some Script-Problems - NaxEla - 02-09-2013 You can also put Code: SetEntityPlayerInteractCallback("door1", "func_slam", true); Your OnStart function will look like this: PHP Code: void OnStart() RE: Some Script-Problems - The chaser - 02-09-2013 The good script should be like this: Code: //////////////////////////// RE: Some Script-Problems - BlueRsX - 02-09-2013 @NaxEla Thank you guys very much! But what was the mistake in my code? What is the connection-Problem beteween both? RE: Some Script-Problems - palistov - 02-09-2013 You can't do what you're trying to do. The braces { } enclose blocks of code. That second set of code you're trying to include must be put into a new function. So if you want to run func_slam and then the "second" piece of code separately, put the second piece into "func_slam2" or some other function of your choice, and run it separately from the other code. RE: Some Script-Problems - BlueRsX - 02-09-2013 Okay Thx! And a last question: So I can just separate 2 codes, when I leave spaces between them? Is it so easy? RE: Some Script-Problems - palistov - 02-09-2013 Yeah everything in a block of code will run unless you direct it otherwise with other statements, which I won't get into. Just remember that whatever is between the braces will be run when the function is called. RE: Some Script-Problems - BlueRsX - 02-09-2013 Thank you, but I think im the stupidest person on the world ![]() So I need a bit help with this code... I wanna make a closed door, wich I have to open with a key. Code: void OnStart() So everything works... Thank god! Then I wanna make this "breakdown" of this door for a scary moment. Ive got the script and everythings fine. So I tried to insert that "breakdown" code in the .hps file. Im not sure how to insert it, because I get every time an error! I tried it like this: Code: void OnStart() But I always got an error. The programm says: Could not load script blablabla: (20,5):ERR: Unexpected token { So I just deleted this "{" But another error: (22,5) expected , or ; (23,22) expected identifier (23,81) expected identifier (24,21) expected identifier (26,1) unexpected token } Then I just tried to copy the 2nd code just behind the 1st with and without braces, but it allways errors... I just cant understand why it cant work! Help again? I know Im annoying ![]() RE: Some Script-Problems - BlueRsX - 02-10-2013 Ok Ive got everything! Thank you! |