Page 1 of 1
Advancing cards after a random number of seconds
Posted: Thu Apr 17, 2014 9:28 pm
by coenzyme
I would like to create a script that when a card opens it will advance to another card after a random integer of seconds in between 1 and 10.
The card script that I have written is as follows:
Code: Select all
on openCard
global tWait
put random(10) into tWait
go to card 4 in tWait seconds
end openCard
The error message is:
card id 1011: compilation error at line 4 (Function: missing '('), char 20
I am new to LiveCode and am still getting used to the syntax, which is what I think is the cause of my problem.
Any help would be appreciated! Thanks!
Re: Advancing cards after a random number of seconds
Posted: Thu Apr 17, 2014 10:25 pm
by jacque
Right, the syntax won't compile. You need to do the wait and then go to the card in two separate commands:
Unless you're using tWait somewhere else in your stack, you probably don't need the global declaration.
Re: Advancing cards after a random number of seconds
Posted: Thu Apr 17, 2014 10:54 pm
by magice
another option is this
send "go to cd 4" to me in random(10) seconds
Re: Advancing cards after a random number of seconds
Posted: Fri Apr 18, 2014 2:25 am
by coenzyme
Thanks! That's exactly what I needed!
Re: Advancing cards after a random number of seconds
Posted: Fri Apr 18, 2014 4:16 pm
by jacque
magice wrote:another option is this
send "go to cd 4" to me in random(10) seconds
Does that work now? I've never been able to do that in the past.
Re: Advancing cards after a random number of seconds
Posted: Fri Apr 18, 2014 4:29 pm
by magice
jacque wrote:magice wrote:another option is this
send "go to cd 4" to me in random(10) seconds
Does that work now? I've never been able to do that in the past.
it worked for me when I tested it.
Re: Advancing cards after a random number of seconds
Posted: Fri Apr 18, 2014 6:18 pm
by jacque
So it does. I stopped using this kind of send command a long time ago because it always failed. It must have changed when I wasn't looking. Good info to have, thanks. Your way is much more concise, and I like concise.
Re: Advancing cards after a random number of seconds
Posted: Fri Apr 18, 2014 6:51 pm
by magice
jacque wrote:So it does. I stopped using this kind of send command a long time ago because it always failed. It must have changed when I wasn't looking. Good info to have, thanks. Your way is much more concise, and I like concise.
I would love to act really smart here, but the truth is, I just didn't know enough to not try it.
Re: Advancing cards after a random number of seconds
Posted: Fri Apr 18, 2014 7:34 pm
by jacque
That's what newbies are for. You help the rest of us.
