Solved - Building an array with numbers 1-4 in random order. - 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: Solved - Building an array with numbers 1-4 in random order. (/thread-13502.html) |
Solved - Building an array with numbers 1-4 in random order. - palistov - 02-22-2012 Hey guys. Got a question for seasoned programmers. I'm trying to build an integer array with the numbers 1-4 in a random order. Having some trouble though. This particular bit of code doesn't have any syntax errors, but I'm worried about the semantics. I ran the function with a debug message listing the order of the array it generates, but the debug message doesn't appear. I tried attaching a second debug message to at least let me know the function terminates, but apparently it just doesn't. I'm pretty sure it's because of the deeply nested while loop. Any suggestions on what I can do it get around this? Here's the code PHP Code: void OnStart() RE: Building an array with numbers 1-4 in random order. - Your Computer - 02-22-2012 Turns out AngelScript doesn't automatically resize the array: http://www.frictionalgames.com/forum/thread-10484-post-94394.html#pid94394 RE: Building an array with numbers 1-4 in random order. - palistov - 02-22-2012 I actually got it to work. It was because I started from index 1 when inserting the integers into the builder array instead of index 0. Didn't intend to automatically re-size, regardless of support. It's always the little things...... |