I’m having trouble with Undum’s system.write and system.writeBefore methods. They’re suppsed to take an optional second argument, elementSelector. The API says this:
“Simply add a paragraph with an id in your game, then later you can give this id as a selector to write, and the new content will be inserted immediately following that paragraph…”
But that isn’t working for me. If I provide no elementSelector, the paragraph (it’s in an act: property in a Situation) prints correctly, at the bottom of the transcript. But when I add an elementSelector argument, either to system.write or to system.writeBefore, the paragraph fails to print.
I’m putting the elementSelector (and the id) in single quotes, which seems to be the approved method, and Firebug reports no problems with the Javascript code – but the paragraph isn’t displaying.
I’m wondering if the elementSelector functionality doesn’t work when the paragraph element being referenced is hiding inside of a previous system.write(). That would be odd…
For reference, here is my (roughly sketched, at present) Situation. It’s embedded within undum.game.situations, as I’m just starting to edit the Tutorial code.
martastudio: new undum.Situation({
enter: function (character, system, from) {
system.write ("<p>Marta's studio was housed in a one-room cabin the same size as John's\
workshop, but somehow she contrived to make it feel a great deal more crowded.\
When he strolled in, <a href='./x-marta' class='once'>Marta</a>\
was leaning forward over a large painting that was stretched\
out flat on her worktable. Her free-form canvases owed something to the Jackson\
Pollack school of drip-and-fling, and something to the pulsing psychedelic light shows of the\
1960s.</p>\
\
<p id='lightning'>She looked up and grinned crookedly at him. \"Has lightning struck yet?\"</p>\
\"Not yet,\" he admitted. \"Have you had any bright ideas?\"<p>\
<p>They fell to discussing the future of the Ambrosia Center, treading ground they had\
trodden, unfruitfully, for a couple of months now.</p>")
},
act: function(character, system, action) {
switch (action) {
case 'x-marta':
system.writeBefore("<p> Marta was large-boned and broad-faced, with fly-away hair as unruly as her\
paintings. Her smock and apron were a riot of paint spatters, and fresh smudges\
daubed her cheeks and nose.</p>", 'lightning');
}
}
}
),