trigger Note and Simulate

Posted by Mahony on Wed 17 Sep 2014 07:55 PM — 8 posts, 30,209 views.

#0
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
Australia Forum Administrator #1
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.
#2
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...
Amended on Wed 17 Sep 2014 08:42 PM by Mahony
USA Global Moderator #3
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.
Amended on Thu 18 Sep 2014 04:15 PM by Fiendish
#4
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")
Amended on Thu 18 Sep 2014 06:51 PM by Mahony
USA #5
You need to escape the \ so you'd need to do \\n\\r, at least I'm pretty sure that's right
USA Global Moderator #6
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.
Amended on Thu 18 Sep 2014 07:21 PM by Fiendish
Australia Forum Administrator #7
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?