Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ contents of a variable to change other variables? heh
contents of a variable to change other variables? heh
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gore
(207 posts) Bio
|
Date
| Fri 05 Nov 2004 05:28 PM (UTC) |
Message
| Sorry about the shoddy subject, couldn't figure out what would be best.
This may be a little far out there, but I have no clue if it's possible, or how to do it on my own.
What I'm curious, is, if you can say, use the contents of a variable to modify a variable who's name is the contents of the variable.
Say you have variable varContents, and it contains "varAffliction", is there any to change varAffliction with varContents? | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #1 on Fri 05 Nov 2004 09:03 PM (UTC) Amended on Fri 05 Nov 2004 09:04 PM (UTC) by Flannel
|
Message
| Variables:
pointer contains: "target"
value contains: "data"
target contains: "nothing"
setvariable "@pointer", "@value"
(with expand variables)
afterwards:
Variable:
target contains: "data"
setvariable getvariable("pointer"), getvariable("data")
also works. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Gore
(207 posts) Bio
|
Date
| Reply #2 on Fri 05 Nov 2004 10:22 PM (UTC) |
Message
| what about script side variables? | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Sat 06 Nov 2004 12:52 AM (UTC) |
Message
| You can use Execute (or executeglobal) to construct a string (which uses the values of the variable) and then execute it.
I believe thats the only way, since VBScript doesnt do passing by reference/value. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #4 on Sat 06 Nov 2004 11:41 AM (UTC) |
Message
| Actually it does, myFunc (ByRef var1, ByVal var2) |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Gore
(207 posts) Bio
|
Date
| Reply #5 on Tue 09 Nov 2004 12:26 PM (UTC) |
Message
| I've been trying to figure out what you mean, but I don't think I have a clue.. I looked up execute vbscript on google.com but I just received a bunch of server stuff I think.
Could you elaborate, or would it be best to just use client side variables for this? | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #6 on Tue 09 Nov 2004 05:31 PM (UTC) |
Message
| Theres a good example in the VBScript Doc.
Execute also changes the scope of variables, so you'll have to be aware of that (see the doc on it).
Heres two examples in the documentation (multiline, and single line):
Execute "Sub Proc2: Print X: End Sub"
and...
S = "Sub Proc2" & vbCrLf
S = S & " Print X" & vbCrLf
S = S & "End Sub"
Execute S
ExecuteGlobal is used in the same way, it just changes scope. Look up the details.
(the doc is the one you can download on the same page as the script functions, Microsoft Script Host Documentation, it also has the regexp guide and some other things (Including JScript, which makes searching somewhat troublesome at times).) |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,292 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top