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 ➜ VBscript ➜ quick question

quick question

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


Posted by Metsuro   USA  (389 posts)  Bio
Date Thu 10 Jun 2004 07:43 AM (UTC)
Message
trying to do an apendtonotepad thing here want it to do multiple lines not just one, like...

(Serpentlords): You say, "Ok i am starting to hate all this crap with cookies
and pies and cakes and candy its so not cool cookies rule!"

if i set it open using the script i get the first line, if i use the option to send to notepad i get nada, just a little help would be nice

Everything turns around in the end
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Thu 10 Jun 2004 08:11 AM (UTC)
Message
Whats your trigger? If you use, well, either way, you can only send at most, whatever your trigger is matching. The mud probably doesnt insert a newline, so its probably all one line (and your client is wrappning it), then you should be able to use just one trigger, if the mud is wrapping for you, things will get more complicated. Well, or you can use multiline triggers.

But, either way, you can only send what you match on. So the problem is probably with your trigger.
Feel free to post them here, we can help you out with the formalities.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 10 Jun 2004 09:18 PM (UTC)
Message
A multiple-line trigger may help here. If what you say is in quotes you can probably set one up without too much trouble.

- Nick Gammon

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

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #3 on Fri 11 Jun 2004 07:00 AM (UTC)
Message
<triggers>
<trigger
match="(Ashura): *"
send_to="12"
sequence="100"
>
<send>world.AppendToNotepad &quot;hi&quot;, &quot;%1&quot; + vbcrlf
</send>
</trigger>
</triggers>

thats the trigger and it only works for the first line.

Everything turns around in the end
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #4 on Fri 11 Jun 2004 11:07 PM (UTC)

Amended on Fri 11 Jun 2004 11:08 PM (UTC) by Nick Gammon

Message
Well, it was a little trickier than I expected to get right, but this should work.

First, make a script file if you don't have one already, and put this into it:


Sub OnChat (name, line, wildcards)
Dim msg
 
  msg = Split (wildcards (10), chr (10))

  For Each m In msg
    AppendToNotepad "Chats", m & vbCrLf
  Next

end Sub



The reason for this script is to split up the incoming line at line feeds, and append them to the notepad with a carriage-return/linefeed combination, otherwise the multiple lines appear as little black squares.

Next, paste in this trigger:


<triggers>
  <trigger
   enabled="y"
   lines_to_match="10"
   match="^\(Serpentlords\): (.*?) &quot;([^&quot;]+)&quot;\Z"
   multi_line="y"
   name="chats"
   regexp="y"
   script="OnChat"
   sequence="100"
  >
  </trigger>
</triggers>



This matches the "Serpentlords" chats, however you can have more than one like this: "Ashura|Serpentlords" (instead of just "Serpentlords").

It then matches up to 10 lines (you can change that) looking for the closing quote symbol, and accepting any characters, including newlines, but excepting the quote symbol itself. The reason for that is to stop the same line matching more than once. It calls OnChat script routine, which then breaks up the matching line and appends it to the notepad window.



- 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.


16,262 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.