script help

Klaus Major klaus at major-k.de
Fri Mar 17 14:46:08 EST 2006


Hi Ben,

> I have a stack that with 141 cards.  40 of the cards have images  
> set on a timer :
>
> on openCard
> wait 2 seconds
> hide image "img1"
> end openCard
>
> I need to make an openStack script that will set the images to  
> "show".  My usual lowbrow, untrained approach is to hard code it,  
> which gets tedious:
> on closeCard
> show img "img1"
> end closeCard

Use "preopencard" that will happen BEFORE a card is drawn on the screen,
see below...
> I want to make a stack script for this easy problem, so that all  
> images are set to "visible = true" or "show".  I just can't get it  
> right.
>
> on preOpenStack
> put the number of cds into cardCount
> repeat with x = 1 to cardCount
> end repeat
> put the number of images into imageCount
> repeat with y = 1 to imageCount
> end repeat
> put the ID of image y of cd x into imageNameList --(something is  
> wrong here)
> repeat for each line Joe in imageNameList
> set the visible of image q to true
> end repeat
> end preOpenStack

Let me see if I get you right:

You want to hide every image on every card before you go to that card?
And have this in the stackscript?

In that case put this "preopencard" handler into the stackscript!

on preopencard
   repeat with i = 1 to the num of imgs
     hide img i
   end repeat
end preopencard

> I think part of my problem is that I don't really understand the  
> repeat syntax.
>
> 1) is there any design flaw using the wait/hide format?

"hide" is immediate, but "wait" will halt the application for the  
time you wait,
means you cannot click buttons etc. in this time.

But you can force the "wait" clause to NOT halt the whole app by adding:

on openCard
    wait 2 secs WITH MESSAGES
    hide image "img1"
end openCard

Now you can enter text into fields, click buttons etc... during these  
2 seconds.

> 2) How can I re-write the preOpenStack script to do what I want?

See above...

>  I'll eagerly read any pointers.

Hope that helps...

> Thanks for any help,
>
> Ben

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the use-livecode mailing list