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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  trigger Note and Simulate
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

trigger Note and Simulate

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


Posted by Mahony   (27 posts)  [Biography] bio
Date Wed 17 Sep 2014 07:55 PM (UTC)
Message
Hi
I have a trigger that sends some text to mud and I would like to color this text with another trigger. I found that the only way to do it is use Simulate. Even it was designed for other purposes... The trigger is very simple. It sends just some text so basicaly it is Simulate("Hello"). But it puts the text at the end of the line instead on the new line.
Like:
Naga is here.Hello

When I exchange Simulate to Note all is ok
Naga is here.
Hello

But I can't use Note..
Why does Simulate and Note behave diffently and how to force Simulate to write on new line?

Thank you
[Go to top] top

Posted by Nick Gammon   Australia  (21,324 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 17 Sep 2014 08:03 PM (UTC)
Message
You could put a newline at the start, but what do you mean you want to colour text you are sending to the MUD? Don't you want to colour something you receive from the MUD?

Simulate is intended for debugging, using it in a trigger might cause text to be inserted in unexpected places.

You should be able to omit an incoming line, and then ColourNote it in the colours you want.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Mahony   (27 posts)  [Biography] bio
Date Reply #2 on Wed 17 Sep 2014 08:30 PM (UTC)

Amended on Wed 17 Sep 2014 08:42 PM (UTC) by Mahony

Message
Yes. I want to colour the text that I send to mud. So in my simplified example I want to colour the word Hello by another trigger.

I try to explain more the whole purpose. I have a trigger that colors my gquest mobs (Aardwolf mud). It works fine. I have a text file with mob-area relation. I search the file for a gq mob and then I print the results and I want to colour the gq mob name in the results.

example:
gq mob is "a heavy goblin"
I search goblin
I get results from my text file
the young goblin
the heavy goblin
white goblin
a heavy goblin
etc

I want my "a heavy goblin" to be coloured.
In zmud it worked fine if I printed the results with #sa. The trigger fired and coloured the gq mob...
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #3 on Thu 18 Sep 2014 03:56 PM (UTC)

Amended on Thu 18 Sep 2014 04:15 PM (UTC) by Fiendish

Message
Quote:
Yes. I want to colour the text that I send to mud.

No you don't. You want to colour the text that you send to the output window.

Quote:
Why does Simulate and Note behave diffently

Why do a giraffe and a cucumber behave differently?

Quote:
and how to force Simulate to write on new line?

I think the problem here is not that Simulate doesn't write on a new line. It's that the previous Simulate doesn't END with a new line. Note always forces a line break at the end of everything you send. Simulate does not. So end all of your Simulates with
.."\r\n"


Simulate behaves more like Tell than Note. Tell also does not break the line at the end.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Mahony   (27 posts)  [Biography] bio
Date Reply #4 on Thu 18 Sep 2014 06:39 PM (UTC)

Amended on Thu 18 Sep 2014 06:51 PM (UTC) by Mahony

Message
ad Quote1 - you are right. My bad. Sry
ad Quote2 - Taht was not nice of you
ad Quote3 - You mean Simulate("Hello" .. "\r\n") That doesnt work... [string "Trigger: "]:1: unfinished string near '"'

And also I don't need new line after Hello but before. As written in my original post. So tried Simulate("\n" .. "Hello") with the same error.
Finally find out how - Simulate("\\n" .. "Hello")
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #5 on Thu 18 Sep 2014 06:51 PM (UTC)
Message
You need to escape the \ so you'd need to do \\n\\r, at least I'm pretty sure that's right

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #6 on Thu 18 Sep 2014 07:17 PM (UTC)

Amended on Thu 18 Sep 2014 07:21 PM (UTC) by Fiendish

Message
Mahony said:

ad Quote2 - Taht was not nice of you

Eh. You're asking why two different things are different. The answer is because they are different.

Quote:

And also I don't need new line after Hello but before.

I use Simulate in a number of places in the Aardwolf client package. I've never needed to break the line before it, only after.
See:

https://github.com/fiendish/aardwolfclientpackage/search?q=Simulate

My best guess is that the line right before your Hello is either a Tell or a previous Simulate. If it's a Tell, you should be using Note. If it's a previous Simulate, then the problem is that the previous simulate did not end in a line break. Or maybe you have inadvisably set the "Keep Commands On Prompt Line" configuration option, which will break all kinds of things and should never be used.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,324 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Thu 18 Sep 2014 08:51 PM (UTC)
Message
Mahony said:

Why does Simulate and Note behave diffently ...


One was intended for debugging. It literally sends what you enter to the client, simulating stuff arriving from the MUD. You can put telnet sequences there, ANSI sequences, newlines, anything.

Note is intended to put notes to yourself on the screen, and to be nice to you, it automatically adds a newline to the end.

If they behaved the same, we wouldn't need two different functions, eh?

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


4,623 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]