ID:318849
 
(See the best response by DarkCampainger.)
Code:
winset(editingcode, "tcscode", "text=\"[storedcode]\"")


Problem description:

winset() appears to cut off text when it detects a quotation mark. "tcscode" is an input element, and if the variable "storedcode" were to contain quotation marks (for example: string = "Hello world!") the string would get cut off (for example: string = ).

Is there some way to work around this?

Best response
You need to escape/encode the quotation marks in storedcode. Otherwise winset() has no way of knowing if the quotes are yours, and signalling that you're done defining the value for the 'text' parameter, or are just a part of the text value itself.

There should be a simple string/text library around here with a replaceText() process. You'll want to replace all occurrences of " with \". Keep in mind that you'll have to escape those characters in Dream Maker itself so it understands you just want the characters. (eg replaceText(storedcode, "\"", "\\\"")

<edit>
Here's a good replaceText() process:
http://www.byond.com/forum/?post=195050
Replace " with \"

var/text = "\""
replacetext(text,"\"" , "\"")
proc
replacetext(string,look_for,replace)
var/a = findtext(string,look_for)
while(a)
string = copytext(string,1,a)+ replace + copytext(string,a+length(look_for))
a = findtext(string,look_for,a+length(replace))
return string