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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
emberghost
Newbie


Joined: 13 Jun 2007
Posts: 5

PostPosted: Thu Jun 14, 2007 5:25 am   

% vs #
 
I apologize if this is a dumb question or a repeat; I searched but couldn't find anything.

In reading documentation, I can't find an exact reference to the difference between %command and #command usage?

Is it just general syntax, use the one you prefer, or do they actually function differently?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Jun 14, 2007 10:45 am   
 
% is a function, # is a command. Commands return no values, they only do things. Functions mostly return values - some do things as well. CMUD always needs to be executing a command (you can't have a function on a line on its own, it needs to at least use the #call command). The only exception is when you want to send text to the MUD, but even then you need at least one "command word" before the function call.

%function(%-1)
won't work

#call %function(%-1)
say %function(%-1)
will work.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Jun 15, 2007 2:19 am   
 
I made a nice little post awhile back about the differance

you can use just a function on the line by itself, a function returns and/or executes something (for the most part) while a command does something (again for the most part)

#CALL in the simpilest terms just eats the return value so it doesnt get sent to the mud/script, This is usefull for when your %function does something as well as returns something and your not interested in the return :p

Let's compare #ADDITEM and %additem
#ADDITEM adds a list item to your variable (it does something)
%additem returns the value of @varname with the item added to it.

#ADDITEM varname value //This will add the item value to the list variable varname
%additem(blah,@varname) //will send to the mud the @varname list with blah added to it
#SAY %additem(blah,@varname) //Will send to your screen in the forum of an info message @varname list with blah added to it
#CALL %additem(blah,@varname) //won't do a darn thing (that you can see), %additem by itself just returns something.
#VAR varname {%additem(blah,@varname)} //This tells #VAR to use the return of %additem as the new value for varname

I prolly just confused you :p
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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