when using {""} in the environment provided below it returns quite a few errors, but changing {""} to "" with the " inside of it changed to \" compiles correctly.
I use {""} for nearly every type of html-in dm thing I do because it makes finding special parts easier. I thought these were no different from each other, other than the fact {" "} can spread across multiple lines.
Numbered Steps to Reproduce Problem:
Use the code below.
Code Snippet (if applicable) to Reproduce Problem:
mob/Login()
. = ..()
usr << output( {"
<script type="text/javascript">
function replacetitle(v) {
document.getElementById('title').innerHTML = v;
}
function replace(v) {
document.getElementById('content').innerHTML = v;
}
</script>
<body bgcolor="#AA0000">
<!-- Begin Client Output -->
<center><b><font size=+1><div id="title">Help Guide</div></font></b></center>
<div id="content">This text can change.</div>
<!-- End Output -->
</body>
"},"browser1")
#define LP(str) list2params(list(str))
mob/verb/newtext()
usr << output(LP("Help Guide 101"),"browser1:replacetitle")
usr << output(LP({"<li><a href="?GettingStarted">Getting Started</a>"}),"browser1:replace")
Expected Results:
For the line to be read, and the process called.
Actual Results:
loading Feudal Times.dme
Feudal Times.dme:17:incorrect number of macro arguments
Monsters.dm:1:error: mob: missing comma ',' or right-paren ')'
HelpGuide.dm:24:error: list started here
Monsters.dm:1:error: mob: expected end of statement
Feudal Times.dmb - 3 errors, 0 warnings (double-click on an error to jump to it)
(Monsters.dm is right after HelpGuide.DM that is why the right-paren thing is showing.)
Does the problem occur:
Every time? Or how often? Everytime
When does the problem NOT occur?
See below.
Workarounds:
Instead of
usr << output(LP({"<li><a href="?GettingStarted">Getting Started</a>"}),"browser1:replace")
Use
usr << output(LP("<li><a href=\"?GettingStarted\">Getting Started</a>"),"browser1:replace")
[Edit] Updated BYOND Version, my bad I didnt see 442 on the list and just put it as 441, now I see the other option.
In this case you can just skip the macro since you are only passing one argument to the javascript, eg:
usr << output({"..."},"browser1:replace")
As a general workaround to this bug, you can either expand the macro in place, eg:
usr << output(list2params(list({"..."},[other args])),"browser1:replace")
or, better, use an intermediate var:
var/v = LP({"..."},[other args])
usr << output(LP(v),"browser1:replace")
We'll try to figure this out at some point, but this is probably the most "blackbox" section of our code.