Typewriter effect on room descriptions?

Title says it all really - is there any way to implement the typewriter effect for the room descriptions? Thanks a lot!


One way:
Enter the room description in the "before room enter" as messages...
(I assume you tried the typewriter command and it did not work for the room description.)


The hard part is finding the room description.

Here's a little bit of javascript that might do the job:

function typeRoomDescription() {
  var description;
  $('div[id^=divOutputAlign] span:visible').each(function () {
    if (!$(this).text().match(/^(You can see|You can go)/)) {description = this;}
  });
  if (description) { $(description).typewriter(120); }
}

That finds the last paragraph that isn't the objects list or exits list, and applies the typewriter effect to it.
Once you've added the JS, you could put JS.typeRoomDescription() in your enter room script (either for one room, or the one on the game object to apply it to all rooms).


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums