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, 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.
 Entire forum ➜ MUSHclient ➜ VBscript ➜ Multi line trigger + vbscript

Multi line trigger + vbscript

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


Posted by Ashass   (50 posts)  Bio
Date Wed 01 Dec 2010 04:45 AM (UTC)
Message
Having a bit of trouble getting my script to output the variable in msgbox format (just a text in order to parse it with writetext from my other topic)

Here's what I have so far:

<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   lines_to_match="7"
   match="^You ask (.*?) for a quest\.\n(.*?) says \'Thank you\, brave Melchaleve\!\'\nYou have asked to find a lost item\.\n(.*?) says \'(.*?)\'\n(.*?)says \'(.*?)\'\n(.*?)says \'(.*?)\'\n(.*?) says \'(.*?)\'$"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>MsgBox "ping"</send>
  </trigger>
</triggers>


When I try to do something like

Msgbox %4
or 5-10

Error is this:
Script error
World: DSL
Execution of line 1 column 12
Immediate execution
Expected end of statement
Line in error: 
MsgBox The High Priest of Althainia 


Trigger text is similar to this

You ask The High Priest of Althainia for a quest.
The High Priest of Althainia says 'Thank you, brave Melchaleve!'
You have asked to find a lost item.
The High Priest of Althainia says 'Vile thieves have stolen a bright green emerald from the royal treasury!'
The High Priest of Althainia says 'My court wizardess, with her magic mirror, has pinpointed its location.'
The High Priest of Althainia says 'Look in the general vicinity of Arena of the Bull Dancers for Bull Pen!'
The High Priest of Althainia says 'You have 48 1/2 hours to complete this quest.'


I really only care about the sentence containing 'Bright green emerald' - 'Arena of the bull dancers for Bull pen' - 'You have 48 1/2 hours'

Capturing the full line of text is fine for simplicities sake, all I need is how to actually access the variables, and I can work out the rest.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Wed 01 Dec 2010 05:02 AM (UTC)
Message
Use "%4", not %4. Leaving the quotes off means it interprets the value as scripting syntax, not as just a value to be used.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #2 on Wed 01 Dec 2010 05:05 AM (UTC)
Message
That... was surprisingly easy, thanks!
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #3 on Wed 01 Dec 2010 05:15 AM (UTC)
Message
(minor) issue - The text is stacking on top of itself - what piece controls how high text is written?


WindowFont "Status", "questtext", "Trebuchet MS", 10, TRUE, FALSE, FALSE, FALSE, 0, 0


---

WindowText "Status", "questtext", "%4", 5, 1, 0, 0,ColourNameToRGB ("white"), false
  WindowShow "Status", true




On a side note, is it possible for the text to word wrap within the window? Currently it's extending off the end of the mush window
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #4 on Wed 01 Dec 2010 05:33 AM (UTC)

Amended on Wed 01 Dec 2010 05:37 AM (UTC) by Twisol

Message
Text placement is (perhaps unfortunately) completely unhandled by MUSHclient. All it knows is where you tell it to draw. If you want to add lines below, you have to position the next line yourself. If you want to word-wrap, you have to cut off the string at the proper length (using WindowTextWidth to test a string so you know where to chop it off) and then draw it below.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #5 on Wed 01 Dec 2010 05:49 AM (UTC)
Message
How do you tell it to draw below?
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #6 on Wed 01 Dec 2010 06:08 AM (UTC)
Message
Using the parameters to the WindowText function. Some of the numbers in there are coordinates. Just increase the 'y' coordinate to move it down.

Template:function=WindowText WindowText

The documentation for the WindowText script function is available online. It is also in the MUSHclient help file.


'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,052 posts)  Bio   Forum Administrator
Date Reply #7 on Wed 01 Dec 2010 07:22 AM (UTC)
Message
Also:

http://www.gammon.com.au/mushclient/mw_text.htm

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


26,861 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.