由于不知道zmud里取list的长度和成员的方法,所以写的比较麻烦,但还是可以实现的。供参考~
↓
先定义一个变量idhere,用来存放id
#var idhere "";
做触发,获得当前房间的id,取到的id赋给str,然后用下面的方法加到idhere里
#var idhere %additem(str,@idhere);
取得idhere里的id个数赋予idherecnt
#var idherecnt 0;#FORALL @idhere {#math idherecnt @idherecnt+1;};
取得1~idhere长度的一个随机数(1共5个人的话,取出来的是1~5,不取0),赋予idrandom
#math idrandom %random(1,@idherecnt);#show idrandom=@idrandom;
用上面取得随机数,取出idhere中的一个值,并且赋给了randomid,randomid里就是楼主想要得东西。
#var roocnt 0;#FORALL @idhere {#math roocnt @roocnt+1;#if @roocnt=@idrandom {#var randomid %i;}};