ID:163139
 
FirstVar = text2num("[copytext(TempStorage,StartL,StartL+6)]")


Lets say, that the variable StartL+1 to StartL+6, VarB
Also, lets say that VarB = "8"
Now if I wanted to use that to embed the value of VarB into the text2num protocol.
Possible Results: Sorry, I currently have no way to test this!
1. FirstVar = "VarB" (Runtime error?)
2. FirstVar = 8
The result will be null, since <code>text2num()</code> will only evaluate strings that contain numbers. You can't use it to find the value of variables, as you seem to be doing.

If you want to find the value of a variable from a string containing the variable's name, look at the entry for <code>datum.vars</code> in the DM reference.

Something like this would be the general idea:

VarName = copytext(TempStorage,StartL,StartL+6)

if(VarName in vars)
FirstVar = vars[VarName]
else
world << "no such variable: [VarName]"


The variables you try to access must be defined as member variables of the datum or atom. You can't access local or global variables through <code>vars</code> (as far as I know).
In response to Hobnob
Hobnob wrote:
The result will be null, since <code>text2num()</code> will only evaluate strings that contain numbers. You can't use it to find the value of variables, as you seem to be doing.

If you want to find the value of a variable from a string containing the variable's name, look at the entry for <code>datum.vars</code> in the DM reference.

Something like this would be the general idea:

> VarName = copytext(TempStorage,StartL,StartL+6)
>
> if(VarName in vars)
> FirstVar = vars[VarName]
> else
> world << "no such variable: [VarName]"
>

The variables you try to access must be defined as member variables of the datum or atom. You can't access local or global variables through <code>vars</code> (as far as I know).

Thanks! Just so you know however, the value of VarB is a number, but I was under the impression to embed it it had to be put into text format, thus the text2num would simply change it from Text to number