Hi
I decided to change my mud client to mudlet but I have some serious problem with finding simple wildcard replacement to %1 that was working great in tintin. I think the best way will be to show you an example.
Tintin:
#alias {ep} {enter %1portal}
It allows me to type just 'ep' sending "enter portal" to mud. I can also type 'ep 2.' to send "enter 2.portal".
In Mudlet I tried many options but I cant find anything that matches the above example. I tried the following:
Pattern:
^ep (\d?\D?)$
Code:
send("enter "..matches[2].."portal")
but it forces me to type space after ep, otherwise its not working.
Pattern:
^ep ?(\d?\D?)$
Code:
send("enter "..matches[2].."portal")
seemed to work just fine untill I tried to use some other alias with Pattern: ^epe (\w+)$ doing something different. Typing epe sends both aliases to mud.
I can't find any solution, could you please help me with that? I am sure there must be a simple answer to this, but I am lost and cant figure it out.
from tintin to mudlet
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: from tintin to mudlet
I must confess I don't actually MUD much at present but I used TinTin++ before i started poking around in the Mudlet code, as I see it the first pattern is asking for:
line beginning with "ep", followed by one actual space (that is not captured) followed by zero OR ONE digit followed by zero or one NON-digits - with the combination of the captured digit and non-digit being made available in the matches[2] group.
Your second pattern is different in that it does not NEED a space between the ep and the digit/non-digit which is all fine and dandy until you realise that, unlike TinTin++ more than one #ACTION/#ALIAS (TinTin++) or trigger/alias (Mudlet) can be activated by the same MUD server output / user input line respectively. So, yes, both of your aliases will be triggered. The quickest fix I can see for that is:
Which will match on either just the letters "ep" or "ep" followed by a space followed by zero or one or more digits followed by zero or one non-digits. The matches[2] will be empty for the first case but WILL have the leading space in the second. Neither will be triggered by your command beginning with "epe"!
line beginning with "ep", followed by one actual space (that is not captured) followed by zero OR ONE digit followed by zero or one NON-digits - with the combination of the captured digit and non-digit being made available in the matches[2] group.
Your second pattern is different in that it does not NEED a space between the ep and the digit/non-digit which is all fine and dandy until you realise that, unlike TinTin++ more than one #ACTION/#ALIAS (TinTin++) or trigger/alias (Mudlet) can be activated by the same MUD server output / user input line respectively. So, yes, both of your aliases will be triggered. The quickest fix I can see for that is:
Code: Select all
^ep(| /d+/D?)$
Re: from tintin to mudlet
This is a pretty standard alias I use:
Obviously, change the .+ to whatever you need. This way, matches[2] does not contain the space.
Code: Select all
^ep(?:\s(.+))?$
Re: from tintin to mudlet
Thanks a lot SlySven, it works perfect
I have a feeling I will have to ask about help pretty often, if I've already had problems with basic alias
I have a feeling I will have to ask about help pretty often, if I've already had problems with basic alias
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: from tintin to mudlet
I think Oneymus might be onto something - I'm also a newbie when it comes to the format of those PCREs which are not precisely what I think Scandum uses in TinTin++ ...!