ID:158647
 
how would i make a variable out of two changing variables??

this is what i thought of and it failed. miserably.

mob
var
q = r-d
r=100
verb
subtract()
var/d = input("How many?") as num
usr.r-=d
stat()
statpanel("Counter")
stat("[r]/100")
..()


the part im having a problem with is the variable "q"
because i want to do this

 verb
subtract()
var/d = input("How many?") as num
usr.r-=d
usr<<"You subtracted [q] and you have [r]/100 left"




any suggestions?? thanks guys
noone?
In response to RanEsu
Vars like your "q" var only work if made as proc/verb vars, if make that kind of var outside of a proc/verb, it doesn't work because the "r-d" isn't processed.
Also, the way you tried to define "q", you tried to access a verb var outside of its verb, which is impossible. Any var defined inside a verb or a proc stays within that verb/proc, it CANNOT directly be used outside of the verb/proc UNLESS you use it indirectly by assigning the var's value to a mob var.

You would need to define the var inside your verb to work.

Like this: (I'll use your substract() verb to show it)

mob
verb
subtract()
var/d = input("How many?") as num
var/q = usr.r-d //define your q var here in stead
usr.r-=d
usr<<"You subtracted [q] and you have [r]/100 left"


But here, I don't see why you don't just use your "d" var to tell the user what they substracted:
usr<<"You subtracted [d] and you have [r]/100 left"