ID:1911794
 
(See the best response by Ss4toby.)
Is there a way to dynamically obtain the initial value of a variable? For example, it is possible to dynamically look up the value of a variable using the vars list. It seems like there is no way to do that with initial() at the moment, but maybe I'm missing something.
Best response
If you're talking about get the initial value of a variable, you can do so with the proc initial (although how it works doesn't seem to fit the rest of DM syntax, at least not to me).

src << "Your hp was [initial(hp}] when you logged in."


You can even do something like this:

var/selectVar = input("Which var?") in vars
src << "[selectVar]'s initial value was [initial(vars[selectVar])] but has now changed to [vars[selectVar]]."
The first thing was not what I was looking for, since I'm specifically asking about dynamic initial. The second thing is though, thanks.