Zmud help with expanding variables containing %if

Scripts and support for your favorite MUD client.
Anaram
Sojourner
Posts: 39
Joined: Sun Sep 23, 2001 5:01 am
Location: Kirkland, Wa, 98034

Zmud help with expanding variables containing %if

Postby Anaram » Tue Dec 04, 2001 2:42 am

Zmud script
*SNIP*
#var mob_targ {0} {0}
#var attr {%if( @mob_targ, @mob_targ, %0)}
#alias {targ} {#var mob_targ %0}
#alias {notarg} {#var mob_targ 0}
#alias {mm} {cast 'magic missile' @attr}
*END SNIP*

Ok, what i'm trying to do here is just save alot of cut and paste and typing, I have several spells aliased with @attr as their final argument, @attr after expanding is an if statement that checks if @mob_targ is true (a value) or false (0). This does work, but it only works if I edit the value of @attr and save, afterwhich it works flawlessly until I close zmud or log in another character. Otherwise it expands the variable but does not execute the %if statement contained. Is there any way I can make this work without having to first edit the variable?
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Tue Dec 04, 2001 4:07 am

Take a look at the #func command in the helpfiles. I think it is more oriented to that type of thing than a poor variable.

Regards,
Jorus
Anaram
Sojourner
Posts: 39
Joined: Sun Sep 23, 2001 5:01 am
Location: Kirkland, Wa, 98034

Postby Anaram » Tue Dec 04, 2001 4:40 am

The #Func is exactly what i'm doing, it creates a named variable with snippets of zMUD scripting within it. I attempted various other commands

%exec
%eval
%show

and none of them created the desired effect. I figure it has somthing to do with zmud only recognizing the variable as an evaluatable piece of script if the variable is created dynamically (hence the fact it works when saved, but not at startup)

Thanks for the tip though Jorus...
Todrael
Sojourner
Posts: 1454
Joined: Fri Mar 16, 2001 6:01 am
Location: MI, USA
Contact:

Postby Todrael » Tue Dec 04, 2001 5:41 pm

#alias {targ} {#t+ target;#t- notarg;#say Targetting now on;#var mob_targ %0} notarg
#alias {notarg} {#t- target;#t+ notarg;#say Targetting now off} target
#alias {mm} {cast 'magic missile' @mob_targ} target
#alias {mm} {cast 'magic missile'} notarg

That's how I would do it.

-Todrael
Drevarr
Sojourner
Posts: 25
Joined: Tue Jan 30, 2001 6:01 am
Location: Georgia
Contact:

Postby Drevarr » Tue Dec 04, 2001 8:45 pm

#ALIAS mm {#if @mob_targ {cast 'magic missile' @mob_targ} {cast 'magic missile'}} {SorcCast}
Gindipple
Sojourner
Posts: 676
Joined: Fri Jan 26, 2001 6:01 am
Location: O' Fallon, MO. USA
Contact:

Postby Gindipple » Tue Dec 04, 2001 8:47 pm

Bravo Drevarr!
That one gets the KISS award.

Return to “MUD Client Help”

Who is online

Users browsing this forum: No registered users and 13 guests