Question on the quitPsychJS function

Hello,

I want to first ask a question regarding the quitPsychoJS function on Pavlovia. If a participant had to accidentally press the Escape button during the experiment, does it consume a credit and are those results saved to the database?

Secondly, I want to have two diffrerent messages for when a participant either quits the experiment or completes it. At the moment, the current message that appears is:

The [Escape] key was pressed. Goodbye!

I am able to change this message. I understand that it follows this function:

function quitPsychoJS(message, isCompleted) {
  // Check for and save orphaned data
  if (psychoJS.experiment.isEntryEmpty()) {
    psychoJS.experiment.nextEntry();
  }

However, I am unable to change the value of ‘message’ to have two different messages: one for completion of the experiment, one for quitting the experiment. These are the two messages I am attempting to add:

Quit:

The Escape key was pressed. If you have pressed this key by mistake, press “OK” to be redirected to the start of the experiment.

(Redirects using experiment link)

Completed:

Thank you for your participation. Press “OK” to complete this experiment, where you will be redirected to a webpage explaining the purpose of this study.

(Redirects to a debriefing PDF)

Of course, these messages are subject to change if I have not fully understood the way “Quit” works, so I would be very grateful if someone could assist me with any of these issues. Thanks in advance.