Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Bajed
Novice


Joined: 15 Aug 2004
Posts: 33

PostPosted: Tue May 19, 2009 6:54 am   

Variable Question
 
How would I reference a variable where part of the variable name is based on another variable?

For example:

Variable_1: 2
Variable_2: something


I want to access Variable_[Variable_1] and have that return the contents of Variable_2, if that makes sense.

Thanks!
Reply with quote
Bajed
Novice


Joined: 15 Aug 2004
Posts: 33

PostPosted: Tue May 19, 2009 6:57 am   
 
A better example of what I want to do would be:

Variables:
@myvar: N
@something_X: blah
@something_Y: blah
@something_Z: blah

where Variable_A is equal to either X, Y, or Z... which I have set based on other things in the script.

I want to basically access @something_@myvar
Reply with quote
Bajed
Novice


Joined: 15 Aug 2004
Posts: 33

PostPosted: Tue May 19, 2009 7:00 am   
 
Nevermind! I realized it would be

@{something_@{myvar}}
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue May 19, 2009 4:51 pm   
 
Also, please remember to post normal questions about using CMUD to the regular CMUD Discussion Forum. This forum is for reporting problems with the latest Beta version of CMUD.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net