|
Mozzie Beginner
Joined: 24 Nov 2006 Posts: 17
|
Posted: Fri Nov 24, 2006 11:02 am
Function returns extra Carriage return |
Hi there, I am having some problems with an function and alias combo. I have created a function that I hope to use in all my aliases to keep track of my last target (among other things) but I seem to be getting a mystery carriage return from the function.
My Function;
#fu Targ {%if(%len(%1)=0,@target,%exec("#va target %1;%1"))}
(incidently I tried using @target instead of the last %1 but it kept using the last target rather than the one defined in that exec statement)
Now when I try to use it in an alias it works if I don't specify a target;
#alias shoot {blast @targ(%1)}
Shoot Bob returns
Bob
Blast
However
Shoot then returns
Blast Bob
Any ideas what I am doing wrong? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Nov 24, 2006 1:22 pm |
%exec shouldn't be sending the Bob in your example it should be returning it, but a minor change should be all that is needed to get around this misbehavior.
#fu Targ {%if(%len(%1)=0,@target,%exec("#va target %1")%1)} |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Mozzie Beginner
Joined: 24 Nov 2006 Posts: 17
|
Posted: Fri Nov 24, 2006 3:07 pm |
That did it, Thanks alot Vijilante.
|
|
|
|
Mozzie Beginner
Joined: 24 Nov 2006 Posts: 17
|
Posted: Fri Dec 08, 2006 10:52 am |
I have since done some more playing around with my target function and want it to automatically expand the targets name so I can use it in various triggers.
However I am having a problem with the #TEMP trigger defined within this script. I am requesting the quick honours list which is basically their full name and one couple of lines, and I want to capture the name (there is a chance of a title showing before the name) however I want the %1 to be literal in the #TEMP but it is expanding to the %1 of the function. I have tried quoteing the %1, bracketing and curley bracketing it, and also the %literal function. None of which have helped.
%if( %len( %1)=0 or %1 = %left( @target, %len( %1)) , @target, %exec( "#va target %1;#var tdeflist %null;#var tweaklist %null;qhonours %1;#temp Name {Quest Honors for (%w) (%W)} {#if (%1 = %left( @target, %len( %1))) {#va target %1} {#va target %2}} Targetinfo")%1) |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Dec 08, 2006 9:51 pm |
Have you tried using %%1 in your #TEMP trigger? That should give you a literal %1 in your created trigger.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Dec 09, 2006 8:44 am |
I may be wrong Larkin, but I thought the %%1 once no longer necessary or supported for that matter.
|
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Dec 09, 2006 12:58 pm |
That's CMUD, Tech. It can still be used in zMUD for some things.
|
|
|
|
Mozzie Beginner
Joined: 24 Nov 2006 Posts: 17
|
Posted: Mon Dec 11, 2006 3:33 pm |
Sorry for the delay in coming back, I ended up using a classed trigger rather than a temp one to resolve this problem.
Is %%1 different in effect to %literal(%1) ? |
|
|
|
|
|