Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Stopping a javascript function when finished

edited August 2016 in Help! with 1.x
I use the following to attach a custom passage into my game but after a design change I now only use it on one screen, so checking this passage every turn is overkill.

Simple question, but how would I remove it from the game once used so that the game isn't constantly performing the postrender task? Or is there a better way to attach a post render just for one passage?
postrender["updateLucidity"] = function () {
	setPageElement("lucidity", "Lucidity");
};

Comments

  • Try adding something like the following to the start of the passage you want it to be triggered in.
    <<script>>
    postrender["updateLucidity"] = function (content, taskName) {
    	setPageElement("lucidity", "Lucidity");
    	delete postrender[taskName];
    };
    <</script>>\
    
  • Thanks! Works well. :)
Sign In or Register to comment.