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


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Jun 12, 2005 7:39 am   

Quoting Stuff! When to do it and why it helps!
 
I have been seeing an increased number of WHY doesn't this work when it should lately so here is my 3:30am post on WHY it doesn't work.

Your prolly not quoting it correctly!

When you quote something with double quotes "" It will treat everything inside of it literaly. What you see is what you get, no expansion, no evalution. (with the exception that %1.....%99 will be expanded one time)

Example:
#IF %ends(%1,".") {SAY Ends with period} {SAY doesn't end with period}
so if %1=The Fox. your all well and good! but what if %1= The quick, brown fox. Well then here is what happens

The first time that it is expanded it will look like this
%ends(The Quick, Brown fox.,".")
and that is not what we want because when that is furthure expanded %ends returns false because
The Quick does not end with Brown fox
for the most part everything is recursivly expanded until there is no more to expand
This is the correct way to do it
%ends("%1",".")

And that is why you should always quote your strings in simle 3 in the morning terms, I know your prolly more confused now then before you read this :p

Quoting something with single quotes ' ' groups everthing like dbl quotes but allows expansion to be performed. I cant think of a logical example but I will have one someday!

Numbers dont have to be quoted, but word strings should be
_________________
Zmud Support Library
Zmud Knowledge Base
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