Qbasicnews.com
August 26, 2019, 12:44:53 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: ON TIMER  (Read 4801 times)
zoasterboy
Guru
**
Posts: 295


Personal Text!


WWW
« on: September 30, 2007, 09:49:00 PM »

I'm trying to use ON TIMER in a program, but so far everything I do with ON TIMER isnt working. I'm not sure if I'm using incorrect syntax or of it's just incorrect semantics.

Can anyone post up a simple example that does something every few seconds?

Thanks!
Logged

-yah
Mac
Senior Member
**
Posts: 243


WWW
« Reply #1 on: October 01, 2007, 12:39:16 AM »

post up a simple example that does something every few seconds?

Code:
ON TIMER(3) GOSUB Show3
TIMER ON
CLS
WHILE INKEY$ = "": WEND
SYSTEM
Show3:
ShowNow = ShowNow + 1
IF ShowNow = 3 THEN
  PRINT "Press any key to terminate program when you get tired of this"
ELSE
  PRINT "3 Seconds passed"
END IF
RETURN
Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #2 on: October 06, 2007, 10:50:17 PM »

 Angry

Well, zoasterboy. Are you some kind of idiot? Why haven't you replied to this thread. You have a proposed answer. If it is adequate, say "thanks", if not, state what further information you need.

Please stay off the internet if you are stupid to respond to answers to your questions.

Mac
 
Logged
wildcard
*.*
Administrator
__/--\__
*****
Posts: 2369



« Reply #3 on: October 07, 2007, 05:33:03 AM »

Angry

Well, zoasterboy. Are you some kind of idiot? Why haven't you replied to this thread. You have a proposed answer. If it is adequate, say "thanks", if not, state what further information you need.

Please stay off the internet if you are stupid to respond to answers to your questions.

Mac
 


Mac, zoasterboy has not logged back on or been here since he posted his question, some people don't have access to the internet regularly.
Logged
roy
Member
*
Posts: 33


« Reply #4 on: October 07, 2007, 11:24:32 AM »

I think Mac is mixing too much with Clippy from QBasic Station. It is funny but ever since I flamed Clippy, Mac has become more like Clippy and Clippy has become the good guy.
Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #5 on: October 08, 2007, 02:04:21 PM »

Mac, zoasterboy has not logged back on or been here since he posted his question, some people don't have access to the internet regularly.

Good point - I was losing it due to multiple unanswered posts on various forums and didn't think of internet access problems. Will try to be a little more tolerant in the future, but I really think a person should not post a question if he cannot get access. At the minimum, make signature equal to "Sorry, I can only access the internet once a month, so I will respond to any answers to my question much later."

Unfortunately, I think the honest signature of many people is

"Above is my question. If I figure it out myself or get an answer on some other forum, I will never respond to the effort you foolishly made to answer it. Even if I see your advice and try it later and it works, I am too selfish and lazy to think to come back - why should I do that? I already have all I need from you so get lost, loser!"

Whenever I post a question on any forum, I make a shortcut to that thread and put it on my desktop and click on it at least once a day until I feel it's time to close the thread with "Thanks" or "Never mind, I decided to do it some other way" or whatever.

But anyway, point taken, thanks wildcard.

Mac

 
Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #6 on: October 08, 2007, 02:13:33 PM »

I should add that zoasterboy posted the question at 1:49 and I answered at 4:39. Doesn't he know the difference between a forum and a chatroom? You have to check for replies even a day or two later. So even though I was extreme and will improve my wording in the future, he still owes the forum an explanation of what happened. Example I expect to see if he ever returns: "Shortly after I made that post, my PC busted and I lost all interest in that problem as I lost the program and all my data and have been working hard after school to save money to get a new PC. Now that I am back, sorry for your frustration - I'm sure your answer was useful and if I ever get back to that problem, I will try it".
Logged
zoasterboy
Guru
**
Posts: 295


Personal Text!


WWW
« Reply #7 on: October 24, 2007, 02:00:26 AM »

Hey people, sorry I havnt been around, Ive been highly busy with other things, I'm taking courses from this new IB program at school, and it's very home work intensive. The project involving this question was put to the side (A Qbasic based DDR clone, to be exact).

Also, usually I enable email alerts for new posts in topics I have posted in or created. I check my email daily, and always respond with some sort of recognition, but for some reason I didnt get an email for this post, and so as other things took my attention, I forgot about it.

Very sorry for seeming disrespectful, I'm truley thankful for the help!
Logged

-yah
Dr_Davenstein
Na_th_an
*****
Posts: 2052


« Reply #8 on: October 24, 2007, 03:18:06 AM »

Mac can be a dick. Don't worry about it. Wink I haven't been getting email replies from this site either.  Huh
Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #9 on: October 24, 2007, 09:06:23 AM »

I haven't been getting email replies from this site either.  Huh

That explains a lot. If the site email has broken but used to work, then I can see why someone would ask a question and not check back. No email means nobody answered so therefore no need to check back. All forgiven there.

I would have appreciated a comment about the code I supplied, but I also know that if you have lost all interest in the problem, you certainly have no interest in the solution.

In the future, I would advise all to use a forum where the EMail works.
http://www.network54.com/Forum/13959/
This works.

Mac
Logged
zoasterboy
Guru
**
Posts: 295


Personal Text!


WWW
« Reply #10 on: October 24, 2007, 10:18:47 AM »

Ah I figured out the problem, the new forums default setting for E-mail notification is to not send any unless you specifically choose the post you want to watch. It's easy to change, just hit the check box that says to send Email for topics you have started and posted in (Located in your profile settings > Notification and Email).

And the code works great for my program, one question, what is the purpose of "SYSTEM" on line 5? I've never seen that before.

Until now I was using SLEEP in the place of the ON TIMER function hah, it wasnt working so well.

Thanks!
Logged

-yah
Mac
Senior Member
**
Posts: 243


WWW
« Reply #11 on: October 24, 2007, 05:57:44 PM »



It's easy to change, just hit the check box that says to send Email for topics you have started and posted in


Thanks for the info!


what is the purpose of "SYSTEM" on line 5?


Really dumb newbies don't code anything to signify the end of their programs, they just run out of instructions at the bottom of their programs.

More experienced people use END

Experts use SYSTEM.

For compiled programs (QB4.5 or after), there is no difference other than if you are looking for places that a program terminates early, it is sure nice to search for SYSTEM and a pain to search for END.

For programs which are run in QBasic from the IDE, which programs were loaded or have stopped, there is also no difference.

BUT if you have your program stored as a file like this:

MyGame.BAS

and you have this BAT file:

MyGame.BAT
----------
QBasic /run MyGame


Then there is a LOT of difference. If you click on MyGame.BAT then if the program terminates with SYSTEM then it will run just the same as a compiled program, namely not stop and leave the game player staring at the IDE prompt.

Mac
Logged
zoasterboy
Guru
**
Posts: 295


Personal Text!


WWW
« Reply #12 on: October 24, 2007, 11:12:47 PM »

Ah ok that makes sense, SYSTEM returns to the "system" that called it, and END, like always, just ends.

That could come in handy actually, for a DOS based game console the computer club at my school is building.

Thanks for the help! when I get it running, I'll post up the code for the DDR (no dancing yet, just drumming)  program and instructions for building the keyboad based controler.
Logged

-yah
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!