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, confirm your email, resolve issues, 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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Trigger with a newline prompt

Trigger with a newline prompt

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


Posted by Helio   (9 posts)  Bio
Date Mon 29 Jul 2002 02:51 PM (UTC)
Message
Hi, I was wondering if it was possible to call from a prompt when a trigger shoots.
Ie:

Without warning Blah stabs you from behind!
<HP:200 EP:200>

So when i see that i want to send to world.
$:has been backstabbed by Blah at HP:200 EP:200 !!

Is that possible?
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #1 on Mon 29 Jul 2002 07:04 PM (UTC)
Message
With scripting yes.. I have had to do something similar on my mud for a few things. What you need is two triggers and a small script like:

Trigger 1->
Match:^Without warning (.*) stabs you from behind!$
Regular Expression: Checked
Label: StabCap
Script: StabCap

Trigger 2->
Match:^<(HP:* EP:*)>$
Regular Expression: Checked
Label: StabOff
Script: StabCap

Script->

sub StabCap (name, output, wildcards)
  if name = "StabCap" then
    world.setvariable "StabName", wildcards(1)
    world.enabletrigger "StabOff", TRUE
  else
    world.send "$:has been backstabbed by " & world.getvariable ("StabName") & " at " & wildcards(1)
    world.enabletrigger "StabOff", FALSE
  end if
end sub


Assuming that I didn't goof someplace... This should work. ;)
Top

Posted by Helio   (9 posts)  Bio
Date Reply #2 on Wed 31 Jul 2002 11:26 AM (UTC)
Message
sorry to tell you , but ur trigger doesnt work... can someone pls help me?!
Thanks
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #3 on Wed 31 Jul 2002 05:46 PM (UTC)

Amended on Wed 31 Jul 2002 05:47 PM (UTC) by Shadowfyr

Message
>Match:^<(HP:* EP:*)>$

Oops.. I did say that I may have goofed. lol The above should have been:
Match:^<(HP:.* EP:.*)>$

As . means any character and * means one of more of them. What I had was :* which is one or more :, so it could only have matched on <(HP: EP:)>, <(HP::: EP::)>, <(HP: EP:::)>, etc.

I really hate regular expressions, but when you somehow manage to get them right they are very accurate. ;)

Oh.. And it help if you meantion 'which' trigger and how it failed, though in this case I assume you figured both had failed and didn't check your variables list to see if the first one actually set StabName. Not a big deal. I find that one easy way to see if a trigger does fire is to set each new trigger to change the text to a custom color (and that custom color to something you don't normally see on a mud like hot pink), then if one fires, but the other fails you can tell immediately where the problem is. ;) Just remember to set the trigger back to no-change when it is working or you end up with a lot of hot pink text. lol
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #4 on Wed 31 Jul 2002 06:41 PM (UTC)
Message
You need to "escape" almost all the punctuation, by proceeding it with a \ character:

^\<(HP\:.* EP\:.*)\>$

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
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.


17,884 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.