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 ➜ General ➜ Infobar problem. Also, substitutions?

Infobar problem. Also, substitutions?

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


Posted by BC   (4 posts)  Bio
Date Tue 02 Jul 2013 04:31 PM (UTC)
Message
I'm trying to familiarize myself with MUSHclient, as it seems to have all the things I need, among them an Infobar (like in my old client). But I just can't get the Infobar to work correctly, for example I'm trying to set an alias to update and display the current value of the variable @target in the Infobar as follows:

- Alias: tar *
- Send:

world.SetVariable("target", "%1")
world.InfoClear()
world.InfoBackground("green")
world.InfoColour("yellow")
world.InfoFont("FixedSys", 12, 0)
world.Info("Target: ", "@target")

- Send To: Script

The above alias does set the value of @target with what I input (e.g. "tar joe"), but instead of this it displays the previous value of @target in the Infobar. It's always whatever @target was previously, never the one I just set... What am I doing wrong?

Another thing I'd like is substitutions, but I gather these aren't implemented? I tried to search for a method how to do it yourself, but didn't really find clear instructions... I take it a simple trigger defined as "Send to output" would not replace the text, but just output both what came from the mud and the trigger text?
Top

Posted by BC   (4 posts)  Bio
Date Reply #1 on Tue 02 Jul 2013 07:30 PM (UTC)

Amended on Tue 02 Jul 2013 07:54 PM (UTC) by BC

Message
After browsing the forums for possibly related problems, it seems I got the infobar thing working using GetVariable, like this (for anyone wondering the same thing):

- Alias: tar *
- Send:

SetVariable("target", "%1")
InfoClear()
InfoBackground("green")
InfoColour("yellow")
InfoFont("FixedSys", 12, 0)
Info("Target: ", GetVariable("target"))

- Send To: Script


Also regarding substitutions, after some offline testing the below seems to work to substitute just the trigger words, and not the whole line (-> "Using his sword, Bob DISARMS YOU!")?

- Trigger: *disarms you*
- Send: %1DISARMS YOU%2
- Omit from output
- Send to Output
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 03 Jul 2013 09:20 AM (UTC)
Message
BC said:

The above alias does set the value of @target with what I input (e.g. "tar joe"), but instead of this it displays the previous value of @target in the Infobar. It's always whatever @target was previously, never the one I just set... What am I doing wrong?


The substitution of variables is done before the script is executed. Thus changes in the script itself do not affect @target. Use GetVariable if you want to get the latest value.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 03 Jul 2013 09:22 AM (UTC)
Message
BC said:

Another thing I'd like is substitutions, but I gather these aren't implemented? I tried to search for a method how to do it yourself, but didn't really find clear instructions... I take it a simple trigger defined as "Send to output" would not replace the text, but just output both what came from the mud and the trigger text?


One method is "send to output" and then omit the matching line. However then you lose the colouring of the original line.

There are various ways of working around this, but the client basically does not do "input rewriting". It would be easy on straight text (and some plugins do just that) but not so easy if the incoming text has multiple colours in it.

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


14,105 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.