[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  contents of a variable to change other variables? heh
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

contents of a variable to change other variables? heh

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Gore   (207 posts)  [Biography] 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?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Gore   (207 posts)  [Biography] bio
Date Reply #2 on Fri 05 Nov 2004 10:22 PM (UTC)
Message
what about script side variables?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

Posted by Gore   (207 posts)  [Biography] 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?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] 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.


6,548 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]