Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
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
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.