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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Wed Sep 22, 2010 8:03 pm   

need help with an autoassist script
 
heya i'm a noob when it comes to advanced scripting and was wondering if anyone could give me a hand with completing this

here is the pattern my trigger fires off

@tank {bruises||massacres|misses|obliterates|pierces|places|pounds|pulverizes|sends|slashes|smashes|smites|stabs}

got 1 variable named tank but think i need something more in here to not fire it off 100 times during a fight.
i tried messing with another variable i called assisting and using #if so it didnt fire if its value was 1 but then it ended up not working at all

any help will be much appriciated
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Sep 22, 2010 8:21 pm   
 
I think you'll have to explain under what conditions you want this pattern to fire or not fire. I _think_ what you are saying is that you want this to fire once, when your @tank friend starts fighting, and when you are done fighting somehow reset itself to wait for the next fight. Is that correct?

The solution is probably to disable the trigger. Insert a command "#t- triggername" within the trigger itself, where triggername is the name of the trigger (it would be best to assign a name to this trigger). That will cause the trigger to turn itself off. Then you need some other trigger to turn it on again sometime later. Since I don't know your mud, I can't say what the trigger pattern for the second trigger would be, but the trigger value would be "#t+ triggername". The pattern for the second trigger should be something that shows your combat is ended. Perhaps a "dies!" message, or some message indicating that @tank has stopped fighting, or that you have stopped fighting. You will have to figure that out, based on your mud's output. You may actually need multiple triggers with different patterns, if you need to re-enable the assist trigger multiple ways.
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Wed Sep 22, 2010 8:49 pm   
 
yeah i want to only assist once during each fight
alrdy got the trigger for reseting it after battle if i use another variable

dont really get how to write your solution into cmud though
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Sep 23, 2010 12:10 pm   
 
It's very simple. You already have a trigger with the following pattern:
Code:
@tank {bruises||massacres|misses|obliterates|pierces|places|pounds|pulverizes|sends|slashes|smashes|smites|stabs}

In the Package editor, give this trigger an Identifier (you can do this at the bottom of the Package Editor window, when you have the trigger opened for editing). Let us suppose you give it the name "assisttrigger". Next, you add the following line somewhere within the code for the trigger:
Code:
#T- assisttrigger

It can be anywhere in the code, as long as it is _always_ executed. In other words, don't put it within a conditional statement like #IF. Now, in the second trigger for resetting it, you add the line:
Code:
#T+ assisttrigger

The command #T- will disable a trigger/alias/class/etc. It will work even within the trigger itself. Disabling it simply means it will not test any further lines from the mud--if it is executed within the trigger itself, it won't prevent the rest of the trigger code from completing. #T+ will enable a trigger/alias/class/etc. You don't need a variable to control this.
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Thu Sep 23, 2010 8:12 pm   
 
worked liked a charm thx a lot :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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