![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed May 28, 2008 6:31 pm
[2.25] Possible bug, but irritating problem nonetheless |
To start off with, this is what I see when I type "bigmap" on Aardwolf while on a continent.
Code: |
~~~~~~~~~~~~#####~~~#?~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~########~##|#~~~~###~~?#~###~#~####^^^?~~~~~~~~~?~
~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~
~~~~~~~~~#####...####|####?################^^?^#^###~~~~~~~~
~~~~~~~########################?#*####*##?###^^^^~~~~~~~~~#~
~~~~~~~##############################----------?^########~#~
~~~~~~~###########################----#######^^.##########~~
~~~~~~#########################################.####### .~~~
~~~~~##*%*#########..#############****###*##?##.######...##~
~~~~~###*########.....#.#########******#^^#####.###....####~ |
My mission? To create a trigger that'll tell me the position of each ? on the line. For instance, if I do:
Code: |
#SHOW %pos(?,"~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~") |
the MUD should return:
However, it doesn't. In fact, it returns "10" as the value. Why? Because even though it's a string, it still treats "~~" as just "~". So what CMUD is doing is checking the following:
Code: |
~~~~~####?..####|######################^^^^~~~~~#~ |
As you can see, it shortens the string considerably (especially if the entire string consists of nothing but ~).
In my script, I've tried %string(%1), %string(%quote(%1)), %quote(%1), and even tried %replace(%1,"~","."), all to no avail. The only way I've found to circumvent this is to go to Options -> Scripting -> Special Characters -> uncheck the Quote Character.
It's a bug, in my opinion. CMUD shouldn't be checking for quote characters within strings. It should accept it as is. I'm not sure, but it probably relates to the bug I pointed out regarding string lists and the = character (to recap, if you do #VAR var "**==blah==**", it stores ** as a key, with =blah==** as the value, even though it's quoted with quotation marks).
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri May 30, 2008 7:31 pm |
Can anyone check this out? Would like to see it solved.
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
darmir Sorcerer
![](images/avatars/35975043140f44bfb745ec.gif)
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Fri May 30, 2008 7:35 pm |
Well If I am right the reason is isn't matching is because ~ is a special character in CMUD. The first ~ escapes the second so you have half the number of ~ when it matches. If you goto preferences and turn that off that it will match.
|
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
![](templates/Classic/images/spacer.gif) |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri May 30, 2008 7:39 pm |
A workaround would be %replace(%1,"~","~~") but this might make it too long, if there is only one ~. for instance if your capturing #~~#~#~~
Your going to get #~#~#~ as %1, and if you do the replace you get #~~#~~#~~. It might help tho |
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri May 30, 2008 7:43 pm |
charneus wrote: |
In my script, I've tried %string(%1), %string(%quote(%1)), %quote(%1), and even tried %replace(%1,"~","."), all to no avail. The only way I've found to circumvent this is to go to Options -> Scripting -> Special Characters -> uncheck the Quote Character. |
As you can see, I stated that in my first post. But if you look at the #GAGON bug post I mentioned, that's hardly a feasible option. It shouldn't be treating special characters as special characters when enclosed by quotation marks. The quotation marks say, "Hey, make me a string and leave everything else alone!"
Also, I shouldn't have to turn off my special characters to use my scripts.
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri May 30, 2008 7:47 pm |
Toxic wrote: |
A workaround would be %replace(%1,"~","~~") but this might make it too long, if there is only one ~. for instance if your capturing #~~#~#~~
Your going to get #~#~#~ as %1, and if you do the replace you get #~~#~~#~~. It might help tho |
I tried that too. Like I said, I tried every possible workaround for it. It doesn't work. *sigh*
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri May 30, 2008 7:51 pm |
Im not sure what your pattern is to capture that stuff, but perhaps if you put %%string(pattern) around it or %%qoute(pattern)
|
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri May 30, 2008 7:57 pm |
That's the thing - I'm not using patterns to capture anything. I'm pasting it directly into the command line. Like I said, if I do:
Code: |
#SHOW %pos(?,"~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~") |
The MUD should return 15. But it doesn't. So even just using it in the command, it fails to work.
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri May 30, 2008 8:04 pm |
Ah thats the problem, your posting into the command line. Have you tried doing something like
#ALIAS mapp {#SHOW %pos("?","%1")} and then doing mapp #~~~~#?##~##~
Or somehow actually capturing it with a trigger, not sure how you could do that though, knowing what the output looks like |
|
|
![](templates/Classic/images/spacer.gif) |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri May 30, 2008 8:06 pm |
Or better yet, use an alias, and use #PROMPT to ask for the input, copy/paste it and store it to a variable then %pos() it.
|
|
|
![](templates/Classic/images/spacer.gif) |
Larkin Wizard
![](images/avatars/169979204542c57c7448618.gif)
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri May 30, 2008 8:12 pm |
Your first suggestion was close, Toxic. (The last couple, not so much.)
The trouble with the first suggestion was that you didn't escape the characters used for the substitution. It's a common foible.
Code: |
#SHOW %pos(?, %replace("~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~", "~~", "~~~~")) |
Make sense? |
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri May 30, 2008 8:40 pm |
But again, the fact is, I shouldn't have to make any changes. It's a string, not unquoted. And Toxic, I've also tried using an alias, and that didn't work. I should be able to just do
Code: |
#SHOW %pos(?, "~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~") |
and it work like it's supposed to. However, I'll keep your suggestion in mind, Larkin. Thanks for a workaround. :)
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Fri May 30, 2008 9:21 pm |
I'm sorry for stupid question, but why you guys want to substitute "~" with escaped "~~" ("~~" with "~~~~")? Charneus did not said that he cares about preserving the "~" in string. He only wants to know at what position the question mark is located. So why not use something like
%replace("~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~", "~~", "X"))? |
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
![](templates/Classic/images/spacer.gif) |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri May 30, 2008 9:23 pm |
Arde wrote: |
I'm sorry for stupid question, but why you guys want to substitute "~" with escaped "~~" ("~~" with "~~~~")? Charneus did not said that he cares about preserving the "~" in string. He only wants to know at what position the question mark is located. So why not use something like
%replace("~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~", "~~", "X"))? |
Either way works, the important part is that you replace ~~ at a time instead of ~ |
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri May 30, 2008 9:46 pm |
Toxic wrote: |
Arde wrote: |
I'm sorry for stupid question, but why you guys want to substitute "~" with escaped "~~" ("~~" with "~~~~")? Charneus did not said that he cares about preserving the "~" in string. He only wants to know at what position the question mark is located. So why not use something like
%replace("~~~~~~~~~~####?..####|######################^^^^~~~~~~~~~~#~", "~~", "X"))? |
Either way works, the important part is that you replace ~~ at a time instead of ~ |
You're incorrect - neither way works. And no, I don't have a reason for it not working, but try it yourself and see. :P
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
Larkin Wizard
![](images/avatars/169979204542c57c7448618.gif)
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri May 30, 2008 10:29 pm |
I tested my code, and it -does- work. The extra ~'s get stripped out by the function, thus giving you the correct position in the string. Did you try it yourself?
|
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri May 30, 2008 10:30 pm |
Certainly Charneus is correct that CMUD shouldn't be parsing the ~ within a " literal string, so I have added that to the bug list.
|
|
|
![](templates/Classic/images/spacer.gif) |
charneus Wizard
![](images/avatars/51564989746d852114da6d.jpg)
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri May 30, 2008 10:46 pm |
Larkin wrote: |
I tested my code, and it -does- work. The extra ~'s get stripped out by the function, thus giving you the correct position in the string. Did you try it yourself? |
Yes, I did. I never said yours didn't work. Was referring to replacing "~" with "~~" not working.
Charneus |
|
|
![](templates/Classic/images/spacer.gif) |
Vijilante SubAdmin
![](images/avatars/7230815434153eca6be3ad.gif)
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat May 31, 2008 12:57 am |
I am glad Zugg decided it counts as a bug. It used to be needed in zMud to do things like var="a~"b", but CMud has other support with the form of var="a""b". The whole handling of tildes was rather crazy, and I will be happy to see that confusion gone.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
![](templates/Classic/images/spacer.gif) |
|
|