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
Churlant
Novice


Joined: 17 Oct 2002
Posts: 44
Location: USA

PostPosted: Fri Sep 28, 2007 6:22 pm   

Variables and Triggers - easy question
 
It's been a while since I've done some major scripting, and I'm running up on what's probably a problem with a simple solution.

Basically I want to capture a specific mobile name with a #PR command, then convert that variable to a literal string and add a trigger to the profile.

The line as it is now:

#AL immune {#PR immune_mob "Enter the mob name";#TR {@immune_mob} {#ECHO +++THIS MOB IS IMMUNE TO PHYSICAL DAMAGE} Immunity}

Now obviously what happens is the alias adds a trigger when I type "immune", but that trigger has the actual variable "@immune_mob" as a matching string, rather than the literal name OF that variable (Say the mob named "Churlant" for instance). What I'd ideally want is to have a trigger added to the profile which matches Churlant and not @immune_mob, whatever that variable happens to be at the time.

-JC
_________________
>-Churlant-<
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri Sep 28, 2007 7:00 pm   
 
Try using %eval to expand the variable in the trigger pattern. This problem would be a lot easier to fix in CMUD :(

Also, if you have any further questions, please type out the whole name of the command unless it's an obvious one. For a while, I was confused by that script because I thought you meant #priority.

EDIT: It just occurred to me, maybe you'd prefer a more simple solution to the rather complicated one you're using there. You could potentially end up with a LOT of triggers. Try this:

#alias immune {#additem ImmuneMobList {%-1}}
#trig {{@ImmuneMobList}} {#echo +++THIS MOB IS IMMUNE TO PHYSICAL ATTACKS+++}

This'll keep your mobs in a single variable, and have the trigger fire on anything that's an item in that variable.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Churlant
Novice


Joined: 17 Oct 2002
Posts: 44
Location: USA

PostPosted: Fri Sep 28, 2007 7:13 pm   
 
I tried a number of options, I believe %eval was one of them, however I'm just as inclined to go with your simplified version.

Is it possible to add the name using a prompt, or will it have to be a command line input such as "immune mobname" ?
_________________
>-Churlant-<
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Sep 29, 2007 1:02 am   
 
Sure. Replace %-1 with the %prompt of your choice - just make sure you use the function and not the command.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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