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 ➜ Total noob needs help

Total noob needs help

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


Pages: 1 2  

Posted by Treant   USA  (10 posts)  Bio
Date Wed 26 Aug 2009 04:55 AM (UTC)

Amended on Wed 26 Aug 2009 05:14 AM (UTC) by Treant

Message
Hello, New to the forum, new to scripting and what have you.

Needing major help ( practically need someone who's feeling nice to build it for me )

Theres a spell in the mud that I play that will tell you where the enemies are if they're in the same zone as you and it appears like this


You can momentarily see in all directions..
*Duke Treant*                       Inside Kael's North Walls
  Duke Zebulon                       General's Annex Room
<6395/6395Hp 2964/3072Mp 1290/1290Mv>NESW 2401 


I need the script to report to group via GT ( group tell ) the enemy's name and the enemy's location the enemy has the * * around his name, friendlies show up with the spell but do not have the asteriks

I have no idea where to begin on this.
Top

Posted by Blainer   (191 posts)  Bio
Date Reply #1 on Wed 26 Aug 2009 06:41 AM (UTC)
Message
Template:post=9626 Please see the forum thread: http://gammon.com.au/forum/?id=9626.

Until one of the experts replies here you might want try creating triggers for the spell. The link above is a great movie that step-by-steps through the process.
Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

If you have trouble with getting the triggers to work you can paste them here for help using the info from the above link.
Top

Posted by Treant   USA  (10 posts)  Bio
Date Reply #2 on Wed 26 Aug 2009 07:28 AM (UTC)

Amended on Wed 26 Aug 2009 07:29 AM (UTC) by Treant

Message
I Kind of have it working..

You can momentarily see in all directions..
Reyven South-East Training Field
gt Reyven is at South-East Training Field

I got this to work by replacing Reyven with * and South-East Training field with another *

^(.*?)                       (.*?)$

there is not always the same amount of spaces between name and location, is there a variable to assume the role of spaces untill the first letter of another appears? and Reyven is a friendly, enemies start with a * so what would i have to do to allow a * to appear as a regular charachter for the trigger to extract?
Top

Posted by Treant   USA  (10 posts)  Bio
Date Reply #3 on Wed 26 Aug 2009 07:47 AM (UTC)

Amended on Wed 26 Aug 2009 07:50 AM (UTC) by Treant

Message

^\*(.*?)(.s)(.*?)$


So the (.s) would replace all of the spaces and with \* it will only catch lines that start with a *

then i have


gt *%1 is at %3


as the send to output BUT lines starting with * arent only found on the spell, decoy's sitting around appear with the * before and after their name as well as enemies you would just run into while walking around..

so I need the trigger to only fire on lines starting with * but after the line

You can momentarily see in all directions..





<6395/6395Hp 2806/3072Mp 1290/1290Mv>NESW 2401 You can momentarily see in all directions..
Reyven                       South-East Training Field
*Duke Treant*                       Training Grounds


another issue i see is that sometimes the command prompt will appear on the same line as "you can momentarily see in all directions.." and sometimes it wont..
Top

Posted by Treant   USA  (10 posts)  Bio
Date Reply #4 on Wed 26 Aug 2009 08:03 AM (UTC)
Message

<6395/6395Hp 2878/3072Mp 1290/1290Mv>NESW 2401 ee
You can momentarily see in all directions..
Reyven                       South-East Training Fieldgt Eagle Eye Complete Enemy Locations are as Follows.
gt Reyven                       South-East Training Field
gt 
Treant                       Cobblestone Street leading into Kaelgt Eagle Eye Complete Enemy Locations are as Follows.
gt Reyven                       South-East Training Field
gt Treant                       Cobblestone Street leading into Kael

<6395/6395Hp 2842/3072Mp 1290/1290Mv>NESW 2401 You tell the group '[Wood]  Eagle Eye Complete Enemy Locations are as Follows.'

<6395/6395Hp 2842/3072Mp 1290/1290Mv>NESW 2401 You tell the group '[Wood]  Reyven                       South-East Training Field'

<6395/6395Hp 2842/3072Mp 1290/1290Mv>NESW 2401 You tell the group '[Wood]  '

<6395/6395Hp 2842/3072Mp 1290/1290Mv>NESW 2401 You tell the group '[Wood]  Eagle Eye Complete Enemy Locations are as Follows.'

<6395/6395Hp 2842/3072Mp 1290/1290Mv>NESW 2401 You tell the group '[Wood]  Reyven                       South-East Training Field'

<6395/6395Hp 2842/3072Mp 1290/1290Mv>NESW 2401 You tell the group '[Wood]  Treant                       Cobblestone Street leading into Kael'



^You can momentarily see in all directions\.\.\n(.*?)\n(.*?)\Z$


Ok I'm getting the double feed issue, and what do I do if there are more than just 2 people in the report?
Top

Posted by Blainer   (191 posts)  Bio
Date Reply #5 on Wed 26 Aug 2009 08:18 AM (UTC)
Message
Full regular expression help can be found here.
Template:regexp Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.

Top

Posted by Blainer   (191 posts)  Bio
Date Reply #6 on Wed 26 Aug 2009 08:21 AM (UTC)

Amended on Wed 26 Aug 2009 08:22 AM (UTC) by Blainer

Message
treant said:

So the (.s) would replace all of the spaces and with \* it will only catch lines that start with a *

\s+ will match one or more spaces.
\s* will match zero or more spaces.
Top

Posted by Blainer   (191 posts)  Bio
Date Reply #7 on Wed 26 Aug 2009 08:26 AM (UTC)

Amended on Wed 26 Aug 2009 11:40 AM (UTC) by Nick Gammon

Message
You can paste the triggers you are working to the forum.
Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #8 on Wed 26 Aug 2009 09:16 PM (UTC)
Message
Treant said:

Ok I'm getting the double feed issue, and what do I do if there are more than just 2 people in the report?


I wouldn't use a multi-line trigger myself, that will be fiddly for an unknown number of people. Can't you just have a single-line trigger, and do one GT per enemy? If not, you would need to "batch them up" as they arrive, and then when something else (eg. a prompt) arrives, send the names via the GT.

If you are having trouble, please copy and paste what you have so far, as Blainer suggested.

- Nick Gammon

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

Posted by Treant   USA  (10 posts)  Bio
Date Reply #9 on Thu 27 Aug 2009 03:25 AM (UTC)
Message
Nick Gammon said:

Treant said:

Ok I'm getting the double feed issue, and what do I do if there are more than just 2 people in the report?


I wouldn't use a multi-line trigger myself, that will be fiddly for an unknown number of people. Can't you just have a single-line trigger, and do one GT per enemy? If not, you would need to "batch them up" as they arrive, and then when something else (eg. a prompt) arrives, send the names via the GT.

If you are having trouble, please copy and paste what you have so far, as Blainer suggested.


I could and would definately love to have the trigger GT for each enemy that appears, the enemy appears with *Count Duke* (bunch of spaces) Location then goes to a new line. I dont know how to make the trigger catch the name in this certain format, because what If i am walking around and just see them in a room, *count duke* is here., i don't need it to report in that case, only when the spell is used to see the name.
Top

Posted by Treant   USA  (10 posts)  Bio
Date Reply #10 on Thu 27 Aug 2009 03:30 AM (UTC)
Message
In essence, what I'm asking, how to make it ONLY catch a line that looks like


*Countess Klara*                        Annexed Planning Room


there will always be multiple spaces, where as if you walk into a room and see them it looks like this.


*Duke Treant* is here.

Top

Posted by Fadedparadox   USA  (91 posts)  Bio
Date Reply #11 on Thu 27 Aug 2009 03:39 AM (UTC)

Amended on Thu 27 Aug 2009 03:41 AM (UTC) by Fadedparadox

Message
Assuming the first asterisk starts the line, and the location ends it, this would match and put the name in %1, the location in %2.


^\*(.+?)\*\s+(.+)$

Keep it off by default. Turn it on when you see the 'You can momentarily see in all directions..' line, have it temporarily save all information you want to send. Send it however you need it, and turn it off, on the next prompt.

explanation:
^ means start of line
\* matches an asterisk
(.+?) matches anything, but is non-greedy (it'll stop as soon as possible) and the () sends it to %1
\* matches another asterisk, and stops the previous
\s+ matches any number of spaces, and will keep going until it finds something that isn't a space
(.+) matches anything, and starts at the end of the spaces
$ means end of line
Top

Posted by Treant   USA  (10 posts)  Bio
Date Reply #12 on Thu 27 Aug 2009 05:05 AM (UTC)

Amended on Thu 27 Aug 2009 05:12 AM (UTC) by Treant

Message

<triggers>
  <trigger
   enabled="y"
   group="Eagle Eye/Farsight"
   keep_evaluating="y"
   match="^\*(.*)\*\s+(.*)$"
   regexp="y"
   sequence="100"
  >
  <send>gt *%1* is at %2</send>
  </trigger>
</triggers>


If i added [^is here\.] to the match so that it would look like


match="^\*(.*)\*\s+([^is here\.].*)$"


Would that make it match Anything starting a line with a *Name* (spaces) Anything except [is here.]
I dont need it to single out the letters i s h e and r. I need it to single out the phrase [is here.] such as

*Duke Treant* is here. <---
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #13 on Thu 27 Aug 2009 05:54 AM (UTC)
Message
No, the square brackets look for a set. However you are on the right general track.

Template:regexp Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.


Look for "lookahead assertions" (negative).


<triggers>
  <trigger
   enabled="y"
   group="Eagle Eye/Farsight"
   keep_evaluating="y"
   match="^\*(.*)\*\s+(?!is here\.)(.*)$"
   regexp="y"
   sequence="100"
  >
  <send>gt *%1* is at %2</send>
  </trigger>
</triggers>


The above seemed to work when I tested it. It looks for the thing in asterisks, followed by anything, *except* "is here.".

- Nick Gammon

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

Posted by Treant   USA  (10 posts)  Bio
Date Reply #14 on Thu 27 Aug 2009 06:42 AM (UTC)

Amended on Thu 27 Aug 2009 06:45 AM (UTC) by Treant

Message
finally got it working properly ( as far as i can test it so far )


<triggers>
  <trigger
   enabled="y"
   group="Eagle Eye/Farsight"
   keep_evaluating="y"
   match="^\*(.*)\*([^yells]\s+)([^is here\.].*)$"
   regexp="y"
   sequence="100"
  >
  <send>gt {C*%1*{G is at {C%3{x</send>
  </trigger>
</triggers>


Thanks for the help everyone.

In case you are wondering why Yells is in there where it is, its because i found enemies, eagle eye'd to see them, it reported, but they saw me and started yelling back.. it thought it was also reporting since they didnt yell "is here." so I added yells in there and modified it to skip wildcard 2 and use 3 in the return line.

Oh, the {C and {G whatever, are color strings for the mud i play, so ignore those in the return line too.
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.


62,274 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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.