Failed spells, help this newbie!

Posted by ErockMahan on Thu 10 Jun 2004 10:58 PM — 10 posts, 35,018 views.

#0
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!
Greece #1
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
Australia Forum Administrator #2
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.
Greece #3
Ah yes, sorry. I didn't remember that the alias would catch that.
#4
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!
Australia Forum Administrator #5
Yes, VB is correct. Can you copy the actual alias and paste it here? Click the "copy" button in the list of aliases.
USA #6
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.
#7
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!
#8
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>

Australia Forum Administrator #9
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>