RE: simple local variable question
Sorry for the confusion. You're absolutely correct about being able to declare a local variable outside any handlers. I was mentally segregating declarative code statements... local rotAngle ... into a different category than non-declarative (imperative?) code statements, which have no way (AFAIK) of being executed apart from a handler... put 20 into rotAngle I could be wrong, but that's my understanding. My motto: When in doubt, test! Test results are often misunderstood, but they never lie! :o) Phil Davis > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Christopher > Mitchell > Sent: Friday, February 20, 2004 10:35 PM > To: How to use Revolution > Subject: Re: simple local variable question > > > However, that is contrary to the documentation for the local command: > > You create a script local variable by using the local command in a > script, outside any handlers in the script. > (pasted from transcript dictionary) > > So I'm still not convinced that it must be in a handler, or if so then > the documentation is misleading. > > Yours, > Chris > On Feb 20, 2004, at 7:20 PM, Phil Davis wrote: > > > - Original Message - > > From: "Christopher Mitchell" <[EMAIL PROTECTED]> > > To: "How to use Revolution" <[EMAIL PROTECTED]> > > Sent: Friday, February 20, 2004 4:55 PM > > Subject: simple local variable question > > > > > >> Howdy, > >> > >> I'm declaring some local variables at the top of a card script that I > >> need to use in several handlers... here is a simplified recipe > >> question > >> that will help me understand why I'm not able to access the values I'm > >> assigning to them: > >> > >> --card script begins here > >> > >> local rotAngle > >> put 20 into rotAngle > >> > >> on mouseUp > >> answer rotAngle > >> end mouseUp > >> > >> -- > >> > >> My question is, why does this not put up an answer dialog with "20" in > >> it? the dialog that comes up is empty. > > > > > > It comes up empty because nothing can ever cause 'rotAngle' to be set. > > Any > > executable code not inside a handler can never be executed. > > > > Phil Davis > > > > > >> > >> Thanks, > >> Chris > > > > ___ > > use-revolution mailing list > > [EMAIL PROTECTED] > > http://lists.runrev.com/mailman/listinfo/use-revolution > > > > ___ > use-revolution mailing list > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: simple local variable question
er, or openCard rather... On Feb 21, 2004, at 12:44 AM, Christopher Mitchell wrote: Dar, This seems to have helped. Evidently although the script local variables are declared outside handlers, the put assignment is not evaluated so they must be initialized in the declaration if they need initial values. If they were all dynamic values perhaps declaring at the top then immediately following with a set of initialization assignments in cardOpen. Thanks very much. Yours, Chris On Feb 20, 2004, at 7:21 PM, Dar Scott wrote: On Friday, February 20, 2004, at 05:55 PM, Christopher Mitchell wrote: --card script begins here local rotAngle put 20 into rotAngle on mouseUp answer rotAngle end mouseUp -- Does this help? --card script begins here local rotAngle = 20 on mouseUp answer rotAngle end mouseUp -- See "About... the structure of a script" in the doc. My question is, why does this not put up an answer dialog with "20" in it? the dialog that comes up is empty. Another question might be why doesn't the compiler complain. I have gotten the impression is that this is for some legacy code in which people hide data in scripts for some reason. Dar Scott ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: simple local variable question
Dar, This seems to have helped. Evidently although the script local variables are declared outside handlers, the put assignment is not evaluated so they must be initialized in the declaration if they need initial values. If they were all dynamic values perhaps declaring at the top then immediately following with a set of initialization assignments in cardOpen. Thanks very much. Yours, Chris On Feb 20, 2004, at 7:21 PM, Dar Scott wrote: On Friday, February 20, 2004, at 05:55 PM, Christopher Mitchell wrote: --card script begins here local rotAngle put 20 into rotAngle on mouseUp answer rotAngle end mouseUp -- Does this help? --card script begins here local rotAngle = 20 on mouseUp answer rotAngle end mouseUp -- See "About... the structure of a script" in the doc. My question is, why does this not put up an answer dialog with "20" in it? the dialog that comes up is empty. Another question might be why doesn't the compiler complain. I have gotten the impression is that this is for some legacy code in which people hide data in scripts for some reason. Dar Scott ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: simple local variable question
However, that is contrary to the documentation for the local command: You create a script local variable by using the local command in a script, outside any handlers in the script. (pasted from transcript dictionary) So I'm still not convinced that it must be in a handler, or if so then the documentation is misleading. Yours, Chris On Feb 20, 2004, at 7:20 PM, Phil Davis wrote: - Original Message - From: "Christopher Mitchell" <[EMAIL PROTECTED]> To: "How to use Revolution" <[EMAIL PROTECTED]> Sent: Friday, February 20, 2004 4:55 PM Subject: simple local variable question Howdy, I'm declaring some local variables at the top of a card script that I need to use in several handlers... here is a simplified recipe question that will help me understand why I'm not able to access the values I'm assigning to them: --card script begins here local rotAngle put 20 into rotAngle on mouseUp answer rotAngle end mouseUp -- My question is, why does this not put up an answer dialog with "20" in it? the dialog that comes up is empty. It comes up empty because nothing can ever cause 'rotAngle' to be set. Any executable code not inside a handler can never be executed. Phil Davis Thanks, Chris ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: simple local variable question
ahh. i suspect putting this in an onCardOpen handler will do the trick then, thanks for the kick in the logical pants. :) Yours, Chris On Feb 20, 2004, at 7:20 PM, Phil Davis wrote: - Original Message - From: "Christopher Mitchell" <[EMAIL PROTECTED]> To: "How to use Revolution" <[EMAIL PROTECTED]> Sent: Friday, February 20, 2004 4:55 PM Subject: simple local variable question Howdy, I'm declaring some local variables at the top of a card script that I need to use in several handlers... here is a simplified recipe question that will help me understand why I'm not able to access the values I'm assigning to them: --card script begins here local rotAngle put 20 into rotAngle on mouseUp answer rotAngle end mouseUp -- My question is, why does this not put up an answer dialog with "20" in it? the dialog that comes up is empty. It comes up empty because nothing can ever cause 'rotAngle' to be set. Any executable code not inside a handler can never be executed. Phil Davis Thanks, Chris ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
simple local variable question
Howdy, I'm declaring some local variables at the top of a card script that I need to use in several handlers... here is a simplified recipe question that will help me understand why I'm not able to access the values I'm assigning to them: --card script begins here local rotAngle put 20 into rotAngle on mouseUp answer rotAngle end mouseUp -- My question is, why does this not put up an answer dialog with "20" in it? the dialog that comes up is empty. Thanks, Chris ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution