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.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Forcing newlines on prompt lines

Forcing newlines on prompt lines

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


Pages: 1  2 3  4  

Posted by Flyto   (12 posts)  Bio
Date Reply #15 on Fri 07 Jan 2005 09:17 AM (UTC)

Amended on Fri 07 Jan 2005 07:50 PM (UTC) by Nick Gammon

Message
ok, here is the evil chunk of script causing the problem


function PromptCheck (name, output, wildcs)
   health = tonumber(wildcs[1])
   mana = tonumber(wildcs[2])
   if autoHeal == 1 and var.elixBalance == "1" then
     if health < 2500 then  
	Send ("drink health")
	SetVariable("elixBalance", "0")
	var.elixBalance = "0"
	DoAfterSpecial (5, "SetVariable('elixBalance', '1')", 12)
     end --if health
     if mana < 3500 then 
	Send ("drink mana")
	var.elixBalance = "0"
	SetVariable("healthBalance", "0")
	DoAfterSpecial (5, "SetVariable('elixBalance', '1')", 12)
    end --if mana
  end -- if autoheal
end --function


The problem is that the Variable healthBalance gets the new Value, and though the new sip-command is being triggered after another Enter/Mudoutput.


... Flyto ...
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #16 on Fri 07 Jan 2005 08:06 PM (UTC)

Amended on Fri 07 Jan 2005 08:07 PM (UTC) by Nick Gammon

Message
This is in Lua, right? And you are using my "var" table from the example script file or this forum?

Then, these two lines are doing the same thing:


SetVariable("elixBalance", "0")
var.elixBalance = "0"


I presume you are doing this to re-enable drinking elixer after 5 seconds ...


DoAfterSpecial (5, "SetVariable('elixBalance', '1')", 12)


However with "send to script" you may as well be consistent and do it the same way:


DoAfterSpecial (5, "var.elixBalance = 1", 12)


You don't really need to quote the '1' because MUSHclient variables are always stored as strings, they will be converted for you.

I'm not sure what the variable healthBalance is being used for. You set it to zero at one point but never to any other value.

Perhaps it would work better like this:



function PromptCheck (name, output, wildcs)
  local health = tonumber (wildcs [1])
  local mana = tonumber (wildcs [2])

  if autoHeal == 1 then

    if health < 2500 and var.elixBalance == "1" then  
      Send ("drink health")
      var.elixBalance = 0
      DoAfterSpecial (5, "var.elixBalance = 1", 12)
    end --if health

    if mana < 3500 and var.healthBalance == "1" then 
      Send ("drink mana")
      var.healthBalance = 0
      DoAfterSpecial (5, "var.healthBalance = 1", 12)
    end --if mana

  end -- if autoheal
end --function


- Nick Gammon

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

Posted by Flyto   (12 posts)  Bio
Date Reply #17 on Fri 07 Jan 2005 10:31 PM (UTC)
Message
oops, I was playing around with the two sets of varibles, this is why I had a double varible assignment. After trying various combinations of varibles (Mush/Scipt) I came to the conclusion that its much easier jsut using scrip-internal ones, and even the annoying "wait-for-enter" problem is solved. The sipper works great now.

Thank you for the help.

... Flyto ...
Top

Posted by Lotan   (5 posts)  Bio
Date Reply #18 on Sat 08 Jan 2005 02:06 PM (UTC)
Message
IRE muds definitely send GA/EOR after each prompt. Nick, would it be so hard to add a checkbox so this newline is being added automatically?
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #19 on Sat 08 Jan 2005 02:16 PM (UTC)
Message
You could do it easily with packets in a plugin.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Lotan   (5 posts)  Bio
Date Reply #20 on Sat 08 Jan 2005 02:26 PM (UTC)
Message
I do understand that...But it's faster if a client does it itself, not some workaround plugin (GA/EOR gets sent, why just ignore it?) . To me, it is just a convenience question.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #21 on Sat 08 Jan 2005 07:20 PM (UTC)
Message
Can you get an example packet for me? What is the GA/EOR in hex? Go to Edit -> Debug Packets, and get a prompt line (and then turn it off).

Find the edit window it appeared in (underneath or nearby) and copy and paste it here. Thanks.

- Nick Gammon

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

Posted by Lotan   (5 posts)  Bio
Date Reply #22 on Sun 09 Jan 2005 12:37 AM (UTC)

Amended on Sun 09 Jan 2005 06:50 AM (UTC) by Nick Gammon

Message
It is pretty straighforward for GA/EOR...

It is either IAC GA, or IAC EOR. In imperian, for example, it is IAC GA.

