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 / Calculator trouble

Author
Message
Tucker
14
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 4th Jul 2010 05:46
Hey guys, i've been trying to make a calculator with some simple functionality like addition subtraction etc, but have got a jumbled mess of a code. what is wrong, and could someone help out with correcting the messed up areas. From there i am hoping to add square roots and sin cos and tan functionality. below is the code i have so far.
Any help at all would be greatly appreciated.




Bow Chika Bow Wow
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 4th Jul 2010 09:00
Hi, your first problem is that 'returnkey' is a keyword and cannot be used as a variable.

The second problem is that the text command can only display a string. To make the text command work, use str$(a#).

Thirdly, you may have to make some major adjustments to your program as the 'goto' command is strongly discouraged and results in "spaghetti code". It is probably better to used the 'gosub' command instead. Have a look at TDK's tutorials for more info.

TDK's tutorials:
http://forum.thegamecreators.com/?m=forum_view&t=96075&b=7

Hope this helps!!!

A clever person solves a problem, a wise person avoids it - Albert Einstein
Tucker
14
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 4th Jul 2010 12:54
Aw k, Im just gonna throw that code out the window. I have provided a working improvement below, but i want to add and use the entrybuffer command, where and how should that be implemented?


Thanks for the help

Bow Chika Bow Wow
Tucker
14
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 6th Jul 2010 08:49
ok, so can someone provide an example using my code on how to use entry buffer instead of the input command? ive tried, but failed.


Can some one quickly rewrite the code in my previous post and implement an entrybuffer command so i can understand what needs to be done?

Bow Chika Bow Wow
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 6th Jul 2010 10:34
Entry Buffer command??? Does one exist in DBPro's command set? Where and how to implement really depends on what you want to use it for and when you want to use it.

Sorry I couldn't be more help

Good luck with your program

A clever person solves a problem, a wise person avoids it - Albert Einstein
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 13th Jul 2010 22:08
Entry$() doesn't pause the whole game while you type like Input does; the game keeps on going. Entry$() just tells you all of the keys that the user has pressed since the program started. CLEAR ENTRY BUFFER erases the list so the user can start from scratch. If you write Entry$(1) instead of Entry$(), then the user will be able to erase using backspace. If you want the game to stop and wait for the user to finish typing then you should give the user a chance to type and make a loop. For example, this:



Might become something like this:



I don't know what that part was actually supposed to do in your program (I'm not sure what INPUT$1 or a# were.), so I just put the entry$() part there and left it at that. Also, I don't think INPUT$1 is a valid name for a variable. The PRINT command will print over and over again down the screen, so you might need to add SET CURSOR in there somewhere to tell PRINT to only print in one spot.

Login to post a reply

Server time is: 2024-11-24 13:59:11
Your offset time is: 2024-11-24 13:59:11