Weird script behaviour (was libUrlDownloadToFile & urlProgress)

Gerry gerry.orkin at gmail.com
Wed Mar 23 05:41:48 EDT 2011


This is the script that calls the handler:

on mouseup
set the blendLevel of me to "10"
updateSongsList
end mouseup

This is the handler that it calls (I've xxxx'd out some domain details):

on updateSongsList
local songsOnDevice, songListOnServer
play empty
hide button "stopButton"
put "Checking for updates..." into field "messages"
put url "https://xxxxxxxxxxxx.com/hrabisms/songsupdate.txt" into
songListOnServer
put the dgText of group "Songs" into songsOnDevice
if the number of lines in songListOnServer > the number of lines in
songsOnDevice then
put "Update received!" into field "messages"
wait 120
set the dgText of group "Songs" to songListOnServer
set the defaultFolder to specialFolderPath("Documents")
put songsOnServer into URL ("file:songs.txt")
else
put "No update received. Rats." into field "messages"
wait 120
end if
put "" into field "messages"
end updateSongsList


As I said previously, this script is not executed if it's in the card
script, but does when it's in the stack script. That's weird enough,
but if I place it in the card script and I use "Send updateSongsList
to this card" in the button script it starts executing the card script
from the top, and I can track that by setting a breakpoint against the
send command - it jumps from the button script into the card script,
and I can step through all the lines in that card script, executing
them as I go.

Like I said, totally crazy!

Gerry


-- photo site: http://gerryorkin.com

On Wednesday, 23 March 2011 at 4:40 PM, J. Landman Gay wrote:
> On 3/22/11 8:38 PM, Gerry Orkin wrote:
> > Jacqueline,
> >
> > As I mentioned, it goes crazy. Setting a breakpoint in the referring
> > button script jumps me to the top line of the card script, but not to
> > the handler being called. The trace shows that LiveCode is attempting
> > to evaluate every line of code in the card script, starting from the
> > top, and including blank lines.
>
> Are you using the "send" command instead of just calling handlers
> directly? Those won't break unless you put a breakpoint into the handler
> you're sending to. But in general you shouldn't need to use "send" for
> most things. Too many "send" commands in a row can set up a chain
> reaction and pending messages will run out of control.
>
> I've never heard of a problem like this, so it's hard to diagnose. If
> you post the part of your script where it goes off track maybe we'll see
> something.
>
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the Use-livecode mailing list