Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Exit loop?

Author
Message
mmmpie
18
Years of Service
User Offline
Joined: 18th Apr 2006
Location:
Posted: 19th Apr 2006 04:18
This may seem like a stuped question but how do i make it so when i press a key it exits a loop.
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 19th Apr 2006 05:44 Edited at: 19th Apr 2006 05:45
do
if spacekey()```or whatever else``` then gosub exitloop
loop
exitloop:
end ```or whatever```
Relativity
19
Years of Service
User Offline
Joined: 29th Mar 2005
Location: Position is relative.
Posted: 19th Apr 2006 05:44 Edited at: 19th Apr 2006 05:45
If it doesn't matter what key it is then use


If it does matter then just replace scancode with keystate and put the ASCII value of the key you want pressed in the parentheses.

By the way, that source button is evil. It never works. Use the CODE button instead. It'll section your code off like you see above.
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 19th Apr 2006 05:45
i know but its an example!!!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Apr 2006 07:32 Edited at: 20th Apr 2006 07:23
The source button does work - you just have to be nice to it!

[Edit]

Actually, I should have mentioned it at the time of posting, but new(ish) members of the forum can't use the Source button method of posting code - it automatically enables itself after a while.

Just use the Code tags in the meantime...

TDK_Man

mmmpie
18
Years of Service
User Offline
Joined: 18th Apr 2006
Location:
Posted: 19th Apr 2006 19:26
thx
Firewood
19
Years of Service
User Offline
Joined: 24th Jul 2005
Location:
Posted: 19th Apr 2006 23:59
Relativity gives the best solution. Is you use a gosub for a exit of a loop. You gone to stack return adresses. If you do this lot and not using a return statment eventuly your stack will fill up.

For me EXIT is the only way to use. Its a neet option and you don't use resources of any kind.

But DO NOT take it as a final option because TDK is a good programmer and he does know a lot of this. He did make a lot of good tutorials. So if he says it can than it is possible.

Never say a question is stupid. Questions not ask are stupid.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Apr 2006 00:20
Depending on the type of loop you have, in addition to that posted by Relativity, you can do the following:






The 'exit' command will work on any proper loop (for/next, do/loop, repeat/until, while/endwhile). That excludes loops you make using goto of course.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th Apr 2006 01:07
Quote: "That excludes loops you make using goto of course"

which you shouldn't do anyway

Login to post a reply

Server time is: 2024-11-27 21:50:17
Your offset time is: 2024-11-27 21:50:17