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
xiangwei
Beginner


Joined: 17 Apr 2004
Posts: 18

PostPosted: Tue Jun 12, 2007 8:10 am   

help Improvement code
 
#al zh {test=2
#FO @rlist {#IF %numitems( %roomexit( %i))=@test {#VA xww {%additem( %i, @xww)}}}
zzz}

#al zzz {
#VA count {1}
#VA zzz {}
#VA xnum {%numitems( @xww)}
zz
#WA 500
#VA 4z {%numitems( @zzz)}
#IF @4z=1 {
#TE @zzz
gofj
} {
#T+ map
l
}}



#al zz {
#VA zz {}
#FO @roomexit {#ADDI zz %ismember( %i, %roomexit( %item( @xww, @count)))}
#IF %ismember( 0, @zz) {} {#ADDI zzz %item( @xww, @count)}
#IF @count<@xnum {
#ADD count 1
zz
}}

I always think not well

help me
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Jun 12, 2007 4:40 pm   
 
For the most part it looks fine. Just a few minor tweaks.

Code:
#al zh {test=2
#FO @rlist {#IF (%numitems( %roomexit( %i))=@test) {#ADDITEM xww %i}}
zzz}


#WAIT use is typically a bad idea. The same can usually be accomplished with a #ALARM
Code:
#al zzz {
  #VA count {1}
  #VA zzz {}
  #VA xnum {%numitems( @xww)}
  zz
  #ALARM  +0.5 {
    #IF (%numitems( @zzz)=1) {
      #TE @zzz
      gofj
    } {
      #T+ map
      l
    }
  }
}


Use local variables when possible when you don't need to persist the variable.
Code:
#al zz {
  #LOCAL $zz
  #FO @roomexit {#ADDI $zz %ismember( %i, %roomexit( %item( @xww, @count)))}
  #IF %ismember( 0, $zz) {} {#ADDI zzz %item( @xww, @count)}
  #IF @count<@xnum {
  #ADD count 1
  zz
}}


Not sure I fully understand what this code is supposed to be doing, so that limits the recommendations I can make.
_________________
Asati di tempari!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Jun 12, 2007 5:06 pm   
 
Just a quick note - zMUD doesn't support local variables, so that suggestion doesn't apply. The #wait thing is something to change though.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Jun 12, 2007 6:32 pm   
 
Doh!! I've got to be more careful about checking the particular forum I'm responding too.
_________________
Asati di tempari!
Reply with quote
xiangwei
Beginner


Joined: 17 Apr 2004
Posts: 18

PostPosted: Wed Jun 13, 2007 9:54 am   
 
thank you tach
Very pleased to recognize foreign friends
Reply with quote
xiangwei
Beginner


Joined: 17 Apr 2004
Posts: 18

PostPosted: Wed Jun 13, 2007 10:02 am   
 
#local is what?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 13, 2007 10:22 am   
 
#local is a CMUD command, not a zMUD command. Ignore that part :)
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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