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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
acaykath
Wanderer


Joined: 03 Aug 2005
Posts: 84

PostPosted: Tue Nov 14, 2006 4:23 am   

[1.15] Errors causing 1s and 0s inserted into statements
 
I think it may have to do with if statements, but here are two triggers where I get the effect and the result. This was all working up until i updated.

Code:

#IF (nuggets>=20)
  { cast 'carnal reach' gold maiden }
  { recall;
    .2s3w2nen;
    craft 'olympian bar of pure gold' }


Quote:
cast 1 'carnal reach' gold maiden


Code:

#if ( %class("Collect Nuggets") )
  { #T- "Collect Nuggets";
    #echo "Automated Nugget Collection Off"}
  { #T+ "Collect Nuggets";
    #echo "Automated Nugget Collection On" }


Result 1
Quote:
Automated Nugget Collection Off

Result 2
Quote:
0 Automated Nugget Collection On


Also is there any reason why multiline codeblocks do not work without the ;?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 14, 2006 7:57 pm   
 
Well, you are indenting incorrectly. When you indent a line, it becomes a continuation of the line above it. It basically causes the line break to be ignored. In your first example, the line ".2s3s2nen" is indented compared to the line above, so it get's appended as "recall;.2s3w2nen" which is why the ; is needed. The ; isn't needed on the next line because it isn't indented.

The correct multiline syntax is this:
Code:
#IF (nuggets>=20)
  { cast 'carnal reach' gold maiden }
  {
    recall
    .2s3w2nen
    craft 'olympian bar of pure gold'
  }

or this:
Code:
#IF (nuggets>=20)
  { cast 'carnal reach' gold maiden } {
    recall
    .2s3w2nen
    craft 'olympian bar of pure gold' }

or this:
Code:
#IF (nuggets>=20)
  { cast 'carnal reach' gold maiden }
  { recall
  .2s3w2nen
  craft 'olympian bar of pure gold' }


Just remember the simple rule...if a line is indented more than the line above it, then the linebreak is ignored.

The bug with the 1 and 0 being displayed is already fixed in v1.16.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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