Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: 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?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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
Reply with quote
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: Fri Nov 24, 2006 3:07 pm   
 
That did it, Thanks alot Vijilante.
Reply with quote
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: 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)
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: 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.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Dec 09, 2006 12:58 pm   
 
That's CMUD, Tech. It can still be used in zMUD for some things.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: 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) ?
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net