Just a Scripting Question

Sarah Reichelt sarah.reichelt at gmail.com
Tue Jun 20 23:18:16 EDT 2006


> Sarah was helping me on this. I need to run some script before anyone
> sees the program.
>   I really just need to know how to write a script that does this:
>
> On PreOpenstack
> lock screen
> send mouseup to button "play game"
>
> -- Ah, here's my problem. The "play game" button asks if I really want
> to play-- with "YES" or "No." What do I write to click the YES option?
> The user won't be able to see the yes option (and he shouldn't) and so
> that option has to be clicked by something in my script. Is it "send
> mouseup to YES," or "select YES?" Or "send mousedown and put Yes into
> it??
>
> -- I'm sure this is elementary to some of  you.
>
> unlock screen
>
> End PreOpenstack
>
> I have a lot of script in that Play Game button and when it runs once,
> it seems to run quicky afterwards. Thus, I want to run it with the
> screen locked in Preopenstack so the program will run quickly right
> from the beginning and not be sluggish the first time the user clicks
> it.


Tom, you need to separate the script in your mouseUp handler into 2
sections: 1 will just do the initialisation stuff and then other will
ask the question and then do the initialisation stuff.

e.g.

on mouseUp
  answer "Start new game?" with "No" or "Yes"
  if it = "Yes" then doInitGame
end mouseUp

on doInitGame
  lock screen
  -- all the rest of your mouseUp script goes here
end doInitGame

In your preOpenStack handler, you don't send a mouseUp to the button,
you send "doInitGame" to the button.

HTH,
Sarah



More information about the use-livecode mailing list