Page 2 of 2

Re: damage from enemy and destroying object

Posted: Tue Mar 01, 2016 2:45 am
by dunbarx
Hi.

Simon made a point. You may not make (easily) Call of Duty 9, but you can surely make your app. I was merely trying to make you see that certain languages have certain strengths. Many new users, often young, come here and want to make games. Fine and good. Richard Gaskin just posted an excellent exposition on just this sort of thing. See the thread "Re: Livecode vs Other Cross Platform Development Tools" in the intermediate section.

But I am an LC advocate through and through. I say bring it on...

As for your stack locking up, you may have a loop that starts on openCard or someSuch, and that is what appears to be frozen. Have you tried Cmd-Period during that time?

You also can open another stack, and in some manner "edit the script of stack "yourFrozenStack". But know that if there really is something wrong, or a loop is running, then you may be blocked from that option. But if you can get to any part of that stack that is NOT frozen, then try editing scripts( or commenting large sections out). That stack has to either open or in memory for you to do that. Good Luck...

Craig

Re: damage from enemy and destroying object

Posted: Tue Mar 01, 2016 2:52 am
by Newbie4
Before you open your stack, suppress all messages and errors. That will allow you to find and fix the offending line

Re: damage from enemy and destroying object

Posted: Tue Mar 01, 2016 3:05 am
by ethanCodes
dunbarx wrote:
I was merely trying to make you see that certain languages have certain strengths. Many new users, often young, come here and want to make games.
I know what you mean. I am not one of those people. lol. Like I said, I wouldn't even know what LC is if it wasn't for this class. Not saying I don't like LiveCode. It just takes some getting used to. But I definitely would not use it to make games.

Re: damage from enemy and destroying object

Posted: Tue Mar 01, 2016 5:13 am
by jacque
ethanCodes wrote:I completely agree with you guys that this is not the program to use for making this game, however it is an assignment for a class, and the choices of games were limited. Thank you for some of the answers. I will continue to look into these. I have run into a bit of a snag. While experimenting with some bits of code, I seem to have done something that immediately freezes the program when it gets to the card with the problem code. The problem is that I must have accidently saved it after this code was activated, because now every time I open that program, it freezes. Is there any hope to somehow get back to the source code so I can delete that code? Or am I doomed to start over from scratch...
You're okay, the code is probably in an infinite loop. There is a button on the top toolbar labelled "Messages". Click that so it gets bolded. That stops your scripts from running. Then you can go to that card and fix the script that is hanging things. Remember to click Messages again when you're done so your revised scripts will run.

Edit: BTW, I've made several games with LC, just not battle/action games. Mine are more sedate.

Re: damage from enemy and destroying object

Posted: Tue Mar 01, 2016 6:05 am
by dunbarx
Ethan.

Chek out Jacque's "Blocks" in the sample stacks section. Addictive. I went to a support group to kick the habit.

Craqu

Re: damage from enemy and destroying object

Posted: Tue Mar 01, 2016 8:10 am
by FourthWorld
ethanCodes wrote:...it is an assignment for a class, and the choices of games were limited.
I'm impressed that your instructor chose this exercise. I'm collecting info on uses of LiveCode in education, and if your instructor would be interested in helping me identify ways we can improve the LiveCode experience for educators please pass along my email address: richard AT livecode.org

Re: damage from enemy and destroying object

Posted: Wed Mar 02, 2016 12:53 am
by ethanCodes
jacque wrote:
You're okay, the code is probably in an infinite loop. There is a button on the top toolbar labelled "Messages". Click that so it gets bolded. That stops your scripts from running.
You are a life saver! Thank you so much man! So, the code that caused this whole catastrophe was "on openCard wait timeStart seconds" where timeStart was a variable holding 180. Why would this cause the program to freeze?

Re: damage from enemy and destroying object

Posted: Wed Mar 02, 2016 1:26 am
by dunbarx
It didn't "freeze", it was just doing what you told it: wait 3 minutes.

