[SCRIPT] Selection From a List? - 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] Selection From a List? (/thread-28106.html) |
Selection From a List? - BonesTheRabbit - 12-20-2014 I'm trying to think of how to code a selection from a list. Something like this, I suppose: Code: void somefunction() Of course, that's not valid code. I'm just hoping someone understands what I mean, and can tell me how to achieve this with the HPL2 editor without using repeated if then checks. Any assistance is greatly appreciated. P.S. I am a complete layman when it comes to coding. RE: Selection From a List? - 7heDubz - 12-20-2014 I know what you mean and that should work, never dictionaries though, why not just use a list and get a random integer between 0-biggest number? RE: Selection From a List? - Daemian - 12-20-2014 What you want is an array, it goes like this: Let's say I want to choose a random enemy from a list. This is the code: Spoiler below!
Every time I run that code I get a diff string from the list. RE: Selection From a List? - BonesTheRabbit - 12-20-2014 (12-20-2014, 03:34 PM)Daemian Wrote: What you want is an array, it goes like this: This is exactly what I was looking for. I had forgotten the appropriate term. Thanks very kindly. |