script help

Mark Schonewille mark.sch at wanadoo.nl
Mon Apr 24 10:39:15 EDT 2006


Hi Ben,

Showing the images on all cards may take some time, depending on the  
size of your stack. So, I thinkl that your original script without  
the repeat loop is the best option. What about the following script  
at stack level:

on preOpenCard
   show img 1
end preOpenCard

on openCard
   wait 2 secs
end openCard

If you want to avoid the interface to lock up during the wait  
command, you could also do this:

on preOpenCard
   show img 1
   send "hideImg" to me in 2 secs
end preOpencard

on hideImg
   hide img 1
end hideImg

If you need a list of images for a repeat loop, you need to put the  
data after rather than into a variable:

put empty into myList
repeat with x = 1 to number of cards
   put (the id of img 1 of cd x) & return after myList
end repeat

It is not clear to me, though, why you would want to make a list:

repeat with x = 1 to number of cards
   show img 1 of cd x
end repeat

Of course, this assumes that you always want to show image 1. You  
probably want to give the image on each card the same name and adjust  
the scripts accordingly.

Best,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to set up your own web store: http:// 
www.salery.biz/salery.html


Op 24-apr-2006, om 14:42 heeft David Burgun het volgende geschreven:

> On 17 Mar 2006, at 19:21, Ben Bock wrote:
>
>> 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
>>
>> 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
>>
>>
>>
>> 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?
>>
>> 2) How can I re-write the preOpenStack script to do what I want?
>>
>>
>>
>>  I'll eagerly read any pointers.
>>
>>
>>
>> Thanks for any help,
>>
>>
>>
>> Ben



--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to set up your own web store: http:// 
www.salery.biz/salery.html




--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to set up your own web store: http:// 
www.salery.biz/salery.html





More information about the use-livecode mailing list