ID:1259701
 
Keywords: pick
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
pick()

has a little-used probability modifier in the form of

prob(P); Val

which is impossible to use with lists except by converting the list members into variables and then feeding the variables into pick(). This limits pick() to choosing between a set of possibilities given a number of defined variables.

example:
var
l[] = list("a"=100,"b"=50,"c"=0)
a = l[1]
ap = l[l[1]]
b = l[2]
bp = l[l[2]]
c = l[3]
cp = l[l[3]]
world << pick(ap;a,bp;b,cp;c)


For lists of variable length, this is untenable since pick()'s format is incompatible with BYOND's list format.

This request is for EITHER support of associated list elements in pick() given a new flag argument:

pick(list("a"=100,"b"=50,"c"=0),prob_flag=1)


OR

the ability to include a separate list of probabilities:

pick(list("a","b","c"),probabilities=list(100,50,0))


OR

an alternative to pick() that can do this (least likely to break backwards compatibility)
I agree.