|
Riesz Novice
Joined: 16 May 2006 Posts: 35 Location: Plymouth, England
|
Posted: Wed Oct 11, 2006 1:54 pm
[1.09] Lost <>, but not sure what to replace it with. |
This one is a request for help, and I hope it's okay to post it here.
I used <> in several scripts in ZMud, some of which I have been able to replace in CMud after significant toying, but there's still some that don't work as I want. One such script is trying to process an alias being taken from a variable.
Example follows..
I have a stringlist called eq which can contain following sample data..
halo|wings|slip
Halo, wings and slip are various aliases to spells, such as starcall halo, abjure timeslip, and so on.
In a trigger elsewhere, I called these aliases with the following..
<%item(@eq, 1)>
I had to use the <> because else it would simply send halo to the mud without expanding it. However now in CMud, I am facing this same problem again. I can't imagine it would be a parser error, because it isn't to know that the contents of this stringlist is in fact the name of an alias in the code.
Am I missing something that allows me to expand this alias as I intend? Is there perhaps some other method I should be using? Previously I've had a few problems with CMud, but there are few enough in this version that I want to start using it properly in anger. Having a few of these kinks sorted out in the transition, and I'll see what I can do with it. I appreciate your help on this matter in advance. |
|
_________________ Elaria, Lusternia. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Wed Oct 11, 2006 2:18 pm |
I can't test this right now -am at work- but try.
Code: |
$item = %item(@eq, 1)
$item
|
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Riesz Novice
Joined: 16 May 2006 Posts: 35 Location: Plymouth, England
|
Posted: Wed Oct 11, 2006 2:35 pm |
Given this one a whirl already. Found it in the help file, but it doesn't expand $item as an alias where previously <> did. Should have mentioned that in my initial post. Thanks though!
|
|
_________________ Elaria, Lusternia. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Wed Oct 11, 2006 3:19 pm |
%exec(%item(@eq,1))
if you put that on the command line then nothing happens all you get is it echoed as a command to the mud due to smart command line option, it works fine if you turn that option off and it works fine inside a trigger.
Code: |
#var eq {halo|wings|slip}
#alias halo {starcall halo}
#trigger {^sh$} {%exec(%item(@item,1))}
#show sh
|
|
|
_________________ Taz :) |
|
|
|
Riesz Novice
Joined: 16 May 2006 Posts: 35 Location: Plymouth, England
|
Posted: Wed Oct 11, 2006 5:27 pm |
Thank you sir, much appreciated. Tried it out and works just as I desired. Can work on porting more stuff over. I would like to also ask how multi-stage triggers work in CMud over ZMud as I didn't have any success there either (tried that in 1.08 though, haven't had a chance to play in 1.09 yet). Do they currently work, and should I post a new thread to ask about it?
|
|
_________________ Elaria, Lusternia. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Oct 11, 2006 5:29 pm |
As Taz mentioned, you need to use %exec to execute an alias that is defined by some function code like you are trying. As mentioned in the Changes for zMUD help topic, the <> and [] syntax do not exist in CMUD.
Local variables cannot be used to execute an alias, and neither can regular variables. Basically, if you are trying to perform fancy redirection where you want to evaluate something to create a string that you then want to execute, then you use #EXEC or %exec. It's a lot clearer to use %exec to execute an alias from a variable than it was to use obscure <> syntax. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Oct 11, 2006 5:30 pm |
Heh...we posted at the same time :)
Multistate triggers might still have some problems. If you have a specific trigger that isn't working, create a new post about it. |
|
|
|
|
|