ID:157260
 
Okay, well, i will copy and paste it, i am getting an error, and i think i know what is wrong...

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.</<></<>
Welcome to the forums. The first thing you'll need to be aware of is the use of <dm> tags, as the snippet you've posted looks horrible without it.

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.

turf
grass
icon = 'grass.dmi'
verb
forage()
var
R = rand(10, 20) //variable R now contains a random number between 10 and 20
if(R <= 15) //R is less than or equal to 15
new/obj/item/food/strawberry(usr) //add a strawberry to the players' contents
else //it's higher than 15
new/obj/item/food/blueberry(usr) //add a blueberry in the same way


//stubs for the strawberry and blueberry objects
obj
item
food
strawberry
blueberry


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!