Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-27-2006, 09:38 PM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
array modifiers

Let's say I have an array:
PHP Code:
this.fuit={"apple","orange","bananna"}; 
and you want to add "pear" to the array.
What would it involve to get the array to look like:
PHP Code:
this.fuit={"apple","orange","bananna","pear"}; 
or
PHP Code:
this.fuit={"pear","apple","orange","bananna"}; 
or
PHP Code:
this.fuit={"apple","orange","pear","bananna"}; 
?

and what is involved in removing an item from an array of strings and having the array self-compress so there are no emty spaces, such as:
before
PHP Code:
this.fuit={"apple","orange","bananna"}; 
and after
PHP Code:
this.fuit={"apple","bananna"}; 
?
Reply With Quote
  #2  
Old 02-27-2006, 09:54 PM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
PHP Code:
varname.add("str");
varname.remove("str");
varname.insert(index"str");
varname.delete(index); 
__________________
Liek omigosh.

Reply With Quote
  #3  
Old 02-28-2006, 05:26 AM
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
Ajira's right, but that doesn't work for multidimensional arrays (yet?)
Reply With Quote
  #4  
Old 02-28-2006, 06:23 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by jake13jake
Ajira's right, but that doesn't work for multidimensional arrays (yet?)
Yes it does, array[index].add() etc.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 02-28-2006, 07:15 AM
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 ApothiX
Yes it does, array[index].add() etc.
Well, I was having problems with it. This is what I meant about the problem of using the standard object stuff on a specific dimension of an array:
Quote:
Originally Posted by Stefan
A well known problem yes, it is not telling the 'parent' (next lower dimension) that it has been updated. That's why it's not displaying the right stuff when being output as string, will check if this can been fixed soon.
Reply With Quote
  #6  
Old 02-28-2006, 07:27 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
That's just visual... the value has changed.
Reply With Quote
  #7  
Old 02-28-2006, 03:24 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
I've never had problems using array[index].add() and such.

Edit: Ah, didn't see Rick's post, but he is right
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #8  
Old 02-28-2006, 10:03 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 ApothiX
I've never had problems using array[index].add() and such.

Edit: Ah, didn't see Rick's post, but he is right
But visually it can be very important.
Reply With Quote
  #9  
Old 03-01-2006, 07:00 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
...why? Do you normally show raw array contents to people?
Reply With Quote
  #10  
Old 03-01-2006, 03:13 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Rick
...why? Do you normally show raw array contents to people?
Who doesn't?!
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:06 AM.


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