[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Multi line trigger + vbscript

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Multi line trigger + vbscript

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Ashass   (50 posts)  [Biography] bio
Date Wed 01 Dec 2010 04:45 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Reply #1 on Wed 01 Dec 2010 05:02 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Ashass   (50 posts)  [Biography] bio
Date Reply #2 on Wed 01 Dec 2010 05:05 AM (UTC)  quote  ]
Message
That... was surprisingly easy, thanks!
[Go to top] top

Posted by Ashass   (50 posts)  [Biography] bio
Date Reply #3 on Wed 01 Dec 2010 05:15 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Reply #4 on Wed 01 Dec 2010 05:33 AM (UTC)  quote  ]

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
[Go to top] top

Posted by Ashass   (50 posts)  [Biography] bio
Date Reply #5 on Wed 01 Dec 2010 05:49 AM (UTC)  quote  ]
Message
How do you tell it to draw below?
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Reply #6 on Wed 01 Dec 2010 06:08 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Wed 01 Dec 2010 07:22 AM (UTC)  quote  ]
Message
Also:

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

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


2,451 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]