Pick a random active player

gemelli

Member
A recent discussion in G-D featured someone who wanted to give away stuff to players at random -- no contests, no requests, just pure RNG at work. I told him that ASH would be able to help him find active players at random pretty easily, and then figured I ought to just put my money (well, fingers) where my mouth is.

Right now, the script is slow and could probably be improved eight ways from Sunday. I don't really like the "search for a specific month and year in the last login text" approach, but I was going for the quick-and-dirty approach here. Ideally, I'd also add tracking so that the script doesn't check a single ID more than once.

Anyway, it is what it is :) Please feel free to suggest improvements or changes.
 

Attachments

  • RandomActivePlayer.ash
    1.6 KB · Views: 49

Theraze

Active member
Hmm... can you set checked items using a boolean value? something like boolean [int] checked; and set checked[trythis] = true; and when you're setting the new trythis, work based on something like this...
Code:
int trythis = -1;
while (trythis < 1 || checked[trythis] = true) trythis = random(fakeceiling) + lowid + 1);
checked[trythis] = true;
tryme = int_to_string(trythis);
 
Top