I have made triggers to automatically attack when enemies enter my square, but i also want to cast spells. how can i automatically cast spells only when they are attacking me. sometimes they attack twice in one round, and i only want to cast 1 time.
Timer/Trigger
Posted by Racerzx3 on Thu 28 Feb 2008 02:17 AM — 7 posts, 36,195 views.
How do you define a round?
From your post I have multiple ideas:
within the execution of the "cast spell" trigger you have a at least one line script to disable this trigger.
Either you have another trigger (spell points over a certain minimum) or a timer to enable the cast spell trigger again. In case of a timer, you can configure and start the timer in the script of the cast spell trigger.
Before someone posts a ready to use script solution, is that what you need?
From your post I have multiple ideas:
within the execution of the "cast spell" trigger you have a at least one line script to disable this trigger.
Either you have another trigger (spell points over a certain minimum) or a timer to enable the cast spell trigger again. In case of a timer, you can configure and start the timer in the script of the cast spell trigger.
Before someone posts a ready to use script solution, is that what you need?
If the casting spells and attacking come from the same trigger, you could make it conditional, something like this (in scripting):
That way you only cast it the first time. Obviously, as StuDraKi says, you need to clear this flag when the round (or fight) is over, so you probably need a second trigger that is activated when that happens, and does this:
if not cast_spell_yet then
Send ("cast something")
cast_spell_yet = true
end -- if
That way you only cast it the first time. Obviously, as StuDraKi says, you need to clear this flag when the round (or fight) is over, so you probably need a second trigger that is activated when that happens, and does this:
cast_spell_yet = false
A word of caution here. A lot of muds have rules against botting. Make sure that a script like this is legal on the mud you are playing. This type of script is very easy to test for, and we would hate to see you get in trouble for something so trivial.
As for multiple attacks occuring in one round, there is usually a prompt display between each round on most muds I have played. Simply have the type of trigger Nick suggested turn back on after the prompt is displayed if you need this consitantly on a per round basis.
As for multiple attacks occuring in one round, there is usually a prompt display between each round on most muds I have played. Simply have the type of trigger Nick suggested turn back on after the prompt is displayed if you need this consitantly on a per round basis.
I have tried using scripts, but i can only get them to run once. I play muds alot, i just usually use telnet, so MUSHClient is really confusing. i can't figure out how to make it cast a spell while only in combat.
Well, you make a trigger run a script, then it runs every time the trigger fires (use "send to script" in the trigger configuration). There are many examples here on the forum. Same for an alias.
Basically to make something happen only in combat, you need to know (the client needs to know) if you are in combat or not.
What I would do is use a trigger to detect going into combat (or being in combat), eg. a message like "The kobold hits you for 20 damage" could be turned into a trigger matching "The * hits you for * damage" and in that trigger you do "send to script", and in the send field put something like "in_combat = true".
Then you need to know when you have left combat, for example "The kobold is dead! You get 100 experience" could be matched by a trigger "The * is dead! You get * experience", and then you set in_combat to be false.
Some MUDs, like SMAUG, have a different "combat" prompt, so you could simply detect which sort of prompt you have got with triggers, and react accordingly.
See http://www.mushclient.com/scripting for some general guidance on doing scripting.
Basically to make something happen only in combat, you need to know (the client needs to know) if you are in combat or not.
What I would do is use a trigger to detect going into combat (or being in combat), eg. a message like "The kobold hits you for 20 damage" could be turned into a trigger matching "The * hits you for * damage" and in that trigger you do "send to script", and in the send field put something like "in_combat = true".
Then you need to know when you have left combat, for example "The kobold is dead! You get 100 experience" could be matched by a trigger "The * is dead! You get * experience", and then you set in_combat to be false.
Some MUDs, like SMAUG, have a different "combat" prompt, so you could simply detect which sort of prompt you have got with triggers, and react accordingly.
See http://www.mushclient.com/scripting for some general guidance on doing scripting.