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.
 Entire forum ➜ MUSHclient ➜ VBscript ➜ need some help

need some help

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


Posted by Shou   USA  (30 posts)  Bio
Date Sun 01 Aug 2010 10:24 PM (UTC)
Message
i have been wondering for some time now, if you can gag a message on Mush, and not leave a blank line with a prompt under it. if you can help me, thanks!

My computer once beat me at chess, but it was no match for me at kickboxing.
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #1 on Mon 02 Aug 2010 03:19 AM (UTC)
Message
Yup, but it'll be a little bit of scripting...

Basically you're going to trig your prompt line, omit that from output, and write a script to ColourNote it again.

Then in your gag triggers, have a script that sets a boolean.

Then modify your prompt tigger checking If PreviousLineGagged then PreviousLineGagged=false else ColourNote ... end

so your prompt is only re-echoed after lines that aren't gagged...
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #2 on Mon 02 Aug 2010 04:26 AM (UTC)
Message
Since you're using a variable to test if the prompt should be gagged, you can just use the enabled/disabled state of the prompt gagger itself:

<triggers>
  <trigger
   keep_evaluating="y"
   match="^prompt, goes, here$"
   name="prompt_gag"
   omit_from_log="y"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="1"
  >
  <send>EnableTrigger("prompt_gag", false)</send>
  </trigger>
</triggers>


When you want the prompt to be gagged, use EnableTrigger("prompt_gag"). It'll automatically disable itself afterwards. No ugly re-echoing cruft needed.

'Soludra' on Achaea

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

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #3 on Mon 02 Aug 2010 04:51 AM (UTC)
Message
oh yea, better idea.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 02 Aug 2010 04:59 AM (UTC)
Message
The blank lines are a bit of a problem, mainly because the MUD tries to be smart ... it knows you have a prompt, so it sends a blank line to start a new line before sending the prompt. Even though you omit the prompt you are still left with the blank line.

I sometimes resort to using the Omit_Blank_Lines plugin - that omits all blank lines. This isn't too bad, and it saves blank lines annoyingly appearing in your output.

Template:post=8768 Please see the forum thread: http://gammon.com.au/forum/?id=8768.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shou   USA  (30 posts)  Bio
Date Reply #5 on Mon 02 Aug 2010 05:09 AM (UTC)
Message
ok thanks alot. now, how exactly do i gag a message by itself? i should have reworded my question. i needed to know how to gag it, and how to remove the prompt too. thanks for the help earlier!

My computer once beat me at chess, but it was no match for me at kickboxing.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #6 on Mon 02 Aug 2010 05:34 AM (UTC)

Amended on Mon 02 Aug 2010 05:35 AM (UTC) by Twisol

Message
You check the "Omit line from output" checkbox on the right side of the trigger dialog, which is what the exported trigger I posted above has.

Also, I realized that you posted in the VBscript forum, and I stupidly gave a script in Lua. The VBscript syntax, I'm fairly sure, would be:
world.EnableTrigger("prompt_gag", false)

And you'd use this in another trigger to enable it:
world.EnableTrigger("prompt_gag", true)

I think the 'world.' prefix is important in VBscript, no?

'Soludra' on Achaea

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

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #7 on Mon 02 Aug 2010 06:00 AM (UTC)
Message
No. Not for about 5 years (or maybe 10). It assumes 'world.". The only place you need it is world.Execute because Vbscript has an Execute.

However I think it is vbTrue rather than "true". Or just put a 1 there I think.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #8 on Mon 02 Aug 2010 07:24 AM (UTC)

Amended on Mon 02 Aug 2010 07:40 AM (UTC) by Nick Gammon

Message
w3schools [1] says it's True, although True seems to equal -1 and False equals 0, so I assume any non-zero value will be taken as a truth value.

Thanks for correcting me on the 'world.' part!

[1] http://www.w3schools.com/vbscript/vbscript_ref_keywords.asp

'Soludra' on Achaea

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

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #9 on Mon 02 Aug 2010 07:43 AM (UTC)
Message
According to the VBscript help file:


Since these constants are built into VBScript, you don't have to define them before using them. Use them anywhere in your code to represent the values shown for each.


Constant Value Description

vbUseDefault -2 Use default from computer's regional settings.

vbTrue -1 True

vbFalse 0 False


However it also says:


The True keyword has a value equal to -1.

The False keyword has a value equal to 0.


All the examples I had seen used vbTrue and vbFalse, however since they seem to have the same values as True and False, it seems you can use them interchangeably.

As for the "world." bit - that is set up as a "default object" or some such thing. Some of my examples use world.Note and so on, as they were written before I stumbled across that. :)

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


29,824 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.