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
➜ Escape of brackets in speedwalk string
|
Escape of brackets in speedwalk string
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Jcl2016
(8 posts) Bio
|
| Date
| Fri 23 Dec 2016 06:37 AM (UTC) |
| Message
| According to the document, we can use non-standard directions or general commands in speedwalk by putting them in brackets. For example: #3(say hello)
I want to know whether there is a escape character, so we can use commands containing brackets?
For example, I want to evaluate "say (hello)" command in speedwalk, "#3(say (hello))" is invalid, and "#3(say \(hello\))" is invalid too.
Is there a way to do this? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 23 Dec 2016 07:53 AM (UTC) |
| Message
| Is this for using speedwalks as a command? Or in a script?
If you are just typing something in, like:
You can always make an alias that matches on "#*" and then make your own rules for evaluation of what follows. It doesn't look as if the inbuilt rules allow for what you have in mind. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Jcl2016
(8 posts) Bio
|
| Date
| Reply #2 on Fri 23 Dec 2016 09:08 AM (UTC) |
| Message
|
Nick Gammon said:
Is this for using speedwalks as a command? Or in a script?
If you are just typing something in, like:
You can always make an alias that matches on "#*" and then make your own rules for evaluation of what follows. It doesn't look as if the inbuilt rules allow for what you have in mind.
I use it in a script. The command is not just repeat someting. For example, I will use it like this:
#3n2e(ne/sw)3(turn left)3(turn right)(enter/out)
In most cases, the speedwalks have no problem.
But there are some special scenarios where commands will contain brackets, so the speedwalks will be broken.
Now I'm using server side alias to avoid the commands containing brackets. But the server side alias can't be too much. So I want to know whether there is client side solution. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Fri 23 Dec 2016 10:48 PM (UTC) Amended on Fri 23 Dec 2016 10:50 PM (UTC) by Nick Gammon
|
| Message
| In a script you could always do part of the speed walk, send the next bit, and then do the next part. eg.
Queue (EvaluateSpeedwalk("4n"), true)
Queue ("say (hello)", true)
Queue (EvaluateSpeedwalk("3n2e(ne/sw)3(turn left)3(turn right)"), true)
Or you could choose some replacement characters (eg. "[" and "]") and then fix them up, eg.
sw = "4n3n2e(ne/sw)(say [hello])3(turn left)3(turn right)"
evaluated = EvaluateSpeedwalk(sw, true)
-- turn square brackets into round brackets, queue the speedwalk
Queue (string.gsub (evaluated, "[%[%]]", { ["["] = "(", ["]"] = ")" } ))
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
13,848 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top