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
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Mon Sep 13, 2004 8:39 am   

What is {text} ?
 
Does anyone know what the {} symbols is? Like sometimes they are used like: #echo {@variable}

Thanks for helping me :-)

Edit: I have read the help file but I can't seem to find an explanation.
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Mon Sep 13, 2004 8:59 am   
 
zMUD Help > Index > settings > Settings (i.e. Settings Editor) > Variables
-or-
zMUD Help > Index > variables > Variables
Quote:

Also braces {} may be used to seperate a variable name from neighboring text or allow functions to expand prior to expanding the variable reference.


This is one of Vijilante's favorite topics Wink
_________________
zMUD 7.05a
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Sep 13, 2004 10:01 am   
 
I guess I have to just create and add a page on this in the Getting Started area.

In any case, zMud commands mostly expect and use only one word for each of thier arguements. The braces tell the parser that everything within them should be treated as a single arguement. Double quotes do the same thing and sometimes are better then the braces. The choice of which to use is a matter of controlling expansion. {} allows full expansion, "" will only permit the early expansion used by %nn.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Sep 13, 2004 4:28 pm   
 
Zugg explained this in one of his book chapters. If you haven't read them, perhaps it's time you did. You can find them on the Support Library page.
Zugg in zMUD Book Chapter - Programming wrote:
Brackets, Braces, Parenthesis, and Quotes

Because zMUD uses such a "shorthand" syntax, the uses of various special characters is often confusing. When writing complex zMUD programs or scripts, it is very important to understand the meaning of various characters. The most important and confusing characters are the various brackets, quotes, and parenthesis used to delimit text. Each of these grouping characters have a very specific purpose.

<> Angle Brackets text within the brackets is expanded

[] Square Brackets text within the brackets is evaluated

{} Braces used to group text into a single argument for aliases or functions

() Parenthesis used to group text into a single expression and to specify evaluation order within an expression

"" Double quotes used to group verbatim text into a single argument. Text within quotes is not parsed

‘’ Single quotes used to group verbatim text into a single argument. Text within quotes is not parsed

The curly braces {} are the most commonly used delimiter characters. Since the arguments for zMUD commands and aliases are separated by spaces, braces are often needed when arguments contain spaces of their own. For example,

test a b c

executes an alias called test and passes a as the first argument %1, b as the second argument %2, and c as the third argument %3. Where as

test {a b c}

executes an alias called test and passes the text a b c as the first argument %1. In general it is recommended that you surround each argument to a command or function with braces whether it is needed or not. Braces are always stripped from the arguments before they are used.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Mon Sep 13, 2004 4:39 pm   
 
Thanks for the help. It is amazing how much you have been able to not know about and still use zScript to do a lot of things. The @{} syntax can definitely be handy when doing lookup-tables!
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