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
tagal
Newbie


Joined: 04 Dec 2001
Posts: 2

PostPosted: Tue Dec 04, 2001 3:32 am   

Expanding variable if statments...
 
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?
Reply with quote
cingulli
Wanderer


Joined: 30 Aug 2001
Posts: 53
Location: Finland

PostPosted: Tue Dec 04, 2001 11:21 am   
 
Explain it more. Exactly how do you want those aliases to work?
Reply with quote
tagal
Newbie


Joined: 04 Dec 2001
Posts: 2

PostPosted: Tue Dec 04, 2001 12:09 pm   
 
@mob_targ holds the name of a mob, say goblin in it. the mm alias

#alias {mm} {cast 'magic missile' @attr}
is just a basic spellcasters alias

@attr is where the problem is. @attr is the equiv of a function built with the #func operative. it simply checks if mob_targ is valid. If so, than casts the spell on the target, if it is 0, than I need to type somthing after mm to get it to cast at a creature.

As stated above, everything almost works. The problem I am running into is this

When I open zmud, the mm alias doesn't work and outputs somthing similar to this

cast 'magic missile' (0, 0, %1)

as soon as I edit the @attr() function, and save the results, it works perfectly, I'm just trying to find out why it will not work that way without me having to manually edit the @attr() function every time I connecto to the mud I play.
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Tue Dec 04, 2001 4:19 pm   
 
I'm not entirely sure what the problem could be if you are saving your settings properly. Have you tried using #SAVE to save them to see if it has a different effect?

If #SAVE doesn't work, the only thing I could suggest would be using another alias to define that alias/function thing.

The problem might also be in the syntax, but it's hard to tell if the code isn't included in sequential order. If you don't change anything in your code; simply enter the alias and save it... you also might want to post a formal bug report to zugg with the exact syntax you are using, and what you are doing step-by-step.
Reply with quote
cingulli
Wanderer


Joined: 30 Aug 2001
Posts: 53
Location: Finland

PostPosted: Tue Dec 04, 2001 4:47 pm   
 
whadda about this? simplier at least

#alias mm {#if (%1!=%null) {#var attr %1;cast 'magic missile' @attr} {cast 'magic missile' @attr}}

dunno if I get it right...
I myself prefer function keys for repeating same spell on the same target and an alias when I wanna change the target
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Tue Dec 04, 2001 7:54 pm   
 
Aliases without parameters in their definition will append whatever is typed after their name on the command line. For example, if the alias is:

#AL mm {cast 'magic missle'}

and you enter mm goblin, then zMUD will send cast 'magic missile' goblin to the MUD. If you type mm without any modifier, it will just send cast 'magic missile' to the MUD. I'm guessing the latter is valid when you are already in the midst of combat.

------------------------
But back to your script:

Instead of setting mob_targ to zero, set it to null.

#AL targ {#VAR mob_targ %1}
#AL notarg {#VAR mob_targ %null}
#AL mm {cast 'magic missile' @mob_targ}

If @mob_targ is null, then cast 'magic missile' is sent without a target.

-----------------------
As to why your function is not saving correctly, I have been unable to reproduce that error.




Troubadour
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