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.

DarkBASIC Discussion / Where is my error? (Input and If statement.)

Author
Message
P Schnell
20
Years of Service
User Offline
Joined: 13th Feb 2005
Location:
Posted: 22nd Feb 2005 00:40
When either player inputs their "attack type" in the combat system of a game I'm working on, it skips every "if" statement that calculates damage, and the result is consequently always zero.

The full executable code is here:


This is an example of the troubling section:


If you input "1" I want the code to print "hello" and wait for a key, but the program considers the "IF" statement false and continues.

Is this an issue with arrays or my syntax?

Thankyou,
Schnell

mathkid
20
Years of Service
User Offline
Joined: 1st Feb 2005
Location: Central Massachusetts
Posted: 22nd Feb 2005 05:54
I haven't really used the input command before. Try setting atyp(1)=1 and see if the if statement works. That way, you'll know where the error is.

Your if statement in the second block looks fine to me, so the error must be somewhere else.
P Schnell
20
Years of Service
User Offline
Joined: 13th Feb 2005
Location:
Posted: 23rd Feb 2005 05:30
Yes, if I place atyp(1)=1 before the IF, it works, must be something with arrays.

I'm now using:



Login to post a reply

Server time is: 2025-05-23 21:43:58
Your offset time is: 2025-05-23 21:43:58