Wow!! so many answer… seems I'm the first guy who crashes the debugger? Actually I didn't write 'crash' in my original post: I tend to think that an abnormal behavior is usually a consequence to a bug sitting between the chair and the keyboard; mostly…
So:
stam: it's often helpful setting breakpoint in the first line of the handler (or the calling handler) and then stepping through line-by-line to see what's going on...
'exactly what I do
dunbarx : I suppose you could pull the plug on your machine as well
'exactly what I
don't do when trying to understand what's going on in my code
jacque : We need to know the values of cdName and stackName
cdName="indicateursUneValeur"; stackName="Indicateurs"; those are 'the short name of' the cd and the stack; they are the correct names of the cd and the stack
richmond62: I would assume that they are the names of cards in stacks that are currently open
they are; and why not? my app goes back and forth between both stacks
dunbarx: I am suspecting that the word "debugger" is not what we think it is
well, to me, the debugger is what you get whenever Livecode runs into a line with a big red dot on the left of the script; what else?
SparkOut: try answer "go cd" && cdName && "of stack" && stackname
I get: go cd indicateursUneValeur of stack indicateurs; I suspect I could've quoted the names for safety; but really now these are a single ident
I spend some time recently playing around SparkOut idea, and noticed a behavior that seems strange to me. I have 2 stacks: a 'main' stack whose 'preopen' handler does a 'start using utility.livecode'. The utility stack manages the data from the main by storing/fetching it to/from an array each time the card is changed then saves that array into a file on quitting (I can't remember where I read about this idea).
The 'next cd' button in 'main'
Code: Select all
on mouseUp
lock screen
SAnextCd — this ends up calling SAreadCdFromArray below
end mouseUp
Code: Select all
on SAreadCdFromArray theCdKey , theBg , theStack — theBg is actually a card name ; theCdKey is a fld acting as an identifier of the cd
myAssert the params , (1 <= the paramCount) and (the paramCount <= 3) , param(0) && "theCdKey [, theBg [, theStack]]" — a bit of checking
put SAkeyExists(theCdKey,theBg,theStack) into cleExiste
myAssert the params , cleExiste , "Pas trouvé la clé '" & theCdKey & "' du bg '" & theBg & "' of stack '" & theStack &"'"
answer "go cd" && theBg && "of stack" && theStack
go cd theBg of stack theStack
answer "I'm back to the script of" && the name of me
1. When I run this
with a breakpoint on both answer instructions: the debugger stops on the 1st 'answer'; I type cmd-o, the 1st message is displayed; I type OK; the debugger stops on the 'go cd'; I type cmd-o, the
second message is displayed
at once; I type OK; the debugger stops on the instruction after the 2nd breakpoint. So the debugger never stops on the 2nd answer instruction
before displaying the 2nd message.
2. When I run this with a breakpoint on the 1st answer but no breakpoint on the 2nd 'answer': same as above
3. When the 2nd 'answer' is commented out (therefore no breakpoint) but I set a breakpoint on the instruction that follows it: the debugger stops on the 1st 'answer'; I type cmd-o, the 1st message is displayed; I type OK; the debugger stops on the 'go cd'; I type cmd-o, the debugger disappears; the instructions after it
are executed.
It seems that the 'go cd' instruction does not conform to the cmd-o signal to go to the next line of the script?