Thread: commands.rtf
View Single Post
  #5  
Old 03-15-2002, 12:26 AM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
some things you can use in for

1. testing for an element in an array
example:
NPC Code:

if (created) {
this.array={1,2,3,4,5};
this.rnd=int(random(0,10));
if (this.rnd in this array) message yes!;
}



2. checking if a value is between 2 other values
example:
NPC Code:

if (playerenters) {
if (playerx in |0,10| && playery in |32,64|) message Yes!;
}



3. or just testing if a var is exact one of the given values
NPC Code:

if (playerenters) {
timereverywhere;
timeout=.05;
}
if (timeout) {
for (i=0;i<4;i++) {
if (keydown(i) && i in {0,2}) message Pressed up or down;
}
timeout=.05;
}


so here you can test if the player pressed up (0) or down (2) with just one argument...

there are also other possibilities to use in
__________________
No Webhost at the moment
Reply With Quote