Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Game Programming > More variable issues

Thread Tools Display Modes
Old 08-01-2001, 09:23 PM
Posts: n/a
Default More variable issues

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))
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?

Reply With Quote
Old 08-01-2001, 10:37 PM
Thinker Thinker is offline
Iron-Fisted Programmer

Retired Moderator
* Guru *
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
Default Re: More variable issues

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. [img]images/icons/wink.gif[/img]
Posting Guidelines
Reply With Quote
Old 08-01-2001, 10:45 PM
Posts: n/a
Default Re: More variable issues

I had tried something like that but not QUITE like the way you did it. It works now...thanks.

Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..