Psudeo code:
Code: Select all
INPUT "Variable Name: ", Name$
Let Variable = VariableName(Name$) ' this is the psudeo code (ex a function)
Print Variable
Code: Select all
INPUT "Variable Name: ", Name$
Let Variable = VariableName(Name$) ' this is the psudeo code (ex a function)
Print Variable
Code: Select all
DECLARE FUNCTION ReturnVarName(Var AS STRING) AS STRING
INPUT "Variable Name: ", Namer$
Variable$ = ReturnVarName(Namer$)
PRINT Variable$
SLEEP
FUNCTION ReturnVarName(Var AS STRING) AS STRING
ReturnVarName = Var
END FUNCTION
This almost sounds like a debugging function within a program where you can monitor the value of a given variable by issuing its name.PQBC wrote:Is there a way in QBasic that if I put a prompt in for a variable name, it will make the variable appear?
Psudeo code:[/code]Code: Select all
INPUT "Variable Name: ", Name$ Let Variable = VariableName(Name$) ' this is the psudeo code (ex a function) Print Variable
Code: Select all
INPUT "Variable Name: ", VName$
SELECT CASE VName$
CASE "VarA": print A
CASE "VarB": print B
CASE "VarC": print C
CASE ELSE
print "Variable name unknown"
END SELECT
Code: Select all
A=100
input A
Code: Select all
INPUT "Varible name?", hi$
(the string in hi$ would be the name of this varible) = blah blah blah
I don't want to have a huge chain of SELECT CASEs in this sub either. It would be a waste of space, since ECLIPSE doens't need it anyway.I want the screen to have wrote:Variable name? RED <RED as an example
The variable RED has a value of 555. (after this is totally optional) Change it? (y/n) y
To what value? 147
Code: Select all
INPUT "varible:", varible
OPEN "code.bas" FOR OUTPUT AS #1
Writethisstring = "hivar" + " = " + Varible"
Writethisalsok = "OPEN "var.txt" FOR INPUT AS #1: WRITE #1, hivar: CLOSE #1"
WRITE #1, Writethisstring
WRITE #1, Writethisalsok
CLOSE #1
SHELL "QBASIC.EXE /run code.bas"
OPEN "var.txt" FOR INPUT AS #1: INPUT #1, varvalue
Code: Select all
changevariable playerX, 2
changevariable money, 40000
Code: Select all
dim shared vars(100) as integer ptr
vars(0) = @playerx
vars(1) = @playery
vars(2) = @playerHP
'etc
Ok, let's put this problem into perspective. How many variables are you talking about, 20 or 30? If you're talking about hundreds, then maybe we need to think about a more sophisticated approach.PQBC wrote:.....
I don't want to have a huge chain of SELECT CASEs in this sub either......
Code: Select all
wanted_function$ = "Getval_"+str(someNumber)
libhandle = DYLIBLOAD "myDLLthing)
The_function = DYLIBSYMBOL(libhandle, wanted_function$)