mob/verb
Change()
var/var1 = 0
changeVar(var1)
world << "[var1]"
proc
changeVar(var/variable)
variable = 2
The output always gives me 0, meaning it didn't change at all.
If you declare a var in a proc, how do you change that var within another proc?
mob/verb The output always gives me 0, meaning it didn't change at all. |
Jan 4 2015, 2:41 pm
Best response
|
|
Unfortunately this is not possible in DM. Variables scoped to a function cannot be modified within another function unless the second function returns a value back to the first function.
|
Ahhhh I thought so. I really didn't want to use return, so I guess I'll have to simply used a predeclared var. Thanks for the help.
|
You'd want to use return values
mob/verb EDIT: I realize LA provided the same answer that I did, but I still feel the need to ask this regardless. What are you doing that you need to change a variable in a different function? Why can't you cover it in the same function or use a return? |
mob I declared a var called mixed before the switch statement. ATM it says C.mixed but its because I just made cauldrons have a mixed var. |