Howdy, Stranger!

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

calling two functions

Hi everybody!
I am using twine2 and Harlowe.

My program uses responsive voice to read the text of the passages. It was working perfectly two days ago and now the way it works has changed.Before the man was talking and when he finished reading the sentence the woman started talking.
But now the woman interrupts the man after 2000ms instead of letting him finish. I dont understand why before it didnt interrupt and now it does, I haven't changed any part of the code and as I have said it used two worked 2 days ago.

This is the code I have used:
<p id="manvoiceselection">This is what the man says</p>
<p id="womanvoiceselection">This is what the woman says</p>

{(live:1000ms)[
<div style="display:none;"><img src="!@#$"; onerror="responsiveVoice.speak($('#manvoiceselection').text(),'UK English Male')"/></div>
(set: $voice to "yes")
(if: $voice is "yes")[(stop:)]
]
]}
{(live:2000ms)[
<div style="display:none;"><img src="!@#$"; onerror="responsiveVoice.speak($('#womanvoiceselection').text(),'UK English Female')"/></div>
(set: $myvoice to "yes")
(if: $myvoice is "yes")[(stop:)]
]}



Thank you!

Comments

  • I guess twine has changed in these days. Do you know how can I come back to the release from the date it worked? changing all the code it is going to be much harder.

    Thank you!
  • The use of onError has me curious. Was this a reliable way to fire JavaScript in Twine, to have it go off when images fail to load?
  • Yes I asked in the forum how to call a function from the passage and they told me it is the way to do it
  • Can you be 100% certain that YOU, yourself, didn't change anything? And that it worked before?
  • edited June 2015
    From the code you gave, I see no way for the passage to know when the first audio finished, so I'm surprised it did so before? Twine doesn't have any in-built functionality to listen for Javascript events - is something you need to code yourself.

    You could manually time how long each person takes to speak and then incorporate that timing into your (live:) macro. So if the man took 6 seconds to speak, and you wanted a gap of 2 seconds, you'd write (live: 8000ms) before the female.
  • Yes I can be sure that it worked and I didn't change anything.
    I also though about timing each paragraph. But I also have the possibility to press some text and its meaning will show and will be also be read so I cannot do it with timers because it depends if you press to show the meaning or not.

    This is the introduction:
    <p id="expertvoiceselection" class="text-to-speech-p">Introduction of the passage
    

    Here are some sentences with their meaning hidden.But if you press the sentence the meaning will appear and it will be read.
    <span id="sentvoiceselection" onclick="showmeaning();responsiveVoice.cancel();responsiveVoice.speak($('#mymeaning').text(),'UK English Male');" class="sentence" title="click to see meaning" >1. This is the sentence to be pressed</span>
    
    <span onclick="hidemeaning();continuespeach();" class="meaning" title="click to hide meaning" id="misignificado"   style="display:none;">This is the meaning of 1.</span>
    
    
    
    <span id="sent1voiceselection" onclick="showmeaning1();responsiveVoice.cancel();responsiveVoice.speak($('#mymeaning').text(),'UK English Male');" class="sentence" title="click to see meaning" >2. This is the second sentence</span>
    
    <span onclick="hidemeaning1();continuespeach1();" class="meaning" title="click to hide meaning" id="mymeaning1"   style="display:none;">this is the meaning of 2</span>
    
    
    
    <span id="sent2voiceselection" onclick="showmeaning2();responsiveVoice.cancel();responsiveVoice.speak($('#mymeaning2').text(),'UK English Male');" class="sentence" title="click to see meaning" >3. This is the third sentence.</span>
    
    <span onclick="hidemeaning2();continuespeach2();" class="meaning" title="click to hide meaning" id="mymeaning2"   style="display:none;">This is the meaning of 3</span>
    
    

    This is the closing of the passage:
    <p id="voiceselection" class="text-to-speech-p">Closing of the passage </p>
    


    So I used to do this before:
    {(live:1000ms)[
    <div style="display:none;"><img src="!@#$"; onerror="responsiveVoice.speak($('#expertvoiceselection').text(),'UK English Male')"/>
    </div>
    (set: $myvoice to "no")
    (if: $myvoice is "no")[(stop:)]
    ]}
    {(live:1200ms)[
    <div style="display:none;"><img src="!@#$"; onerror="responsiveVoice.speak($('#sentvoiceselection').text(),'UK English Male')"/></div>
    (set: $voice to "yes")
    (if: $voice is "yes")[(stop:)]
    ]}
    {(live:1400ms)[
    <div style="display:none;"><img src="!@#$"; onerror="responsiveVoice.speak($('#sent1voiceselection').text(),'UK English Male')"/></div>
    (set: $voice to "yes")
    (if: $voice is "yes")[(stop:)]
    ]}
    {(live:1600ms)[
    <div style="display:none;"><img src="!@#$"; onerror="responsiveVoice.speak($('#sent2voiceselection').text(),'UK English Male')"/></div>
    (set: $voice to "yes")
    (if: $voice is "yes")[(stop:)]
    ]}
    {(live:1800ms)[
    <div style="display:none;"><img src="!@#$"; onerror="responsiveVoice.speak($('#voiceselection').text(),'UK English Female')"/></div>
    (set: $voice to "yes")
    (if: $voice is "yes")[(stop:)]
    ]}
    

    And also the functions
    Showmeaning, hidemeaning and continuespeach are programmed in my javascript

Sign In or Register to comment.