The packet is the following:

          H:.[32   68 65 20 6c 61 6e 64 2e 0d 0a 48 3a 1b 5b 33 32
m86.[37m M:.[32m   6d 38 36 1b 5b 33 37 6d 20 4d 3a 1b 5b 33 32 6d
117.[37m <.[32me   31 31 37 1b 5b 33 37 6d 20 3c 1b 5b 33 32 6d 65
.[37m.[32mb.[37m   1b 5b 33 37 6d 1b 5b 33 32 6d 62 1b 5b 33 37 6d
> ..               3e 20 ff f9


Notice FF F9 bytes in the end - it is IAC(FF) GA(F9). The prompt ends with > and space.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #23 on Sun 09 Jan 2005 08:25 PM (UTC)
Message
OK, I have added this to version 3.66 along with telnet negotiation for it (IAC WILL GA -> IAC DO GA, IAC WILL EOR -> IAC DO EOR).

I hope EOR is 0xEF, the documentation is a bit obscure on that point. Or is EOR 0x19 without the IAC?

At present I am recognising 0xFF 0xEF as EOR, but not 0x19 on its own.

- Nick Gammon

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

Posted by Lotan   (5 posts)  Bio
Date Reply #24 on Mon 10 Jan 2005 09:50 AM (UTC)
Message
EAR itself is IAC EOR (255, 239).

For negotiations, a command code for EOR is 25(hex 19) - is is used for IAC WILL, IAC DO and such.
Top

Posted by Lotan   (5 posts)  Bio
Date Reply #25 on Mon 10 Jan 2005 10:11 AM (UTC)
Message
As for GA negotiations, there is no IAC WILL GA options, if i got it correctly from RFC.

The only option for GA is SUPRESS-GO-AHEAD(3), it is used for well, supressing GA-s. The RFC for it is: ftp://ftp.isi.edu/in-notes/rfc858.txt
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #26 on Mon 10 Jan 2005 07:58 PM (UTC)
Message
How confusing is that? Alright, I have changed the WILL/WONT to use 0x19 but the actual sequence to be acted on is still 0xFF 0xEF.

- Nick Gammon

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

Posted by Bobble   Canada  (76 posts)  Bio
Date Reply #27 on Fri 11 Mar 2005 05:46 PM (UTC)
Message
I have a question about this plugin.

It works great and achieves what I needed. However, when the trigger matches and the newline is put in, is there any way to get the next packet to start on that newline? I'm now getting an extra blank line after every prompt which is incredibly spammy when you're in combat on the MUD I play (Aetolia).

Here's an example of what my output looks like without the plugin:

H:2886 M:2952 E:14090 W:17420 B:100% [db eb]
(Novices): Bob says, "No? It is a friendly little competition that will 
earn you gold and perhaps a prize."
H:2886 M:2952 E:14090 W:17420 B:100% [db eb]
(Novices): Jim says, "Hmm, well i never did it before."
H:2886 M:2952 E:14090 W:17420 B:100% [db eb]
(Novices): Wendy says, "Ooh.. it can be fun."
H:2886 M:2952 E:14090 W:17420 B:100% [db eb]


With the plugin, the same output looks like this:


H:2886 M:2952 E:14090 W:17420 B:100% [db eb]

(Novices): Bob says, "No? It is a friendly little competition that will 
earn you gold and perhaps a prize."
H:2886 M:2952 E:14090 W:17420 B:100% [db eb]

(Novices): Jim says, "Hmm, well i never did it before."
H:2886 M:2952 E:14090 W:17420 B:100% [db eb]

(Novices): Wendy says, "Ooh.. it can be fun."
H:2886 M:2952 E:14090 W:17420 B:100% [db eb]



After each prompt, the newline is blank and the next bit of output starts on the line after that. Is there any way to gag that blank line?

I know this doesn't seem too major, but when you get into player vs. player fights on this MUD, the text starts scrolling off the screen at an incredible rate and a blank line after each prompt makes it fly off even faster.

Open the watch.
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #28 on Fri 11 Mar 2005 06:33 PM (UTC)
Message
Here's what I use to solve that problem:


<triggers>
  <trigger
   enabled="y"
   match="^([0-9]+)h, ([0-9]+)m, ([0-9]+)e, ([0-9]+)p ((?:e|)(?:l|)(?:r|)(?:x|)(?:k|)(?:d|)(?:b|)(?:|p))-$"
   regexp="y"
   script="SetPromptStats"
   sequence="0"
  >
  </trigger>
</triggers>
<triggers>
  <trigger
   keep_evaluating="y"
   match=".*"
   name="got_other_line"
   regexp="y"
   script="GotOtherLine"
   group="prompt_cleanup"
   sequence="2"
  >
  </trigger>
  <trigger
   match="^$"
   name="empty_line"
   omit_from_output="y"
   regexp="y"
   script="GotEmptyLine"
   group="prompt_cleanup"
   sequence="1"
  >
  </trigger>
</triggers>

def SetPromptStats(name, output, wildcs):
	world.EnableTriggerGroup("prompt_cleanup", 1)

def GotEmptyLine(name, output, wildcs):
	world.EnableTriggerGroup("prompt_cleanup", 0)

def GotOtherLine(name, output, wildcs):
	world.EnableTriggerGroup("prompt_cleanup", 0)


You'll need to translate that to your language of choice which shouldn't be a problem, and enable the "Triggers can match on empty line" option. This is probably most fitting inside a plugin.
Top

Posted by Bobble   Canada  (76 posts)  Bio
Date Reply #29 on Fri 11 Mar 2005 06:40 PM (UTC)
Message
Thanks Ked!

I had thought of something like this, but the ^$ trigger never fired, I imagine it's because I was unaware of the "match triggers on empty line" option.

My problem now is . . . .where is that option?!? I can't find it! :)

Open the watch.
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.


131,676 views.

This is page 2, subject is 4 pages long:  [Previous page]  1  2 3  4  [Next page]

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.