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-05-2002, 06:30 AM
joseyisleet joseyisleet is offline
Registered User
Join Date: Aug 2001
Posts: 378
joseyisleet is on a distinguished road
Arrays....

-=Josey=-
Ok, I know how to use arrays farely well, but, I've ran into a delima.
NPC Code:

if (playerenters){
this.arrayX={x+1,x+2,x+3,x+4,x+5};
this.arrayY={y+1,y+2,y+3,y+4,y+5};
timeout=.05;
}
if (timeout){
if (playerx in this.arrayX&&playery in this.arrayY){
message Testing...;
}
timeout=.05;
}


This doesn't seem to work right for me. Maybe I'm doing it wrong or maybe I done it right in this thread. I'm at work and yet to test it. Thanks for any help.
__________________
Account used by Josey and Howard.
Ali G: 'Is it cause i Black?'
Reply With Quote
  #2  
Old 03-05-2002, 08:23 AM
Phenom1K Phenom1K is offline
Registered User
Join Date: Dec 2001
Location: Somewhereoffthecoastof, Paradise
Posts: 138
Phenom1K is on a distinguished road
Send a message via AIM to Phenom1K Send a message via Yahoo to Phenom1K
Dunno, I've never used arrays, but I've seen a script like this that worked:

[code]
if (playerenters){
this.arrayX={x+1,x+2,x+3,x+4,x+5};
this.arrayY={y+1,y+2,y+3,y+4,y+5};
timeout=.05;
}
if (timeout){
if (playerx in |this.arrayX| && playery in |this.arrayY|){
message Testing...;
}
timeout=.05;
}
__________________
The following is a message brought to you in part by JR

The procedding was a message brought to you in part by JR
Reply With Quote
  #3  
Old 03-05-2002, 08:30 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
NPC Code:

if ((playerx in this.arrayX) && (playery in this.arrayY)) {
message Testing...;
}



that should work, im new to the in thing to be honest
__________________
[signature]insert here[/signature]
Reply With Quote
  #4  
Old 03-05-2002, 09:53 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
if (playerx in |this.arrayX| && playery in |this.arrayY|) {
message Testing...;
}
Thats right.

Quote:
Originally posted by screen_name
that should work, im new to the in thing to be honest
I remember when i was new to in, I used to write things like this:
NPC Code:

if (playerx<45&&playerx>35&&playery<25&&playery>15) {
message testing;
}



__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #5  
Old 03-05-2002, 07:08 PM
joseyisleet joseyisleet is offline
Registered User
Join Date: Aug 2001
Posts: 378
joseyisleet is on a distinguished road
-=Josey=-
Thanks everyone. I was just confused using the "in" command. ;D
__________________
Account used by Josey and Howard.
Ali G: 'Is it cause i Black?'
Reply With Quote
  #6  
Old 03-05-2002, 08:30 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
I think all here were wrong

If you do playerx in this.arrayX then it checks if playerx
is in the array (the exact value of playerx, so its only
true if its equal to one of the 5 entries of the array).
To check for a range do
playerx in |x+1,x+5|
Reply With Quote
  #7  
Old 03-05-2002, 09:13 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by Stefan
I think all here were wrong

If you do playerx in this.arrayX then it checks if playerx
is in the array (the exact value of playerx, so its only
true if its equal to one of the 5 entries of the array).
To check for a range do
playerx in |x+1,x+5|
yeah, thats right, becuase most of the time playerx's and playery's have a lot of extra decimal numbers
__________________
[signature]insert here[/signature]
Reply With Quote
  #8  
Old 03-05-2002, 11:11 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Quote:
Originally posted by Kaimetsu


Not a command!
Yeah, a condition, I think its a common scripter habbit to call everything a command...

Quote:
Originally posted by Stefan
I think all here were wrong

If you do playerx in this.arrayX then it checks if playerx
is in the array (the exact value of playerx, so its only
true if its equal to one of the 5 entries of the array).
To check for a range do
playerx in |x+1,x+5|
you could also do:
NPC Code:

int(playerx) in |this.arrayX|


right?
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
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 05:15 PM.


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