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 ➜ Question about triggers/variables

Question about triggers/variables

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


Posted by Penguin   (46 posts)  Bio
Date Tue 17 Jun 2003 11:03 AM (UTC)
Message
Hi,

I wish to set up a trigger to set a variable as something. On the mud it looks something like this:

Someone invited you to join his(or her) party.

So I set a trigger like
^(.*?) invited you to join (his|her) party\.?

And a script with

world.setvariable "partyinviter", arrwildcards (1)

Seems simple enough? Unfortunately life's a bitch. And I have prompts which show my HP/EP which appear sometimes.
Ex.

HP:230 EP:230 Someone invited you to joins his party.

How then would I be able to set my partyinviter variable as "Someone" instead of "230"?
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #1 on Tue 17 Jun 2003 05:39 PM (UTC)
Message
Common issue. I was able to fix it by adding a newline to the end of all prompts. I later had to find out from a admin that there was also a hidden command to remove the extra space it insisted on adding to the end of the prompt, even when it finished on a new line, but.... lol

However, assuming you can't do that then I would suggest this:

^(\S*\s\S*\s)?(.+?) invited you to join (his|her) party\.?

and

world.setvariable "partyinviter", arrwildcards(2)

Using \S means it will match no matter the character used, unless it is a space. \s is the opposite.
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #2 on Tue 17 Jun 2003 10:29 PM (UTC)
Message
Shadowfyr, (this is a bit offtopic for the thread, but anyway) what command removes the extra space? Ive found it easier to just add the newline too, and I just gagged lines that were JUST a space (the extra prompt line) but then had to add a optional space at the beginning of all/most of my triggers, which is rather annoying. So, whats the command? Maybe itll work on my mud too.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #3 on Tue 17 Jun 2003 11:59 PM (UTC)
Message
Depends on you mud. For mine it was '$_' or '_$', I think... It has been some time since I changed my prompt to use it. Some muds may not have any way to do it. This is with MUDOS and the TMI-2 library, so it is a guess as to if any others use the same syntax.
Top

Posted by David B   USA  (80 posts)  Bio
Date Reply #4 on Wed 18 Jun 2003 04:21 AM (UTC)
Message
You can also set it up as a regular expression. that ignores the prompt completely.

My code(with a LOT of Nicks help) to fame:

sub OnAutoCombo (TriggerName, TriggerLine, arrWildCards)
dim AutoCombo
AutoCombo = split (arrWildCards (1))
Dim i, attack
for i=lbound (AutoCombo ) to ubound (AutoCombo )
Select Case AutoCombo (i)
case "rp" attack = "punch right"
case "lp" attack = "punch left"
case "s" attack = "sweep"
case "r" attack = "roundhouse"
case else attack = "" ' unknown attack type
End Select
if i = ubound (AutoCombo ) then
world.send "throw " + world.getvariable ("attacker") + " down"
else
world.send attack + " " + world.GetVariable ("attacker")
end if
next
end sub
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #5 on Wed 18 Jun 2003 11:55 PM (UTC)
Message
That already IS a regular expression. The simplest thing you could do is remove the ^ from the beginnging. That way it'll match anything before it.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
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.


21,732 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.