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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Macai
Newbie


Joined: 12 Jul 2004
Posts: 6
Location: USA

PostPosted: Mon Oct 10, 2005 4:10 am   

idea: %var() function
 
The purpose of the %var() function would be basically to read a variable.

THe reason I'd like to see this happen is so I can give variables complicated names, and go,

#VAR {this variable uses spaces, and @variables in it} {1234}

and then be able to actually read it by going

#SAY %var(this variable uses spaces, and @variables in it).

If there's already a function that does this, I'd really like to hear about it, and I apologize for my frivolty.

If it hasn't, though, I'm sure it could easily be programmed in, just take about two minutes or so. I'd REALLY appreciate it..
_________________
Thank you for your time,
Macai
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Mon Oct 10, 2005 1:23 pm   Re: idea: %var() function
 
Macai wrote:

and then be able to actually read it by going

#SAY %var(this variable uses spaces, and @variables in it).


You can expand variable names to look up a variable based on the contents of another variable. As an example, entering the following from the command line will show "hello world":

#var var1 "hello world"
#var var2 var1
#echo @{@var2}

(Tested with 7.20)

If you want to do it using functions instead of expansion, the following also work as a substitute for the third command:
#echo %eval(@%eval(@var2))
or
#echo %eval(@@var2)

A few examples of syntax are in
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=17070


Why do you need to be able to include spaces and odd characters?

-Tarn
Reply with quote
Macai
Newbie


Joined: 12 Jul 2004
Posts: 6
Location: USA

PostPosted: Wed Oct 12, 2005 4:30 pm   
 
Wow! Thanks! I highly appreciate this help.
_________________
Thank you for your time,
Macai
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion 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