 |
kjaerhus Magician

Joined: 18 Dec 2006 Posts: 317 Location: Denmark
|
Posted: Tue Feb 20, 2007 8:13 pm
Parameters surviving between calls to aliases |
Another one for the bug list I think - if it's not already there.
I have an alias which is called with parameters. This alias calls another alias with fewer parameters. Now my problem is that the other alias can read the extra parameters that was sent to the first alias but not to the second.
This is a problem for me as I have aliases that can be called with or without parameters with different behaviour as the result. If these aliases is called from another alias that has more paramaters I have the problem.
I am quite sure it didn't behave live that in zMUD and im am absolutely positive that I don't like it. |
|
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Feb 20, 2007 8:46 pm |
It would really go a long way to getting the help you want if we could see the aliases in question.
|
|
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Feb 20, 2007 10:23 pm |
I believe this is not actually a bug, but a difference in the way Zugg handles the %1...%99 variables (in regards to the stupid %%1 and %%%2 stuff). It used to be that you added a % for every level you traverse through, so that to reference an argument passed to the alias it would be %1 but to reference the (%d) used in a pattern-matching #IF condition you'd use %%1.
If I recall, the reverse is effectively true, in that %1 = the (%d) from the pattern-matching #IF, and %%1 would be the first word passed to the alias (keep in mind that Zugg no longer uses %%1). He's also abandoned the use of %%1, though, and I'm not entirely familiar with what the replacement was (%param() and %params() probably) |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
kjaerhus Magician

Joined: 18 Dec 2006 Posts: 317 Location: Denmark
|
Posted: Tue Feb 20, 2007 11:16 pm |
I never used %% syntax so I can't participate in a discussion about that. I just use %1..%n and %params. Anyway it is a general example so it doesn't really require a special example but here goes a simple one then:
I have an alias "doAndAwaitFeedback" that does something and then awaits feedback from the mud. If an additional parameter is specified this is interpreted as an exact feedback to wait for - otherwise any feedback will do. Examples:
doAndAwaitFeedback "tickle matt"
doAndAwaitFeedback "draw my sword" "you draw forth your sword"
Now this works fine. Problem is if I make another alias which executes the above alias and the new alias also has two or more parameters then the second parameter (%2) will also be sent to the above alias which will cause the alias to wait for something that will probably never happen.
Now that is NOT what I expected. If I wanted to use the second parameter to be sent to my doAndAwaitFeedback alias I would do it specifically. |
|
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Feb 21, 2007 12:43 am |
Yes. That's part of the change I was explaining. Incidentally, did you know about the named parameters feature available to trigger wildcards and aliases?
the ZMud way
#trigger {There are (%d) coins here.} {}
the CMud way
#trigger {There are ($coins:%d) coins here.} {}
For aliases, I think you just include the list of parameters in parentheses with the alias name:
#alias DoSomething($arg1, $arg2) {}
but if not you can easily set them via the Alias Editor. The Details panel (the thing at the bottom that appears when you click the more button) should have a clearly marked Parameters field and you put them in there in the same format. |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
|
|
|