Multi line trigger + vbscript

Posted by Ashass on Wed 01 Dec 2010 04:45 AM — 8 posts, 37,951 views.

#0
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.
USA #1
Use "%4", not %4. Leaving the quotes off means it interprets the value as scripting syntax, not as just a value to be used.
#2
That... was surprisingly easy, thanks!
#3
(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
USA #4
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.
Amended on Wed 01 Dec 2010 05:37 AM by Twisol
#5
How do you tell it to draw below?
USA #6
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.

Australia Forum Administrator #7
Also:

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