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
thomaspepon
Beginner


Joined: 04 Sep 2008
Posts: 16

PostPosted: Fri Sep 05, 2008 5:14 pm   

trigger to assign alias with a variable name to be parsed later
 
I am practicing a spell, and when the spell reaches 100%, I want to change the spell I am practicing.

What I have set up currently:
variables
.....@spell = "haste"
alias
.....@action = "ca '<@spell>'"
trigger
.....@spell%s100~%* sends @spell = "haste";#alias action {ca '<@spell>'}

my action alias ends up being
ca 'haste'
but I want to set the action alias to be
ca'<@spell>'

I used this alias setup in case my spell requires additional info, like
@spell = "summon"
then I would want my action alias to be ca '<@spell>' fido

I can't figure out what combination of characters to use to set the alias and not expand the variable
I tried sprinkling ~s in there, before the <, @, and >, I've tried with double-quotes, parenthesis, square
brackets, I've tried breaking the pieces up and using %concat, I just can't seem to get around it.

I can do it just fine in the application window, but I am unable to figure out the syntax to do it through the trigger.

Any help would be appreciated. Thanks much.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Sep 05, 2008 7:01 pm   
 
You only need to define the alias once.
#ALIAS action {ca '@spell' %-1}

I don't quite understand what you are doing with that trigger.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
thomaspepon
Beginner


Joined: 04 Sep 2008
Posts: 16

PostPosted: Fri Sep 05, 2008 7:06 pm   
 
the trigger is just supposed to assign the value

ca '<@spell>'

to the alias.

All I'm really looking for is how to assign that string to an alias through a script without
zMUD expanding my @spell variable.

Maybe it's my still being new at coding zMUD, but i was using the #ALIAS command
to do the assignment to the action alias. Maybe I can do action = ""... like I did for the
variable, I haven't played around with it.

I'm still trying to get the functionality going, so my code may not be the right way to do things,
but it has been functional, except for this little issue.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Sep 05, 2008 7:25 pm   
 
Are you using zMud or CMud. It doesn't make too much of a difference, but it could make some. If you are using zMud I will move this topic into the correct forum.

I will say it again to be perfectly clear. You only have to define the alias once. The alias will expand the variable when used.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
thomaspepon
Beginner


Joined: 04 Sep 2008
Posts: 16

PostPosted: Fri Sep 05, 2008 7:31 pm   
 
*gasp* I'm sorry, I put it in the wrong forum. I am using zMUD 7.21

And I understand that assigning ca '<@spell>' several times would be redundant, my problem is that
next time, I may need to put ca '<@spell>' ring, (when practicing location object or identify) or
ca '<@spell>' fido. (when practicing summon or gate) I may need to set it back to ca 'spell' once
again when I practice detect invisibility.

I understand that the definition of the alias only needs to hapen once, it's the assignment of it that is the issue.
I'm using the same syntax to create the first time, and to assign again the next time.

Thank you for your patience though, I'm not trying to be difficult, I'm just a little green. :mrgreen:
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Sep 05, 2008 7:40 pm   
 
Enter to code I gave above at the command line.
Code:
#ALIAS action {ca '@spell' %-1}
Then remove any other usage of #ALIAS that would break that definition, such as from your trigger. Finally make that the spell variable is defned how you want. You can test it by entering "ca whatever"
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
thomaspepon
Beginner


Joined: 04 Sep 2008
Posts: 16

PostPosted: Fri Sep 05, 2008 7:50 pm   
 
ok, I think I see where the disconnect is here...

right now I have
variable @spell = "haste"
alias action = ca '<@spell>'

and in my practice trigger, which I didn't show, my loop
was set to #50 {action}

the loop needs to be the most generic, and I set action and @spell so that I don't have to change the actual practice loop

if I were sitting at the console, and wanted to do a spell action to a fido, I could type action fido, or if I wasn't worried about
generics in my practice script, I would just put action fido in there.

but I don't want to change the practice script, I want to set this variable/alias to leave the practice script generic

as a workaround, I could always create alias action2 {action fido}, and set my action alias as you showed above, but I would
think that there would be syntax available to put the expansion of the spell in there.

maybe I'm missing something here with the <>, when I didn't have them there, the script was sending ca '@spell' (literally) to the
mud, which is why I put the expansion set around @spell, but your alias didn't require the <>

I have to work on that some more, thanks, Vijilante, for all of your help to get me to this point.
I was so stuck on my solution that I couldn't get past my mental block.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Sep 05, 2008 9:32 pm   
 
Quote:
and in my practice trigger, which I didn't show, my loop
was set to #50 {action}

Add another variable, lets say target. Then your practice loop would be "#50 {action @target}". When target is empty it would do nothing special. This then makes it so that you have to set both the spell and target variables for your practicing.

Perhaps if you provided a very thorough description of what you want to do any of the experts and Guru's around here might write a complete solution. I am gathering it some sort of automatic practice and likely a ROM/Diku codebase. I have probably written such a script at least 20 times. While you aren't likely to learn as much from just having a full script handed to you, I think you are the kind of person that could benefit from examining such a script.

I would suggest taking some time to search in the forums for such scripts. There have been many scripts published and many posts that are similar to this one (helping through some different steps of the whole). You can use the link in my signature for easy searching.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
thomaspepon
Beginner


Joined: 04 Sep 2008
Posts: 16

PostPosted: Sat Sep 06, 2008 2:12 am   
 
A variable for the target, that's it, and if it's blank, no worries.
That's part of why I asked on the forums, I just wanted a good way
to manage the issue.

I'd still like to be able to set my variable from script, just because it
eluded me so, but I'll work with a target variable, and that will cover
things for now.

Thanks again, Vijilante.
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