Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ Tips and tricks
➜ Timer/Trigger
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Racerzx3
(2 posts) Bio
|
Date
| Thu 28 Feb 2008 02:17 AM (UTC) |
Message
| 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. | Top |
|
Posted by
| StuDraKi
Germany (17 posts) Bio
|
Date
| Reply #1 on Thu 28 Feb 2008 03:58 PM (UTC) |
Message
| 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? | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #2 on Thu 28 Feb 2008 07:41 PM (UTC) |
Message
| If the casting spells and attacking come from the same trigger, you could make it conditional, something like this (in scripting):
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:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #3 on Thu 28 Feb 2008 08:17 PM (UTC) |
Message
| 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. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Racerzx3
(2 posts) Bio
|
Date
| Reply #4 on Fri 29 Feb 2008 10:55 PM (UTC) |
Message
| 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #5 on Sat 01 Mar 2008 04:18 AM (UTC) |
Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #6 on Sat 01 Mar 2008 04:46 AM (UTC) |
Message
| |
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
25,995 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top