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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Is it possible to add a decimal point to trigger sequences?

Is it possible to add a decimal point to trigger sequences?

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


Posted by Graceecat   Taiwan  (15 posts)  Bio
Date Wed 20 Aug 2008 07:55 PM (UTC)
Message
I wish the sequences of triggers all have a decimal point on them!

Are you able to add this function to mush? Is it easy?

Thank you anyway!


Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #1 on Wed 20 Aug 2008 09:15 PM (UTC)
Message
Yes, it is. If the match is a regular expression, then the decimal point needs to be escaped.

i.e:
HP: 93.65%

"^HP: (\d+\.\d+)%$" will match it.

^ is start of line.
$ is end of line.
( ) means capture this (to %1, %2...)
\d is a number
\. is a literal period. ( . is any character to regexps)
+ is one or more of the previous so \d+ will match 1,11,111 etc)

read
http://www.gammon.com.au/scripts/doc.php?general=regexp

for complete information.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #2 on Wed 20 Aug 2008 09:17 PM (UTC)
Message
I think he might have meant adding a decimal point to the sequence numbers of the triggers, which I believe is not possible.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 20 Aug 2008 09:35 PM (UTC)

Amended on Wed 20 Aug 2008 09:36 PM (UTC) by Nick Gammon

Message
The sequence is defined as an integer in the range 0 to 10000 - rather than adding decimal points, just resequence things a bit. The exact numbers don't count, just the order.

For example, this small Lua script would multiply each sequence number for all your triggers by 10.


tl = GetTriggerList()
if tl then
  for k, v in ipairs (tl) do 
    seq = GetTriggerOption (v, "sequence")
    SetTriggerOption (v, "sequence", seq * 10)
  end  -- for
end -- if we have any triggers


Now assuming you don't already have a sequence number over 1000 this now gives you 9 extra gaps between your previous sequence numbers to slot things into.

Just copy and paste that into the Immediate window (Ctrl+I) to run it.

- Nick Gammon

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

Posted by Graceecat   Taiwan  (15 posts)  Bio
Date Reply #4 on Thu 21 Aug 2008 08:34 AM (UTC)

Amended on Sun 24 Aug 2008 08:09 AM (UTC) by Graceecat

Message
I wish the interface look more beautiful. This is very important to me! So I firmly wanna let the sequence numbers all have a decimal point... Could you teach me this complicated procedure to beautify my mush? Thank you everyone again and thank nick knew what my question was.

Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #5 on Thu 21 Aug 2008 07:44 PM (UTC)
Message
There isn't a procedure to have decimal points in the sequence number, unless you're willing to edit the MUSHclient source code and recompile it yourself. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
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.


17,292 views.

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.