ID:154873
 
Hello,

I recently ran into an issue with using procedures to create universal rules. My question, simply stated, follows: Is it possible to set the original arguments equal to the result of the procedure? For example:
//Quick example
mob/proc
Levelup(EXP,Level)
if(EXP>100)
usr<<"You gain a level."
Level++
.()
//Now that the calculations are done, I want the original parameters to get the values of EXP and Level respectively
mob/verb
IncreaseEXP()
usr.MiningEXP+=100
usr.Levelup(usr.MiningEXP,usr.Mining)


The result of IncreaseEXP() makes 'Level' equal to 2, since Level was equal to usr.Mining which was 1. Since I'm using this for many skills, how would I go about making usr.Mining and usr.MiningEXP, or the universal variables, equal to their corresponding procedural values? Thanks.
You could try using the vars list var. Given the name of your level variable ("Mining"), you can probably do something like this:
// given variable = "Mining" and src is the player

var level = vars[variable] // this grabs the value of the variable

vars[variable] ++ // this increases it