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 / Has anyone had this bug before?

Author
Message
Rwilson
21
Years of Service
User Offline
Joined: 19th May 2003
Location: United States
Posted: 25th Aug 2003 22:04
When you run the code below, it compiles fine, no syntax errors, but it stays up for all of a second befoer closing. I then attempted to use the step by step Debug. When it attmepts to compile, it says it doen't undestand Line 1, which is a remstart. I'm convinced the bug is somewhere in my own code, but since the blasted program is convinced to not tell me where the problem is, I'm stumped. Does anyone know why it's doing this?
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 25th Aug 2003 22:45
Very odd indeed, have narrowed it down to the subroutine 'APStatMathP1'. If you comment out all the commands in that subroutine, all is ok. BUT uncomment just one of the commands and the command definetly runs but crashes on the 'return' command.

Looks like a bug when setting complicated typed arrays in a subroutine.

Needs more investigation...

The programmer formerly known as sonic
Rwilson
21
Years of Service
User Offline
Joined: 19th May 2003
Location: United States
Posted: 25th Aug 2003 22:51
Ah, so thats where it is! The problem lays less, me thinks, in it being complicated, but more in two different types of user defined types, for you see, this piece of code worked perfectly fine untill I tried putting in a number from an entirely different UDT. I shall experiment and see if this is a continuing issue, or if perhaps there is another bug I am missing. Be back soon!
Rwilson
21
Years of Service
User Offline
Joined: 19th May 2003
Location: United States
Posted: 25th Aug 2003 22:59
Hmph, It appears the problem is actually in these two types and arrays:
TYPE Weapons
Name AS STRING
Class AS STRING
DamageMod AS INTEGER
CounterEnh AS INTEGER
DefenseEnh AS INTEGER
SpeedEnh AS INTEGER
MagicPowerEnh AS INTEGER
WeaponHitRate AS INTEGER
ENDTYPE

TYPE Armors
Name AS STRING
Class AS STRING
DefenseEnh AS INTEGER
SpeedEnh AS INTEGER
MagicDefEnh AS INTEGER
DodgeRateEnh AS INTEGER
ENDTYPE

Dim EquippedWeapon(1) AS Weapons
EquippedWeapon(1).Name="Attack Dagger"
EquippedWeapon(1).Class="Sword"
EquippedWeapon(1).DamageEnh=20
EquippedWeapon(1).CounterEnh=0
EquippedWeapon(1).DefenseEnh=5
EquippedWeapon(1).SpeedEnh=5
EquippedWeapon(1).MagicPowerEnh=0
EquippedWEapon(1).WeaponHitRate=10

rem Currently Equipped Armor
Dim EquippedArmor(1) AS Armors
EquippedArmor(1).Name="Simple Leather"
EquippedArmor(1).Class="Light Armor"
EquippedArmor(1).DefenseEnh=14
EquippedArmor(1).SpeedEnh=4
EquippedArmor(1).MagicDefEnh=0
EquippedArmor(1).DodgeRateEnh=5

I'm looking at them now, and see no obvious error in thier makeup or syntax, but I will keep looking. Does anyone See something I don't?
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 25th Aug 2003 23:33
I think I've sussed it. Just move your gosub down past all the dim assignments and all is ok. You are trying to do calculations on undimmed arrays!

The programmer formerly known as sonic
Rwilson
21
Years of Service
User Offline
Joined: 19th May 2003
Location: United States
Posted: 25th Aug 2003 23:46
:Jaw Drops: How could I have missed that! This is what i get for starting to program after less than 30 minutes of being awake with no coffee. Truely one of my silliest mistakes! Thank you very much Spooky. Very much appreciated !

Login to post a reply

Server time is: 2024-09-20 21:26:37
Your offset time is: 2024-09-20 21:26:37