|
xiangwei Beginner
Joined: 17 Apr 2004 Posts: 18
|
Posted: 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 |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
|
xiangwei Beginner
Joined: 17 Apr 2004 Posts: 18
|
Posted: Wed Jun 13, 2007 9:54 am |
thank you tach
Very pleased to recognize foreign friends |
|
|
|
xiangwei Beginner
Joined: 17 Apr 2004 Posts: 18
|
Posted: Wed Jun 13, 2007 10:02 am |
#local is what?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jun 13, 2007 10:22 am |
#local is a CMUD command, not a zMUD command. Ignore that part :)
|
|
|
|
|
|