The random number generated by $my_rand() in my last example will be between 1 and 10. Since it's random (for all intents and purposes), there's a 10% chance of that number equalling one, which is what the if condition checks for. If you have a message and you just want a 10% chance of something being added to that message you can use $iif() as an /if command in the middle of the line. For example:
Code:
on *:Text:-pickup:#:{
if (%choice == $nick) msg $chan $nick chooses to pick up the backpack and finds: a knife, 20 gold, [color:green]$iif($my_rand(1,33) == 1,[color:blue]the extra text here[/color])[/color]
}


I used $my_rand(1,33) there so it will choose a number between 1 and 33, making it roughly a 3% chance of returning 1.