" becomes \" in wildcards, huh?

Posted by Worstje on Wed 04 Oct 2006 08:29 PM — 3 posts, 11,365 views.

Netherlands #0
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?
Amended on Wed 04 Oct 2006 08:30 PM by Worstje
Australia Forum Administrator #1
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.
Netherlands #2
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.