Register forum user name Search FAQ

Gammon Forum

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 ➜ General ➜ Failed spells, help this newbie!

Failed spells, help this newbie!

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by ErockMahan   (81 posts)  Bio
Date Thu 10 Jun 2004 10:58 PM (UTC)
Message
I have been using MushClient for a long time, and I have been terribly impressed. I've been reading some of these posts and have learned lots and lots. You guys are great, and I'm glad for the help you've given me, though you've never done so directly. I'll stop kissing up and cut to the chase.

I hate it when I fail a spell and I want to find some way to make it so that I will automatically re-cast when I fail. If it makes things easier, the spells I want to have this work with are all trigger-based.

------------------------------
Example:

You are hungry.

(TRIGGER:) cast 'satiate'

You lost your concentration!

You starve to death.

You are dead! R.I.P.
------------------------------

Now, that doesn't really happen, but it is a good example of what I am facing and what I'd like to prevent.

If anyone can help me (or even if EVERYONE can) please try to keep your answers relatively simple. Because I am still new to this coding world, I have no idea how the Planet.output(trigger) whatever works. I am used to opening up the particular window and clicking on the neat little "new" button (like for triggers or macros, etc.)

Thank you very much for your help everyone! Again, if you can provide a solution to the problem as presented above, that will be more than enough for me to adapt it to my particular situations. Thank you very much!
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #1 on Fri 11 Jun 2004 04:11 AM (UTC)
Message
Make an alias that matches "cast '*'", then send to variable @cast, for example. Make a trigger that matches on "You lost your concentration!" and make it send "cast @cast" and check "evaluate variables". Simple as that :p

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,051 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 11 Jun 2004 08:05 AM (UTC)
Message
That is a good idea, but as it stands will only set the variable but not cast the spell.

Instead, make the alias:

Match: cast *

Send:

Send "cast '%1' "
SetVariable "cast", "%1"

Sent to: script

This will send the "cast" command to the MUD, *and* set the variable "cast". Then the trigger that matches "You lost your concentration!" can re-cast it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #3 on Fri 11 Jun 2004 04:55 PM (UTC)
Message
Ah yes, sorry. I didn't remember that the alias would catch that.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by ErockMahan   (81 posts)  Bio
Date Reply #4 on Fri 11 Jun 2004 10:51 PM (UTC)
Message
Well that seems like it would work, but I'm afraid I'm a little too ignorant for it to be that simple. I tried implementing the alias (seemed simple enough) and I got this message when I tried it:

Send-to-script cannot execute because scripting is not enabled.

Now, being the clever kid that I am, I found the "scripts" thing, opened it, and clicked the box "enable script." (by the way, it seems to have a default of Visual Basic)

But now I get this:

error: -2146828275
Event: Execution of line 1 column 1
Description: Type mismatch: 'cast'
Line in error:
Called by: Immediate execution


Help me, oh wise and powerful Mushclient users!
Top

Posted by Nick Gammon   Australia  (23,051 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 11 Jun 2004 11:20 PM (UTC)
Message
Yes, VB is correct. Can you copy the actual alias and paste it here? Click the "copy" button in the list of aliases.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #6 on Fri 11 Jun 2004 11:30 PM (UTC)
Message
Send "cast '%1' "
SetVariable "cast", "%1"

You need to put that in the send box, not JUST

"cast '%1' "
SetVariable "cast", "%1"

I think that mightve been what you did. I guess when you post we'll know for sure, but thats what it looks like from the error. When you send to the script, you have to tell the script, to send it to the world. Although you just took off the initial send thinking that was us indicating where you should put it.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by ErockMahan   (81 posts)  Bio
Date Reply #7 on Sun 13 Jun 2004 11:46 PM (UTC)
Message
That looks much more complicated like that than it does in MushClient.

Now, the trick I'm trying to figure out is what to have the trigger execute. It's pretty much fill-in-the-blank from here, I think. I just don't know what to fill in to make it work now. The trigger is here below:

<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="You lost your concentration!"
regexp="y"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>cast %1</send>
</trigger>
</triggers>

Thanks for your help thus far, everyone! (and yes, the problem was that I didn't put in the "Send" words and the like.) Thanks again!
Top

Posted by ErockMahan   (81 posts)  Bio
Date Reply #8 on Sun 13 Jun 2004 11:51 PM (UTC)
Message
Alright, we're making some serious progress now! Even with the alias, i can successfully cast spells I already know. This is the alias:

<aliases>
<alias
match="cast *"
enabled="y"
send_to="12"
sequence="100"
>
<send>Send &quot;cast %1&quot;
SetVariable &quot;cast&quot;,&quot;%1&quot;</send>
</alias>
</aliases>

Top

Posted by Nick Gammon   Australia  (23,051 posts)  Bio   Forum Administrator
Date Reply #9 on Mon 14 Jun 2004 02:37 AM (UTC)

Amended on Mon 14 Jun 2004 02:40 AM (UTC) by Nick Gammon

Message
The trigger would look like this:


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="You lost your concentration!"
   regexp="y"
   sequence="100"
  >
  <send>cast @cast</send>
  </trigger>
</triggers>


Sending "cast @cast" and checking "expand variables" means that the contents of the "cast" variable will be substituted for "@cast".

Maybe it should be:

Send: cast '@cast'

In case the spell is more than one word.

And probably lose the line:

regexp="y"

This trigger doesn't really look like a regular expression. If you leave that checked then if someone says it, it will still match, eg.

Nick says, 'You lost your concentration!'

The trigger would match that, because a regexp (the way you have written it) will match anywhere on the line.

So, my amended version would be:


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="You lost your concentration!"
   sequence="100"
  >
  <send>cast '@cast'</send>
  </trigger>
</triggers>



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

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.


23,602 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.