| Message |
I am presuming this is the relevant part:
local reporting
SetVariable('location','%1')
reporting = GetVariable('reporting')
if reporting == "on" then
Send('reply ' .. GetVariable('location'))
SetVariable('reporting','off')
end
You have only partly solved the problem with:
Send('reply ' .. GetVariable('location'))
because earlier up you have:
SetVariable('location','%1')
This is also going to fail with the quotes.
One easy way around it is to use double quotes, rather than single quotes.
MUSHclient detects in "send to script" that quotes inside wildcards need to be escaped, however it only does it to double quotes, not single quotes.
Thus, change it to:
SetVariable('location',"%1")
That will work for any sort of quotes (single quotes won't matter, and double quotes will be escaped).
Another approach is to use Lua long strings, like this:
SetVariable('location',[=[%1]=])
They allow for any sort of quotes inside them, even if MUSHclient didn't escape them.
You might make it easier for yourself if you stuck to Lua variables - if these are simply temporary variables used in a single session (and not needed to be remembered for tomorrow), then using MUSHclient variables just makes it unwieldy.
So it might read:
location = "%1"
if reporting == "on" then
Send('reply ' .. location)
reporting = "off"
end
And if you don't use location anywhere else, make it simpler again:
if reporting == "on" then
Send("reply %1")
reporting = "off"
end
And better still, use booleans rather than strings for flags:
if reporting then
Send ("reply %1")
reporting = false
end
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|