It's going to be a bit before I can look at parsing the results of "/who" but in the mean time:
1) Copy the text
2) Paste as special / plain whatever into a decent text editor
3) Delete any cruft (ie "Players in this channel:", "(XX Total)" etc.)
4) Do a find & replace to turn ", " into a line-break
5) Clone the names with a tab between them (ie you want each line to be "name"tab"name")
a) Using a spreadsheet program may help with this
b) Simply copy the list there, and copy into another column
c) Then, export as tab-delimited text
6) Save the file that has each player name twice, with a tab between, as "SavedNames.txt" in your data folder.
Optional:
7) If the format was done correctly, you can still add chat log results onto this file if desired.
8) Sorting your file while in a spreadsheet will help with duplicates if you use the results of more than one "/who" command
Edit:
Randomness!
The following function will generate a random number, see if it converts to a valid item, and if so it will return said item if it is tradeable & under the supplied limit parameter in the mall
(and also not 0, as that's what an item not found in the mall returns). If these tests don't all check out, it will start again till it finds one that does.
Code:
item get_rand_item(int limit) {
int rnd;
item rnd_item;
boolean found_one = false;
while (! found_one) {
rnd = 1 + random(5000);
rnd_item = to_item(rnd);
if (rnd_item != $item[none]) {
if (is_tradeable(rnd_item)) {
if (mall_price(rnd_item) <= limit && mall_price(rnd_item) != 0) {
found_one = true;
}
}
}
} // while
return rnd_item;
}
Note; currently, item numbers go up to 4535; don't worry about higher numbers, they will be discarded; if you keep using this script well into the future, you may want to bump up the random(5000) line.