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 ➜ Python ➜ " becomes \" in wildcards, huh?

" becomes \" in wildcards, huh?

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


Posted by Worstje   Netherlands  (899 posts)  Bio
Date Wed 04 Oct 2006 08:29 PM (UTC)

Amended on Wed 04 Oct 2006 08:30 PM (UTC) by Worstje

Message
So, I was making some simple aliases and ran into a silly bug when I forced someone to emote something for fun. Example:

<alias
   match="^mcom (.*?)$"
   enabled="y"
   regexp="y"
   send_to="12"
   omit_from_output="y"
   sequence="100"
   script="MindCommand"
  >
  <send></send>
  </alias>


with the following definition:

def MindCommand(name, line, wildcs):
	#world.Note("line: " + line)
	#world.Note("[0]: " + wildcs[0])
	# It seems Python changes a " to \" in the wildcards.
	
	world.Send("mind command " + wildcs[0])


When the above Notes are uncommented, I get the following output when doing mcom test"ing:

line: mcom test"ing
[0]: test\"ing
mind command test\"ing


So, why is it mutilating my wildcards and not the general line variable? I can easily take everything I need from line and forget about the wildcard, but it wouldn't solve the problem in other aliases I have (which I've also tested for this problem just now). A Lua plugin I made doesn't share this problem for as far I can tell.

Am I missing something obvious here?
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 04 Oct 2006 10:13 PM (UTC)
Message
You have send_to="12".

That is sending to script, which is really intended for inline scripting. To help you with inline scripting, it converts quotes in wildcards to \".

I suggest you leave it at "send to world", that should fix the problem. It still calls your script MindCommand.

- Nick Gammon

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

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #2 on Thu 05 Oct 2006 07:43 AM (UTC)
Message
Oooh, thank you. For some reason I always thought it had to be put on Send To Script when using a Script-method. I'm still not sure why it doesn't seem to happen to Lua, though.
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.


10,095 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.