Opening a stack causes malfunctions?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Opening a stack causes malfunctions?
Hello. I have been working with livecode for a game programming unit and have come across a reoccurring problem. Whenever I open my game, I cannot select anything and the entire program is frozen until I try to close it. Then I am redirected to the faulty code which I have created for a timer in my game. After this, the program is still in a frozen state and stops responding. I cannot edit anything in the stack so it keeps happening every time I try to open it. I'm very worried as I have spent a lot of time creating this game and now it has been made redundant by some bad code. Could anybody please help me out? I would link an image of the program in it's frozen state but it appears I am unable to do that as my account does not have the permissions. Here is the code that is targeted:
on timer x
repeat
subtract x from TimeLeft
put TimeLeft into TimeLeftoutput
wait 1 second
end repeat
end timer
TimeLeft is a local value. The error code displayed by the program targets the line "wait 1 second" with the error code - "card "card id 1002": execution error at line 72 (wait: aborted), char 1"
EDIT: It's also worth noting that this has happened on another machine other than my home computer.
on timer x
repeat
subtract x from TimeLeft
put TimeLeft into TimeLeftoutput
wait 1 second
end repeat
end timer
TimeLeft is a local value. The error code displayed by the program targets the line "wait 1 second" with the error code - "card "card id 1002": execution error at line 72 (wait: aborted), char 1"
EDIT: It's also worth noting that this has happened on another machine other than my home computer.
Re: Opening a stack causes malfunctions?
Hi user99
Using a repeat loop for a timer is not a good way
Using pendingmessages is better.
If you choose repeat you have to put "with messages" after your wait message like this:
Best regards
Jean-Marc
Using a repeat loop for a timer is not a good way
Using pendingmessages is better.
If you choose repeat you have to put "with messages" after your wait message like this:
Code: Select all
on timer x
repeat
subtract x from TimeLeft
put TimeLeft into TimeLeftoutput
wait 1 second with messages
end repeat
end timer
Jean-Marc
https://alternatic.ch
Re: Opening a stack causes malfunctions?
Thank you, but I can't edit the code at all since the program will freeze up when I try to open the stack.jmburnod wrote:Hi user99
Using a repeat loop for a timer is not a good way
Using pendingmessages is better.
If you choose repeat you have to put "with messages" after your wait message like this:Best regardsCode: Select all
on timer x repeat subtract x from TimeLeft put TimeLeft into TimeLeftoutput wait 1 second with messages end repeat end timer
Jean-Marc
Re: Opening a stack causes malfunctions?
Here is a simple Timer using pendingmessages
I hope its help in your case
I hope its help in your case
- Attachments
-
- TimerSendInTime.livecode.zip
- (1.52 KiB) Downloaded 177 times
https://alternatic.ch
Re: Opening a stack causes malfunctions?
Sorry, I don't think you quite understand my dilemma. My main stack will freeze the program upon opening, meaning I cannot edit anything in the entire stack. I'm led to believe that the code mentioned is causing this, but I cannot do anything about it since the program is frozen every time.jmburnod wrote:Here is a simple Timer using pendingmessages
I hope its help in your case
Re: Opening a stack causes malfunctions?
OK. Try thisMy main stack will freeze the program upon opening, meaning I cannot edit anything in the entire stack
create a new stack with one btn with this script:
Code: Select all
on mouseUp
answer file "open" -- select your stack
if it = empty then exit mouseup
set the lockmessages to true
open stack it
set the lockmessages to false
end mouseUp
https://alternatic.ch
Re: Opening a stack causes malfunctions?
I shall try this. Thanks very much!jmburnod wrote:OK. Try thisMy main stack will freeze the program upon opening, meaning I cannot edit anything in the entire stack
create a new stack with one btn with this script:Code: Select all
on mouseUp answer file "open" -- select your stack if it = empty then exit mouseup set the lockmessages to true open stack it set the lockmessages to false end mouseUp
Re: Opening a stack causes malfunctions?
It is easier to just click the icon in the top toolbar named "Messages". When that icon is bold, none of your scripts will run. You don't need to write any scripts. Remember to turn messages back on when the stack is read to test and run again.
You need to turn off messaging before you open the stack, otherwise you won't get a chance to do it.
You need to turn off messaging before you open the stack, otherwise you won't get a chance to do it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Opening a stack causes malfunctions?
It worked. Thanks again.