You need more patience.

Craig

Re: damage from enemy and destroying object

Posted: Wed Mar 02, 2016 8:24 am
by jacque
dunbarx wrote:Chek out Jacque's "Blocks" in the sample stacks section. Addictive. I went to a support group to kick the habit.
:) This gave me a warm glow and a laugh. Thank you.

I'll have to check the version in the sample section, I updated the graphics and images a while back but I don't remember if I uploaded that one. It looks better now.

Re: damage from enemy and destroying object

Posted: Thu Mar 03, 2016 4:44 am
by ethanCodes
dunbarx wrote:It didn't "freeze", it was just doing what you told it: wait 3 minutes.

You need more patience.

Craig
but why would it not let me stop the code? I put the amount of time in a variable so that I can use a button to change that variable to 0, thus skipping the wait time. But it didn't seem to work.

Re: damage from enemy and destroying object

Posted: Thu Mar 03, 2016 9:28 pm
by jacque
ethanCodes wrote:
dunbarx wrote:but why would it not let me stop the code? I put the amount of time in a variable so that I can use a button to change that variable to 0, thus skipping the wait time. But it didn't seem to work.
The "wait" command is blocking, that is, nothing else happens until the wait period finishes. You can add "with messages" to allow other events to occur, but the handler that contains the wait command will still not continue until the waiting period is over.

Re: damage from enemy and destroying object

Posted: Sat Mar 05, 2016 4:44 am
by ethanCodes
Oh I see. so I am trying to set a wait time before the enemies start advancing, but I need to be able to set that wait time to 0 and start them immediately if a button is clicked. Right now I have the wait command set at 180 seconds, and the 180 is held in a variable. the start now button has code that says on mouse up put 0 into timeStart, which I believe should change whatever is in timeStart to 0, thus ending the wait period. But it's not working. Any ideas?

Re: damage from enemy and destroying object

Posted: Sat Mar 05, 2016 5:44 am
by dunbarx
If I get what you are saying, you want to get rid of that constant 180. Perhaps, instead, wait until an action is performed. Something like:

Code: Select all

wait until the mouse is down
or
wait until the mouse is down and the mouseLoc is within the rect of button "start"
Do you see what that last option simulates? Remember that wait is still blocking; this is a way out, that seems to act as if clicking a button kills the block.

Or, as Jacque mentioned, if you allow messages, you can do other things, but this might still hang you up

Better never to wait at all. There are better methods entirely. I would need to know more about your desired sequence to advise you

Craig

Re: damage from enemy and destroying object

Posted: Sat Mar 05, 2016 6:24 am
by ethanCodes
each level of the game needs to wait 180 seconds before enemies start to come, but the player also needs to have the option of skipping the wait time. Here is the code I tried to use, but it is giving me an error:

Code: Select all

   wait for timeStart seconds or until mouse is down and mouseLoc is within rect of button "Start Now"

Re: damage from enemy and destroying object

Posted: Sat Mar 05, 2016 12:34 pm
by AxWald
Hi,
ethanCodes wrote:

Code: Select all

wait for timeStart seconds or until mouse is down and mouseLoc is within rect of button "Start Now"
Guess "wait for ... or until ..." will not work :) But you could have a look at this card script:

Code: Select all

global WaitEnd

on opencard
   put Empty into fld "txt_fld"
   put the seconds +180 into WaitEnd
   WaitInit
end opencard

on WaitInit
   if WaitEnd is 0 then
      put "ACTION!" into fld "txt_fld"
      exit WaitInit
   else 
      if the seconds < WaitEnd then
         put WaitEnd - the seconds into fld "txt_fld"
         send "WaitInit" to me in 1 second
      else
         put "ACTION!" into fld "txt_fld"
         exit WaitInit
      end if 
   end if
end WaitInit
Exercise left for you: What does the "Stop" button do, what happens here, and how do you use it in your stack? ;-)

Have fun!