Infobar problem. Also, substitutions?

Posted by BC on Tue 02 Jul 2013 04:31 PM — 4 posts, 14,844 views.

#0
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?
#1
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
Amended on Tue 02 Jul 2013 07:54 PM by BC
Australia Forum Administrator #2
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.
Australia Forum Administrator #3
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.