 |
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: Wed May 24, 2006 2:09 am
#FORALL |
Is there a way to end a loop early? What I want to do is use #FORALL to loop through a record to see if an entry is there already. If it isn't, it will add the value to the record. But if it is, there is no point to continuing the loop. I know I can just let it go over the whole record and set a flag to be true if it is found, but I would prefer to not waste memory.
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4752 Location: Pensacola, FL, USA
|
Posted: Wed May 24, 2006 2:33 am |
#ABORT
|
|
_________________ Discord: Shalimarwildcat |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed May 24, 2006 3:49 am |
You are wanting to loop through the keys of a datarecord variable to see if the key exists, or am I not understanding correctly? This could be better accomplished with an #IF and an %iskey(). %iskey() works just like %ismember() does for stringlists.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: Wed May 24, 2006 11:42 am |
It's more of looping through the values a key has than the keys themselves. In more detail, I'm going to try to record the creatures in an area, with the area being the key, so basically an #addkey area creature1, #addkey area creature2, etc, etc. But I don't want repetition for the current area, so I am going to loop through the values already in the key first and if it exists in the key already, it won't add it.
I know I can probably use a database for this, but I've never had much success with database usage and it is only a temporary thing. |
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Wed May 24, 2006 1:48 pm |
#ADDKEY
... Key must be unique. Any existing value for the given key is replaced with the new value ...
So shouldn't have to loop through and check, since you can't create duplicates anyway. |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
 |
|
|