Frictional Games Forum (read-only)
Syntax for case-switch? - 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: Syntax for case-switch? (/thread-15153.html)



Syntax for case-switch? - FragdaddyXXL - 04-29-2012

What is the syntax for a case & switch structure? Having trouble finding it.



RE: Syntax for case-switch? - palistov - 04-29-2012

Here's the section on switch-case structures from the AngelCode documentation.

http://www.angelcode.com/angelscript/sdk/docs/manual/doc_script_statements.html#if


As far as I know AngelCode doesn't support case identifiers beyond integers. For example, I'm pretty sure you can't use case 'j' like you could in native C++.

Note that you will want to end each case code block with a break; -- unless you want to continue through the rest of the cases. You can exclude the break; statement if you wanted to make a cascading code block which adds extra code based on which value is input, but that's a little more semantically advanced than would normally be needed for something like an Amnesia custom story.


RE: Syntax for case-switch? - FragdaddyXXL - 04-29-2012

Alright! Thank you very much.