ID:178938
 
I am using 2 verbs that allow the player to select a primary and secondary skill. Since the list of skills will be the same I am writing a prcedure to do this and calling it from the verb. The procedure allows them to select the skill and then I want to return the level to the verb so my code would be something like

if choice == "skill1"
return 45

once once I return to the verb how do I set a variable to 45. Does byond store return values in a special variable?





The return value is passed to the proc, I believe, so something like this would probably be what you're looking for:

mob
verb
set_skill_one(var/choice in src.skill_list)
var/result = src.set_skill(choice)
switch(result)
if(45)
...

This will allow a player to select a skill from skill_list and pass it to set_skill(), whcih returns the value to the result variable. The switch statement passes the result variable to the if statements to check for a match, and if found, exacutes the code within that if statement...

~X