quick question

Posted by Metsuro on Thu 10 Jun 2004 07:43 AM — 5 posts, 20,896 views.

USA #0
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
USA #1
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.
Australia Forum Administrator #2
A multiple-line trigger may help here. If what you say is in quotes you can probably set one up without too much trouble.
USA #3
<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.
Australia Forum Administrator #4
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.