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 12-16-2007, 02:06 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
PHP Code:
temp.lowest=999999;
for (
i:temp.array) {
  if (
i<temp.lowesttemp.lowest=i;

temp.lowest=lowest number
This what you looking for?
Reply With Quote
  #2  
Old 12-16-2007, 02:23 AM
Kyranki Kyranki is offline
Freelance Coder
Join Date: Aug 2007
Location: At the end of the rainbow, in the pot of gold.
Posts: 202
Kyranki is on a distinguished road
Send a message via AIM to Kyranki Send a message via MSN to Kyranki
Quote:
Originally Posted by DustyPorViva View Post
PHP Code:
temp.lowest=999999;
for (
i:temp.array) {
  if (
i<temp.lowesttemp.lowest=i;

temp.lowest=lowest number
This what you looking for?
Then this is what you're looking for.
__________________
Stan.
Reply With Quote
  #3  
Old 12-16-2007, 02:24 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally Posted by Kyranki View Post
Then this is what you're looking for.
That just returns the value of the variable with the lowest value, not the name of the variable. I'd still have to check every variable to see if it matches that value.

EDIT: Came up with a way to do it:

PHP Code:
temp.lowest=999999;
temp.arrayvalue 0;
for (
i:temp.array) {
  if (
i<temp.lowest) {
    
temp.lowest i;
    
temp.lowestposition temp.arrayvalue;
  }
  
temp.arrayvalue++;

Gives the lowest value and its position in the array, which is pretty much just as good since each variable's array position is known.
__________________
Reply With Quote
  #4  
Old 12-16-2007, 05:26 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Googi View Post
That just returns the value of the variable with the lowest value, not the name of the variable. I'd still have to check every variable to see if it matches that value.

EDIT: Came up with a way to do it:

PHP Code:
temp.lowest=999999;
temp.arrayvalue 0;
for (
i:temp.array) {
  if (
i<temp.lowest) {
    
temp.lowest i;
    
temp.lowestposition temp.arrayvalue;
  }
  
temp.arrayvalue++;

Gives the lowest value and its position in the array, which is pretty much just as good since each variable's array position is known.
HOW2SCRIPT
__________________
Reply With Quote
  #5  
Old 12-16-2007, 05:52 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally Posted by cbkbud View Post
HOW2SCRIPT
You're so cool.
__________________
Reply With Quote
  #6  
Old 12-18-2007, 03:59 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Googi View Post
You're so cool.
Thank you, ma'am.
__________________
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 11:05 PM.


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