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
kermit
Newbie


Joined: 13 Nov 2000
Posts: 2

PostPosted: Thu Dec 20, 2001 3:23 am   

tying to get @ to print
 
What i am trying to do is make an alias that will take a string and output the string with randomized color codes in it.

I pretty much have is complete except for a small problem i have with the special character "@".

here's the contents of a test alias i made to show what am trying to do



#var test1 {"!"|"@"|"#"}
#var string ""
#LOOP 1,%len( %0) {
#var string %concat( @string, "`", %item( @test1, %random( @test1, %numitems( @test1))), %copy( %0, %repeatnum, 1))
}
#echo -@string-


in this example everything works fine expect when the @ is choosen, which then causes it to use the @ and the next character in the string to lookup a varible which it don't want. I just want it to print the @ and then the next character in the string.

any help would be appreciated

~kermit
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Dec 20, 2001 5:43 am   
 
check out the %expand() function. It's a powerful little doodad that allows you to control how much expansion occurs. Dunno if it'd be what you are looking for, but it's a start.

li'l shmoe of Dragon's Gate MUD
Reply with quote
PrestoPimp
Apprentice


Joined: 18 Sep 2001
Posts: 175
Location: USA

PostPosted: Sat Dec 22, 2001 4:56 am   
 
~@variable this prints the @ symbol instead of seeking it as a variable.. :-D

For tomarrow is another day, and other days come but 6 times a week.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Dec 22, 2001 8:10 am   
 
quote:

~@variable this prints the @ symbol instead of seeking it as a variable.. :-D

For tomarrow is another day, and other days come but 6 times a week.



Doesn't quite work when the special character is the value of a variable. Zugg already addressed this point in a previous point and told us we needed to use %expand().

Via %expand(), one can control the amount of expansion--from no expansion (I think) to just @ and % to something else to full expansion. Check the function reference for exact details.

li'l shmoe of Dragon's Gate MUD
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