Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > BASIC Help needed by a very basic programmer!

BASIC Help needed by a very basic programmer!
Thread Tools
Forum Regular
Join Date: Jan 2001
Location: Maryland
Status: Offline
Reply With Quote
Jul 14, 2001, 01:19 PM
 
Hi all, I posted this in the developer forum earlyer and while I do not produce software for OSX as of yet. It is my long "to do list" so PLEASE, PLEASE, spare a minute to puzzle your minds over my dumb programming mistakes. The origonal message was as follows.

"grrrrrrrrrrr ...... I can't get this one piece of code to work. It's a rather large block and since it's on a PC and I have no floppy drive I can't get it on my mac so I'll just describe my problem. I have a number of command operators dealing with simple equations. Such opperators as + and - are used. = is also used. My problem comes when I place a command such as
A=B-C
PRINT A
in this command, the computer adds b and c together instead of subtracting them. I tried fliping the sign (ie. +=- and -=+) but it still added. I'm sure that this is something that I'm missing just because I'm new at this. If any of you can help..... PLEASE, PLEASE DO!

Regards;
Andy Polack
A.L.P.S.
Andy Lyon Polack Studios "

Again, thank you for your time and brain power.

Oh yeah... and I use DarkBASIC.... DB Homepage Here
Feel free to e-mail me.
Thanks again! Bye
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
Jul 14, 2001, 03:06 PM
 
Originally posted by andypolack:
<STRONG>A=B-C
PRINT A
</STRONG>
Troll or genuine?

Okay. There are no obvious mistakes in the program (apart from using basic, but that's another discussion altogether). What values are you using for B and C? If C was negative, then A might appear at first glance to be b+c.
Apart from that, I'd suggest finding a better version of Basic. How about RealBasic (http://www.realbasic.com/)
     
Forum Regular
Join Date: Jan 2001
Location: Maryland
Status: Offline
Reply With Quote
Jul 14, 2001, 08:26 PM
 
OK.. thanks for the help.... I had to use a dec command as it turned out. Boy, do I feel dumb. PLEASE give me a break about useing BASIC, it's the only one that I can get my hands on cheap and get alot of help online.


NEWSFLASH: WHAT A SUPRISE, I HAVE ANOTHER PROBLEM AND THE CODE IS ON MY PC UPSTAIRS

PLEASE help with this one too! I have everything working except for one if then command, I have checked the command over and over again, but I can not get the computer to recconize that there is a command there. Might it have something to do with the fact hat it is inside of about 5 other if, then commands? Or is it the fact that I leave off the "then" and simply place at the end, an "endif" command. Or is it something else? I need bigtime help here and I feel cheap asking you all, but even the guy from Pangeasoft cant help me..... (I instant messaged him and asked him if he knew BASIC, responce, "haven't touched it in 20 years."

Regards,
Andy Polack
A.L.P.S.
Andy Lyon Polack Studios
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
Jul 15, 2001, 08:04 AM
 
Originally posted by andypolack:
<STRONG> I have everything working except for one if then command</STRONG>
If you post the bit that won't compile I (or someone else) may be able to spot something.

You may have hit a limit with your compiler - Basics often do have limit on the number of nested IF statements, although 5 does seem low. You might be able to restructure your code to use a CASE statement (may be SWITCH).

Regards, Ed Brown
     
Forum Regular
Join Date: Jan 2001
Location: Maryland
Status: Offline
Reply With Quote
Jul 15, 2001, 01:21 PM
 
Thanks, those both could work. My command is as follows

if enemy&gt;0
rem then command ommited
return
endif

it seems that the computer skips this step. The "enemy" real number starts at 80...

enemy#=80

I then pick a random number, one through 12 with the "rnd" command, assign it a varyable and subtract it from enemy# by use of the "dec" command. The computer neglects to read the "return" command (probably from plain old dumb user error) and, instead, continues on through the code. I have excecuted the same commands in other sections of the code and they work fine, why, now does it choose not to work?

Thanks for the help all the same Regards:
Andy Polack
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
Jul 15, 2001, 02:57 PM
 
Andy,

First thing to try is get the THEN on the same line as the IF:

if enemy&gt;0 then return

which would not need an endif.

If still no success then you could try the debugger (does your basic come with one?) and step through the code, starting a few lines before the problem area.

If no debugger then try printing the value of enemy before the IF statement:

PRINT enemy
if enemy&gt;0 then return

Also, do you have a way of syntax-checking your source code, or are any programming errors only flagged up at run time?

Regards, Ed Brown
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Computer Error: Unknown
Status: Offline
Reply With Quote
Jul 17, 2001, 07:47 PM
 
Originally posted by Ed De:
<STRONG>
...I'd suggest finding a better version of Basic. How about REALbasic (http://www.realbasic.com/)</STRONG>
I'd also suggest REALbasic. If you're a student or faculty at an educational instution (they're flexable, I got a licence when I was in middle school) you can get a decent discount ($109 for the standard academic version - a discount of $40. Its bigger for the pro edition).
"...Because the people who are crazy enough to think they can change the world,
are the ones who do."
-To the Crazy Ones

     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:13 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2