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 Professional Discussion / A Strange Thing Happened When I Coded This...[DBPro 7.7]

Author
Message
WickedVixen
19
Years of Service
User Offline
Joined: 28th Mar 2007
Location: New Brisbane, Utopia Prime, VGC GHQ
Posted: 7th Feb 2012 16:08
I have a strange issue with some code I'm using for a possible random creature generation program. (I'm using it to create and sort a database of sorts for an upcoming MMO project.)

Here's the code in its entirety...
EXAMPLE ONE:


Also, I tested another chunk of code that did the same things and IT WORKED...
EXAMPLE TWO:


Can anyone explain why this is not working in my 1st Example while it works in my 2nd? The code generates all the needed stuff for Enemy(1), including HitChance, but nothing beyond that, the HitChance is not calculated beyond Enemy(1), but in the 2nd example, HitChance is calculated in all of the Foe output...

Please advise.

There's a thin line between Genius and Insanity.
Which side are you on? (Or is it more likely that you're balancing precariously on that line and struggling not to fall one way or the other?)
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 7th Feb 2012 16:38
Well, I think

Repeat
Until hitc > 0

stops the loop, because hitc is > 0 after 1 loop.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Feb 2012 19:24
This line is your problem, surely.



None of the other enemies get their values changed from the default 0.
WickedVixen
19
Years of Service
User Offline
Joined: 28th Mar 2007
Location: New Brisbane, Utopia Prime, VGC GHQ
Posted: 9th Feb 2012 05:27
Thank you GGandalf! I've been beating my head against my keyboard for a few days now because of not being able to see that...

I feel stupid about a simple typo like that-- thanks for the fresh eyes-- I really needed that...

^_^

There's a thin line between Genius and Insanity.
Which side are you on? (Or is it more likely that you're balancing precariously on that line and struggling not to fall one way or the other?)
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th Feb 2012 13:41
No problem. We all do it from time to time. It's very hard not to "see" what you expect to see when checking your own code.

Login to post a reply

Server time is: 2026-07-10 03:09:13
Your offset time is: 2026-07-10 03:09:13