 |
madhalaster Beginner
Joined: 22 Sep 2010 Posts: 12
|
Posted: 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 |
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: 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. |
|
|
 |
madhalaster Beginner
Joined: 22 Sep 2010 Posts: 12
|
Posted: 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 |
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: 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:
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:
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. |
|
|
 |
madhalaster Beginner
Joined: 22 Sep 2010 Posts: 12
|
Posted: Thu Sep 23, 2010 8:12 pm |
worked liked a charm thx a lot :)
|
|
|
 |
|
|