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 / Still got timer/ function problems

Author
Message
tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 13th Mar 2010 17:44
Ok i have read alot about timers and functions, and i kinda got my head round it, but i'm having problems with certain part, i have 3 cook buttons (this is a cafe game), i also have 3 functions for cooking, which numerous checks are used to make sure that the variables are all ok or else it gives you a message, so i am trying to cook 3 things at once, i thought i got it all covered, but it doesn't work correcty, 1st off the once cooking 1 item, if you try to cook another it gives the message which you have no food prepared, which is correct if there was not food prepared but there is, then when the 1st item has finished the nex item strts to cook on a minus timer...





FPS Creator Updated 116,Vista 32Bit UpTo Date, nVidea 8500 1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU
tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 14th Mar 2010 01:05
I've tried it numerous ways, but still no joy.




FPS Creator Updated 116,Vista 32Bit UpTo Date, nVidea 8500 1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Mar 2010 01:09
Quote: "After searching around this forum i found that i am probably best to use Subroutines for the items in my cafe game"


Your words. That's what you said in an earlier thread you made. Why didn't you?

You've just made a fairly straight forward program overly complicated by using functions for everything.

Functions should be used where they suit the purpose better than subroutines as they can complicate things a bit. Your functions would have been better subroutines and you wouldn't have had to declare all those floats, or pass all the parameters.

You are learning DB so you should stick to subroutines until you know what you are doing. When you do, go ahead and have everything in functions - at least then you will have the knowledge to sort out your own problems when they don't work.

And, although I've not looked at your code in detail, (with a code snippet that length, you really do have to fix the indentation if you want anyone to look at it. It's terrible at the moment), my guess is that your timer problem may possibly be related to local variables in functions.

But, I think I'm wasting my breath. You've been told all this before and like most of the other advice, chosen to ignore it. You don't appear to have read the tutorials I pointed you to either as all this is explained clearly in them.

Minor example: you are still leaving out the ':' multi-line separators before the Rem - which isn't good programming practice, even though it may well work!

Apologies for being down on you, but if you do it all wrong when you are learning, the problems will grow exponentially as your programs do.

TDK

tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 14th Mar 2010 11:58
Hi thanks for the reply, i did go and look at the link you gave me and read the timer tutorial,(in fact it's Permanently open in a seperate tab) which is where i learn't a bit more about them,
And yes my programming is probably messy, which i should know better as i learn't about that at college 12 years ago on my C++ course, and i have probably got used to VB too much as far as functions go.
And no you are not wasting your breath i am probably just to eager and not paitient enough, sort of running before i can walk.
So i shall go a read some more, it's just that sometimes someone can help better than reading from a tutorial as they can explain what needs to happen in your particular program.

But thanks for taking the time to post.

FPS Creator Updated 116,Vista 32Bit UpTo Date, nVidea 8500 1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU

Login to post a reply

Server time is: 2024-09-28 16:27:52
Your offset time is: 2024-09-28 16:27:52