You could use a recursive function call instead of the @foreach.
It have been a very long time since I did any tux coding, but the
principle would be to create a function that took as parameters:
1. The number you were looking for.
2. The list of child objects.
The function looks at the list of child objects. If it is empty, then
the number hasn't been found, so return #-1.
Otherwise, use the first() item in the list of child objects, and
match() on the number attribute. If this is found, the function returns
the object id.
If it isn't found, then the function calls itself with the number you're
looking for, and rest() of the list of objects.
There's some trickery needed so you don't always evaluate the rest()
part, but I don't remember this in enough detail to give you an example.
Another way of tackling this problem would be to build a list of numbers
from children, then do a single match on that, and use the index of the
match to get back to the child object id.
Hope that helps a bit,
Mark
(aka Mark Farrell @ ATS a long long time ago)
Apparently it stripped out something. lsearch(all or lsearch(player if it owns all the cell phones
Guess who is used to PennMUSH? That's right, ME!
You want 'help search()' for syntax and all that jazz.
And probably something like:
@va generic_cellphone=$CALL *:Th Pemit(%#,If(Search(all ething=\[match(%0,get(##/NUMBER))\]),Works,Doesn't work))
works, while EThings doesn't, since it says there is no such thing. So I
think what you wanted to put was eval, which evaluates each object. But
still, although I know a cellphone with the number 1 exists, this piece of
code,
>@va generic_cellphone=$CALL:Th
>Pemit(%#,If(Search(eval=match(1,get(##/NUMBER))),Works,Doesn't work))
won't work. I've tried the \['s and \]'s, but they don't make a difference
either.
---
Contact info:
Skype: parham-d
MSN: fire_lizard16 at hotmail dot com
email: parham90 at GMail dot com
----- Original Message -----
From: "A Character" <a_cha...@hotmail.com>
To: <tin...@googlegroups.com>
Sent: Friday, July 04, 2008 12:52 PM
Subject: [TinyMUX] Re: @Foreach Question
> works,say doesn't work)=