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 ➜ Lua ➜ Newlines & Omitting Them

Newlines & Omitting Them

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


Posted by Aidyn.Hartfire   USA  (15 posts)  Bio
Date Thu 11 Sep 2008 09:20 AM (UTC)
Message
Alright, this is the fourth time I've tried to make this post so hopefully it goes through. At any rate, I've been mulling over this idea for quite some time now but I can't seem to find a solid way to execute it. Essentially what I want to do is take any given newline, make it go "bye-bye", and replace it with a ColourNote. I'll give an example of a bit of the code for the newline (without the omission, of course).



  <trigger
   enabled="y"
   expand_variables="y"
   group="Diagnosis"
   ignore_case="y"
   match="^\&quot;(.*?) leg lashed in thorny vines\.\&quot;$"
   name="Vines"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if "%1" == "right" then
   SetVariable ("vines_right", "1")
   ColourNote ("violet", "black", "&lt;&lt;&lt;RIGHT LEG IN VINES: WRITHE&gt;&gt;&gt;")
else
   SetVariable ("vines_left", "1")
   ColourNote ("violet", "black", "&lt;&lt;&lt;LEFT LEG IN VINES: WRITHE&gt;&gt;&gt;")
end--if</send>
  </trigger>


Essentially, as you can tell, as this receives the newline it determines whether or not it is the right or left leg which is tangled, then produces the ColourNote: <<<RIGHT LEG IN VINES: WRITHE>>>. Now, all of that works, however omitting a newline keeps the trigger from being recognized and therefore stops the note from being produced. This, obviously, is counter-productive to the idea behind doing this. I tried sending the data to a new window via the redirector method, however, this stops the note from registering. Does anyone have any idea as to how I can work my way around the problem?

if me = "confused" then
SetVariable ("idiot", "yes")
Send ("choke")
DoAfter (3, "curse")
else Send ("fist pumpage")
end -- if
Top

Posted by Larkin   (278 posts)  Bio
Date Reply #1 on Thu 11 Sep 2008 11:12 AM (UTC)
Message
Unless I've misunderstood what you're trying to do (which sounds to me like you want to substitute the line), you want to add the omit_from_output="y" attribute and change your send_to from 12 to 14.
Top

Posted by Aidyn.Hartfire   USA  (15 posts)  Bio
Date Reply #2 on Thu 11 Sep 2008 11:46 AM (UTC)

Amended on Thu 11 Sep 2008 12:05 PM (UTC) by Aidyn.Hartfire

Message
I could absolutely kiss you right now. I swear I've tried doing that before, but it didn't work right. Maybe I didn't have everything set up just the right way. Anyhow, thanks! You've just helped me take one giant leap towards completing my system. Take care and happy adventures!

if me = "confused" then
SetVariable ("idiot", "yes")
Send ("choke")
DoAfter (3, "curse")
else Send ("fist pumpage")
end -- if
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 11 Sep 2008 09:41 PM (UTC)
Message
Quote:

if me = "confused" then


Unfortunately, your signature won't compile <evilgrin>.

It should read:


if me == "confused" then



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


15,358 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.