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
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: Sat Sep 05, 2009 2:49 pm   

Is there a way to comment my code?
 
for example
.charger
#waitfor {A Druegar charger.} 3000
{ //open if waitfor condition is met
kill charger
emote points at charger
sigil charger
punch charger
#waitfor {You receive (%d) experience points.}
..charger
.macs
sell all;sell all from bag;sell all from bag 2
..macs
}//close waitfor condition met
{
..charger
}
Reply with quote
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: Sat Sep 05, 2009 2:52 pm   Also any idea why the kill charger command wont fire my kill (%w) trig?
 
<trigger type="Command Input" priority="660" id="66">
<pattern>kill (%w)</pattern>
<value>emote points at %1
sigil %1
kill %1
punch</value>
</trigger>
Reply with quote
Troublemag
Wanderer


Joined: 14 Jul 2004
Posts: 83

PostPosted: Sat Sep 05, 2009 4:35 pm   
 
The // code is precisely the way to comment your code. You should note that your comments will become italicized to make it easier to read as well.

As for your 2nd problem, change the %1 in your value to (*). CMUD is less forgiving about such things than ZMUD was.
_________________
CMUDPro 3.22
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Sep 05, 2009 9:34 pm   
 
To answer your questions, Josiah:

Using // to comment a code is correct, however, it must START the line (zscript isn't like some languages where you can comment it out in the middle of the script). Therefore, you could do
{
//open if waitfor condition is met
blah blah blah
}
//close waitfor condition met

As for the second issue, Troublemag, the %1 is correct. The 'CMUD is less forgiving about such things' is referring to using %1 in the trigger pattern, never the value. The reason why it's not working is because you're using 'kill' which is now a command input. You have two options here. If you're able to, abbreviate it to something like 'kil' or even 'k'. Failing that, change the line to #SEND {kill %1} instead.

Charneus
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Sun Sep 06, 2009 1:57 am   
 
Is the comments thing mentioned in the docs anywhere? If so, I couldn't find it..
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