I'm trying to compile a list of players in a room by gender via the @sex attribute. I was wondering if anyone knew how to do this via the search() function. I can gather a full list of all players on the game, but I can't seem to figure out how to narrow the search to just one room. Thanks in advance.
It's mushcode, AKA softcode, the Tiny family scripting language.
@Valo, do you want to sort all players by room and gender, or given a specific room dbref sort the players therein by gender?
Probably what you want to do is use the search class EPLAYER. This is a combination of type=Player and eval=<restriction> (see help search classes2). In the restriction the symbol ## gets replaced with the player's dbref, and if the restriction evaluates to true you get the player. So you can test if that player dbref is inside the room you're interested in. Once you have the list of players then sorting by @sex is a second step.
Something like (where you replace room-dbref with the one you want),
But all that said, you probably don't need search() to do this. If you have the dbref, you can get a lcon() of the contents, and sort that. It would be much more efficient since you're not searching the whole DB.