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
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Fri Feb 15, 2008 12:09 am   

Numparam and Noop
 
This effect caused me to make a workaround in the past but I didn't realize what was going on. Could anyone explain this please?

What I had liked about this was I could use params without trimming

#var PRH_GvvOrders ""
#loop %numparam( ) {#var PRH_GvvOrders %additem( %param( %i), @PRH_GvvOrders)}
#noop

@PRH_GvvOrders = "do|re|me|fa|so|la|te" now

_________ With Showing the Stringlist

#var PRH_GvvOrders ""
#loop %numparam( ) {#var PRH_GvvOrders %additem( %param( %i), @PRH_GvvOrders)}
#noop
#forall @PRH_GvvOrders {
#sh %i
}

Prints that stringlist with what looks like %-1 after %i:

do do re me fa so la te
re do re me fa so la te
me do re me fa so la te
fa do re me fa so la te
so do re me fa so la te
la do re me fa so la te
te do re me fa so la te


_________ adding an odd #NOOP to the #FORALL

#var PRH_GvvOrders ""
#loop %numparam( ) {#var PRH_GvvOrders %additem( %param( %i), @PRH_GvvOrders)}
#noop
#forall @PRH_GvvOrders {
#sh %i
#noop
}

Prints correctly:

do
re
me
fa
so
la
te
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Feb 15, 2008 1:25 am   
 
That is rather odd. Aliases are supposed to auto append unused parameters to the end. It is wierd that that append would produce that output. Use this method to mark all the parameters as used instead.
Code:
#noop %-1
#var PRH_GvvOrders ""
#loop %numparam( ) {#var PRH_GvvOrders %additem( %param( %i), @PRH_GvvOrders)}
#forall @PRH_GvvOrders {
#sh %i
}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Fri Feb 15, 2008 1:46 am   
 
Thanks for that. Smile

I think this is a faster and more predictible way of replacing spaces but once while trying to use the regex "\p" in %subregex, I caused ZMud to crash

Code:
%subregex("d  x   z z","\s+","|")


returns; d|x|z|z


so I am wary of pipes, I will try it though unless anyone thinks it is a bad idea.

Thanks again
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