Thread: onwall and such
View Single Post
  #38  
Old 05-21-2006, 05:36 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Skyld
If you are using the new engine...
NPC Code:
if (x in {1, 2, 3, 5, 7})

I know
you can also do things like

NPC Code:
if ( (x|y) in |22,42| )



Actually, couldn't you have done that in the old engine too (the former)?

However, let's say you have
NPC Code:
 if ( x in arr ) 


I've had a problem in which my array has to contain multiple values. It can't just contain one value. In my movement functions there's generally multiple parameters in the array, but what if you wanted only one value in the array? I've had to use switch (arr.type()) to cope with the language not being very great with array sizes of 1. Of course it's not really an array if it only has one value, but the fact that it's usually an array, it might make it good to have the in operator behave like == when the right operand contains a single value for better dynamic behavior.

Last edited by jake13jake; 05-21-2006 at 05:47 PM..