turf grass icon = 'grass.dmi' verb forage() pick(10,20) if(<=15) new() usr.contents << strawberry else() new() usr.contents << blueberry
Now i get an error, where i can't define a proc, inside another proc, whati think i am missing, is is retrieving the returned value, and then using it in the if-else statement. also, if you spot something wrong, in the lower part of the code, please let me know, thanks in advance.</<></<>
You've made a pretty common mistake and don't know the syntax just yet. I recommend reading The DM Guide to get a firm grasp on the language first.
Most procs return a value. The rand() proc is no different and it's the one you wanted to use. It returns a number between the two parameters you specify. But without a variable, you can't store the value that is being returned.
Creating a new variable (in this case, one named R) allows you to get the random number. You can then use an if statement to check if R is less than or equal to the number 15. The else statement goes through when the if (and all if/else statements) have failed.
I hope I've sufficiently helped you along. If not, don't hesitate to reply!