Page 1 of 1

Calling an Alias

Posted: Thu Sep 17, 2009 1:28 am
by BrandNew
I've dug around the manual and forums but can't find anything relating to my problem.

I've got my prompt trigger which looks has this statement:

Code: Select all

if (maxhealth - 800 > health and sparkbalance == 1) then
send(spark)
end
and then this alias:

Code: Select all

Alias name: sparkAlias
Pattern: ^spark$

send("outr sparkleberry;eat sparkleberry")
but, while I will drink health I won't eat sparkleberry. I'd

Re: Calling an Alias

Posted: Thu Sep 17, 2009 8:12 am
by Heiko
It's send("spark"). send(spark) would send the text contained in the variable spark if there is one, otherwise it would result in an error.

In your attached script I could see the function execute( ... ) which doesn't exist in the Mudlet API and isn't defined in the xml file that you've attached to your posting so I think that this is what you are after.

send("spark") will send the clear text "spark" to the MUD directly via the underlying socket layer. This function will not invoke the alias expansion and input trigger system. If you want to invoke your alias system to process the command that you want to send to the MUD you can call the function expandAlias("spark"). If you have defined an alias (=input trigger) that triggers on the pattern "spark" the respective script will be executed. Note that using expandAlias("spark") from within an alias script that is triggered on the input pattern "spark" may lead to infinite recursion and thus hang Mudlet unless you take special precautions to prevent this e.g. via on/off switch variables etc.. Using expandAlias("spark") from triggers, timers etc. is usually safe.

Re: Calling an Alias

Posted: Thu Sep 17, 2009 2:49 pm
by BrandNew
send("spark") never did work, but expandAlias("spark") did the trick. Thanks!