More variable issues

CRSdefiance
08-01-2001, 10:23 PM
About the first problem I came here with...using variables in equations. Well the calculation you gave me for Equator was:

With Equator1
txtStrengthCalc = UCase(txtStrengthCalc)
.Equation = Replace(txtStrengthCalc, "STR", CStr(iStr))
.Calculate
txtStrength = .Result

That works fine for strength and all, but say, if I wanted to calculate using other variables in this, like str*agi, or str/vit, etc, it won't recognize the variable and assigns it a value of zero. How do I get ALL equations I run to recognize ALL variables?

Thinker
08-01-2001, 11:37 PM
It will be hard. You will have to add a Replace line for every variable.
Dim strTemp as String
strTemp = UCase(txtStrengthCalc)
strTemp = Replace(txtStrengthCalc,"STR",CStr(iStr))
strTemp = Replace(strTemp,"AGI",CStr(agi))
strTemp = Replace(strTemp,"VIT",CStr(vit))
...
.Equation = strTemp
This is still easier than writing a full parser.

I think therefore I am... sometimes right. images/icons/wink.gif

CRSdefiance
08-01-2001, 11:45 PM
I had tried something like that but not QUITE like the way you did it. It works now...thanks.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum