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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Jscript
. . -> [Subject]  Two triggers printing stuff on the same line?

Two triggers printing stuff on the same line?

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


Posted by John   Australia  (13 posts)  [Biography] bio
Date Wed 18 Apr 2007 03:33 AM (UTC)

Amended on Wed 18 Apr 2007 07:06 AM (UTC) by John

Message
I've got this trigger: url=http://arm.theurulives.com/help.mct not working for some reason. If I don't have a space after ST when printing it to the output window, it puts ST on the beginning of the second line.

Is there a way to get all of the info printed out by both of these triggers all on one line while keeping intact the colors?

To test it put this in the test trigger window:
\0A104/104 HP, 118/118 MP, 108/118 MV, 96/96 ST\0Asirihish | walking | unarmed | neutral | riding: none | sitting>\0A

I'm using JScript for my scripting.

Thanks
John
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 18 Apr 2007 04:25 AM (UTC)
Message
If you login to the forum, there is an edit button on your posts.

I see the problem here - you have 2 triggers, each doing a series of ColourTell calls, which should therefore not start a new line.

However what is happening is that you get this:


104/104 HP, 118/118 MP, 108/118 MV, 96/96 ST

... which you are displaying as:

104/104 HP, 108/118 MV, 96/96 ST

... then this arrives:

sirihish | walking | unarmed | neutral | riding: none | sitting>

... which you display as:

sirihish | walking | unarmed | neutral | riding: none | sitting>


The problem here is that even with "Omit from Output" set, the line is *initially* added to the output, because triggers don't match until the end of the line. This initial adding causes the first note to be terminated. Then the trigger fires, and omits the line, however by now it is too late to append to the previous line.

What I suggest you do (I tested it and it works fine), is to copy the stuff from the first trigger that actually does the displaying, and put it at the start of the second trigger script.

In other words, the first trigger script just does this:


var chp = %1;
var mhp = %2;
var cmp = %3;
var mmp = %4;
var cmv = %5;
var mmv = %6;
var cst = %7;
var mst = %8;

var php = (chp/mhp)*100;
var pmv = (cmv/mmv)*100;
var pst = (cst/mst)*100;


Everything else is moved to the start of the second trigger script. (Plus you want to get rid of the \n at the very end of the first lot of ColourTell calls, because that will start a new line).

Now what happens is that the first trigger just establishes the variables, but doesn't display them. The second trigger displays everything.

- Nick Gammon

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

Posted by John   Australia  (13 posts)  [Biography] bio
Date Reply #2 on Wed 18 Apr 2007 07:06 AM (UTC)
Message
Thanks Nick :) Logging in helped and so did your fix :D
[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.


10,793 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 HostDash]