|
Leitia Adept
Joined: 04 May 2007 Posts: 292 Location: Boston
|
Posted: 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 |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
|
Leitia Adept
Joined: 04 May 2007 Posts: 292 Location: Boston
|
Posted: Fri Feb 15, 2008 1:46 am |
Thanks for that.
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 |
|
|
|
|
|