Hi,
I discovered a difference in the moment the window is refreshed during "running the script."
In OS X the screen will be refreshed immediately after the execution of a "script-line".
While in HTML5 refreshing of the window only occurs after the entire script is executed.
In my example script you can see on OSX the Buttons A, B and C disappear in intervals of 3 seconds.
Button A immediate, Button B after 3 seconds and Button C after 6 seconds.
While under HTML5 Buttons A and B do disappear after 3 seconds when the script has ended, and Button C after 6 seconds.
Is this specific to HTML5, or is there a solution so you can use the same script for OSX and HTML5?
(see attachment)
difference in window update between OSX and HTML5
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 46
- Joined: Mon Aug 26, 2013 6:49 pm
difference in window update between OSX and HTML5
- Attachments
-
- TestUpdateScreen.zip
- This is the file
- (2.03 KiB) Downloaded 318 times
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: difference in window update between OSX and HTML5
There are two components that determine the update in the HTML5 standalone:
The LC-engine (javascript) and the screen updates. The latter depends strongly on the refresh cycle of the browser used. There is even a big difference between versions of one browser (for you 'Safari').
But this is for loops that require an update below 54 ms.
You need an update every 1000 ms. The problem is here your script. You write
Your repeat sucks for three seconds *all* CPU time that is available to the standalone, few chances for refreshing (with a 54 ms refresh cycle).
Here is, for example, a script that needs in sum a few millisecs (<5) and updates every _full_ second. There will be no (visible) difference between IDE, HTML5 standalone and other standalones (I tested MacOS 10.12 IDE, MacOS standalone and HTML5 standalone).
The LC-engine (javascript) and the screen updates. The latter depends strongly on the refresh cycle of the browser used. There is even a big difference between versions of one browser (for you 'Safari').
But this is for loops that require an update below 54 ms.
You need an update every 1000 ms. The problem is here your script. You write
Code: Select all
on mouseUp
put 0 into x
hide button "ButtonA"
put the long time into beginTime
get beginTime
convert it to seconds
put it into startSeconds
put startSeconds into field "startSecondsField"
repeat until x = 3
put the long time into loopTime
get loopTime
convert it to seconds
put it into loopSeconds
put loopSeconds into field "loopSecondsField"
put loopSeconds - startSeconds into x
if x >= 3 then exit repeat
end repeat
hide button "ButtonB"
send "retard" to me in 3 seconds
end mouseUp
on retard
hide button "ButtonC"
end retard
Here is, for example, a script that needs in sum a few millisecs (<5) and updates every _full_ second. There will be no (visible) difference between IDE, HTML5 standalone and other standalones (I tested MacOS 10.12 IDE, MacOS standalone and HTML5 standalone).
Code: Select all
local s0, lst
on mouseUp
put "A,B,C" into lst
send "retard 1" to me in 1000 - (the millisecs mod 1000) millisecs
end mouseUp
on retard x
-- put the millisecs into m1
lock screen; lock messages
put the seconds into s
if x = 1 then
put s into s0
put s into fld "startSecondsField"
end if
put s into fld "loopSecondsField"
if ( (s-s0) mod 3 = 0 ) then
hide button ("Button"& item 1 of lst)
delete item 1 of lst
end if
if lst is empty then exit retard
else send "retard" to me in 1000 - (the millisecs mod 1000) millisecs
unlock screen; unlock messages
-- put the millisecs - m1 into fld "timing"
end retard
shiftLock happens
-
- Posts: 46
- Joined: Mon Aug 26, 2013 6:49 pm
Re: difference in window update between OSX and HTML5
Thanks [-hh],
Thanks for explaining that what was a mystery for me.
My problem was: The "wait"syntax is still not supported. (Nor the beep)
(see my post dated October 23)
I’m not a pro. I’m a retired teacher, grandfather and would help my grandson with the problem of automating calculations (addition and subtraction) under 20.
So I wrote a app wich works well.
Then I thought: if I could make a “HTML5 standalone”, it is platform and
operating system independent.
But it didn’t work as I expected.
In my scripts I used a wait command that didn’t work at all. In fact when the wait was executed nothing took place and the script was terminated.
The purpose of the wait command was to have time to read a piece of text prior to the execution of the script continuing without the user intervening.
So I thought: “I write my own wait routine”. But that worked neither.
You gave the solution to me.
I have to rewrite my scripts, but now I have an idee how to do so.
(I tested a part and it worked well.)
Once again thank you very much.
Joop
PS: Sorry for my poor English, I'm not a "native speaker".
Thanks for explaining that what was a mystery for me.
My problem was: The "wait"syntax is still not supported. (Nor the beep)
(see my post dated October 23)
I’m not a pro. I’m a retired teacher, grandfather and would help my grandson with the problem of automating calculations (addition and subtraction) under 20.
So I wrote a app wich works well.
Then I thought: if I could make a “HTML5 standalone”, it is platform and
operating system independent.
But it didn’t work as I expected.
In my scripts I used a wait command that didn’t work at all. In fact when the wait was executed nothing took place and the script was terminated.
The purpose of the wait command was to have time to read a piece of text prior to the execution of the script continuing without the user intervening.
So I thought: “I write my own wait routine”. But that worked neither.
You gave the solution to me.
I have to rewrite my scripts, but now I have an idee how to do so.
(I tested a part and it worked well.)
Once again thank you very much.
Joop
PS: Sorry for my poor English, I'm not a "native speaker".
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: difference in window update between OSX and HTML5
Hi Joop.
HTML5 is still experimental. We all don't know the plans for upcoming releases. Especially there is no sound, you could use visual signals (color or written response) instead of 'beep'.
But there are several animation examples of HTML5 standalones that you could use as a *base* for your work because they are tested to work. You can get the source code of the ones I've written by using this post. All the clocks there use "send <in time>" instead of waits.
And for example http://hyperhh.org/html5/SundayGameNb2-8.0.2X.html is a stack that uses "move" and the script has only 30 lines of code.
[The source is in http://hyperhh.org/html5/SundayGameNb2-8.0.2.zip].
Have a lot of success and fun with your "entertainment".
Hermann
HTML5 is still experimental. We all don't know the plans for upcoming releases. Especially there is no sound, you could use visual signals (color or written response) instead of 'beep'.
But there are several animation examples of HTML5 standalones that you could use as a *base* for your work because they are tested to work. You can get the source code of the ones I've written by using this post. All the clocks there use "send <in time>" instead of waits.
And for example http://hyperhh.org/html5/SundayGameNb2-8.0.2X.html is a stack that uses "move" and the script has only 30 lines of code.
[The source is in http://hyperhh.org/html5/SundayGameNb2-8.0.2.zip].
Have a lot of success and fun with your "entertainment".
Hermann
shiftLock happens
-
- Posts: 46
- Joined: Mon Aug 26, 2013 6:49 pm
Re: difference in window update between OSX and HTML5
Hi Hermann,
I definitely will use your suggestions.
Thanks again,
Joop
I definitely will use your suggestions.
Thanks again,
Joop