ID:166708
 
Ok, i have 2 inventories per mob (contents1 and contents2) and i want to know how to make 2 proc's of which would:
1) Randomly pick 1 item from contents1 and MOVE into contents2
2) Randomly pick 5 items from contents1 1 and MOVE them into contents2

I guess i could just type out the first proc 5 times but still want to know if there is a quicker way. I would be thankful if someone could reply to me with a sample code to number 1 so that i could get under way with the rest of my coding, thanks in advance, Timewiz.
To randomly select from a list you may want to check out pick().

To loop through or repeat an action see while() or for().
Rather than do it five times, try a while statement.

var/count=5
while(count) //while count is more than or equal to one (TRUE)
... //probably make a call to another proc for selecting an item from a list at random, or you could include that part here
count-- //this is the same as count-=1 or count = count - 1


Below will ensure that the action is done before testing the value of count.
var/count=5
do
...
count--
while(count)

The last way this can be done (senseibly) is with a for loop.
for(var/count=5,count>0,count--)
...
In response to Rockinawsome
i need to know how to make icons