|
afkai Newbie
Joined: 17 Jan 2010 Posts: 3
|
Posted: Sun Jan 17, 2010 9:48 pm
%item sends first item in string list straight to MUD, skips parser, help! |
I have an alias, 'scure' short for salve cure which does the following:
Code: |
#var salvelist {%sort( @salvelist)}
#if (@salvebalance=1 and @slick=0 and @sleep=0 and @aeon=0 and @stunned=0) {%item( @salvelist, 1)}
|
In the string list are items which are ALIASES such as, 000anorexia, 001mangledhead, 002mangledlegs, 003mangledarms
the aliases contain healing commands such as:
The problem I'm having is, when the 'scure' alias fires, the first item from the string is returned and sent to the mud, but it's sent as plain text, it should send the cure commands, not the literal text.
Help!
This worked in Zmud! |
|
Last edited by afkai on Mon Jan 18, 2010 3:24 am; edited 1 time in total |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jan 17, 2010 10:51 pm |
The problem is that you can no longer start a line with a %function() call. You have to use whatever #command would be necessary to do what you want to do (in your case, it's #SEND). #SEND will send stuff through the parser, but fyi if you need to send something verbatim you would instead use #SENDRAW (it works just like the zmud version of #SEND.)
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
afkai Newbie
Joined: 17 Jan 2010 Posts: 3
|
Posted: Mon Jan 18, 2010 3:24 am |
I can't seem to get it to work.
How do I get it to fire the first item in a string list which happens to be an alias? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Jan 18, 2010 4:13 am |
If #SEND %item(...) doesn't work, try one of these:
#SEND %exec(%item(...))
#EXEC %item(...)
You are probably better off finding a different way to do this, however, because %exec() and #EXEC are very slow. When your packages start getting huge (either by themselves or in combination with other packages), even small things like this can turn into big, frustrating problems.
For example, if all your 00Xwhatever aliases send ~apply whatever then you are better off changing @salvelist to store just the argument for the ~apply command and moving ~apply next to %item(). There'd be no need for extra aliases.
Alternatively, you could use a #SWITCH command:
Code: |
$nexteffect = %item(@salvelist,1)
#switch (%ismember($nexteffect,"A|B|C|D")) {~apply $nexteffect}
(%ismember($nexteffect,"E|F|G|H")) {~eat $nexteffect}
|
|
|
_________________ EDIT: I didn't like my old signature
Last edited by MattLofton on Mon Jan 18, 2010 7:36 am; edited 1 time in total |
|
|
|
afkai Newbie
Joined: 17 Jan 2010 Posts: 3
|
Posted: Mon Jan 18, 2010 5:40 am |
The reason they are prefaced with 3 digits is so I can sort the string list and prioritize the afflictions so that more severe afflictions are cured first.
Is there a better way to do this? |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jan 19, 2010 2:05 pm |
There are other ways, but whether they are better is a matter of preference.
Can you explain exactly what you mean by "I can't seem to get it to work"? It's hard to debug your script without further information. What exactly happens when your alias executes? Can you show us the current code for the alias? |
|
|
|
|
|