Javascript Syntax
homeeman
10 Dec 2012, 08:35I've been struggling with a Javascript error for a long time. I eventually figured out it had something to do with the exits in the few rooms I was encountering the error in.
It turns out apostrophes are a line delimiter and so on, and that I was getting an error because my exit aliases contained apostrophes.
I tried to escape the apostrophes with partial success: if I put a backslash before the apostrophes the Javascript is satisfied, no more error message, but the backslash is still printed when the game lists the exits.
Could somebody point me to the function that is in charge of translating the Javascript alias into what is printed on the screen so I could fix it? Does anybody know of a less intrusive method of fixing it?
It turns out apostrophes are a line delimiter and so on, and that I was getting an error because my exit aliases contained apostrophes.
I tried to escape the apostrophes with partial success: if I put a backslash before the apostrophes the Javascript is satisfied, no more error message, but the backslash is still printed when the game lists the exits.
Could somebody point me to the function that is in charge of translating the Javascript alias into what is printed on the screen so I could fix it? Does anybody know of a less intrusive method of fixing it?
HegemonKhan
10 Dec 2012, 08:54I have no idea if this will help, but I read someone's post (Pertex's?) about how you can use the:
<B>(....)</B> to put in spaces (keep your spaces from "condensing") into the Quest's coding,
so, maybe the <B></B> can work with your needs in javasript + quest game's coding too?
<B>(apostrophe)</B>
<B>(....)</B> to put in spaces (keep your spaces from "condensing") into the Quest's coding,
so, maybe the <B></B> can work with your needs in javasript + quest game's coding too?
<B>(apostrophe)</B>
Alex
10 Dec 2012, 10:19This seems to work in v5.3 - can you try it in that version?
If it's still broken can you please attach your game file (or email it to me alex@textadventures.co.uk)?
If it's still broken can you please attach your game file (or email it to me alex@textadventures.co.uk)?
homeeman
10 Dec 2012, 16:44Yep, it works just fine in 5.3. Thanks, I hadn't thought to try that! I'll have to work on updating my game, then.
I appreciate your time, guys!
I appreciate your time, guys!