Hit a bit of a stumper for me.
At preopencard time I need to clear a bunch of globals. I created the
following handler and it doesn't seem to clear the globals involved. In
a succeeding handler they keep their previous values. Am I doing
something fundamentally wrong?
preOpenCard
put
"gBulletCalibre,gBulletDesign,gBulletSizedDiam,gBulletNomWeight,gBullet LotCustom"
into gGlobalsToEmpty
repeat with x = 1 to the number of items of gGlobalsToEmpty
put empty into item x of gGlobalsToEmpty
end repeat
end preOpenCard
When faced with a series of globals to reset to zero or empty how do you
do it with a minimum of scripting?
Mark MacKenzie
Hi Mark, You have to declare global variables :
on preOpenCard
local tGlobalsToEmpty, tGlobalName
-----
put "gBulletCalibre,gBulletDesign,gBulletSizedDiam,gBulletNomWeight,gBulletL otCustom" into tGlobalsToEmpty
repeat for each item tGlobalName in tGlobalsToEmpty
do "global" && tGlobalName
do "put empty into" && tGlobalName
end repeat
end preOpenCard
You can also declare your globals outside the handler at the top of the script and forget nominal declaration in the preOpencard handler:
global gBulletCalibre,gBulletDesign,gBulletSizedDiam,gBulletNomWeight,gBulletLo tCustom
-----
on preOpencard
local tGlobalsToEmpty, tGlobalName
-----
put "gBulletCalibre,gBulletDesign,gBulletSizedDiam,gBulletNomWeight,gBulletL otCustom" into tGlobalsToEmpty
repeat for each item tGlobalName in tGlobalsToEmpty
do "put empty into" && tGlobalName
end repeat
end preOpenCard
Hope this helps, Amicalement,
�ric Chatonet 24, Boulevard de Port-Royal 75005 Paris_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
