Script not running closing card and returning

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Script not running closing card and returning

Post by stam » Thu Dec 21, 2023 8:45 am

Aduro91 wrote:
Thu Dec 21, 2023 2:53 am
This code I've asked about is the motor behind the game running. When I used Hypercard as a kid I could never create a game in which you had to do something before something else happens. This is because I would create buttons with something like wait 1 second, go to card "gameover" or what have you. Then I would notice that I can't click any buttons before the 1 second is up, same with if I was cycling through cards i.e., you can't shoot the bad guy before he shoots you, for example.
First of all, always best to ask here first, not Reddit ;)
The second-best place to ask stuff is usually stackOverflow.

Second of all, and most importantly: if this is simply to get around an issue with “wait”, which is an interface-blocking action, you can either use “send in time” as above OR “wait with messages” which is also a non-blocking action.


Another tip which I only became aware of very recently is that if you are using “move in time” to animate movement, which is also an interface-blocking action, you can add “without waiting” to the end of the command which turns it into a non-blocking command!
By and large this is all in the Dictionary although as this is usually laconic it needs careful reading, as it’s easy to miss stuff like this.

What it boils down to is if you post your problem code directly here someone is bound to respond with a solution in a day or two (usually!)

Glad you got your game working though! If it’s commercial you can post about it in the “Made with LiveCode” subforum to show what you’re doing, but if not commercial do also share the game directly here when done!

Stam

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Script not running closing card and returning

Post by dunbarx » Thu Dec 21, 2023 3:03 pm

Stam makes a point, in that we can really provide guidance if we see what you are up to.

I still am not sure what your timed gadget is used for. In other words, how does one interact with the ongoing changing process, flood or whatever.

In my earlier post (you can see that this uses the "send in time" that Stam mentioned) where I suggested you make a button and a field, if you then add another button and field and place this in the second button script:

Code: Select all

on mouseUp
   if word 1 of fld 1 < 500 then put random(999) into fld 2
end mouseUp
As the process is running, if you click button 2 when the numeric value of fld 1 is less than 500, you can "insert" a new process into the mix. You may want to increase the wait time in button 1 in order to experiment with it.

Again, I may be off into the weeds as far as your own intentions are. I really want only that you unlearn your HC thinking (it took me a long while to do so) and learn how (far more modern) LC does things.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Script not running closing card and returning

Post by dunbarx » Thu Dec 21, 2023 3:08 pm

Stam.

Oh boy, a newbie!

Craig

Post Reply

Return to “Talking LiveCode”