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 / why is the LOAD OBJECT command being phyco!

Author
Message
orv
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 20th Oct 2003 03:00
the offending line:


when i call this line outside function below, the object loads just like it should.

when i call the function, when it gets to the LOAD OBJECT line, it says file not found.

it's the exact same line!

yes, the X file is in the directory.
no, i don't change directory somewhere in between (i don't do it at all.) this is WIERD!

please someone help me!

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1
orv
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 20th Oct 2003 03:08
i modified the LOAD OBJECT line to the following:



this is the exact path of the file. Still get file not found error!

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th Oct 2003 03:55
Just as a random guess, maybe the problem is with the nObj parameter and DB just isn't reporting the error correctly.

Insiiiiiiiiiiiiiiiiiiiiiiiide!
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 20th Oct 2003 05:30
Fallout nailed it. If you do not pass nObj to the function or you do not make it global, you have a local instance of nObj and not the one you think you have.
--
TAZ
orv
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 21st Oct 2003 05:19
Well, I might have typed in my code a little wrong, but that is not the problem.

Ah yes! UDTs strike again!!!!

this code does not work:


this code does work:


the difference? on is using a UDT, the other is not!

scary ayyye!?

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1
orv
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 21st Oct 2003 05:21
perhaps a buffer overflow the UDT's cause which stomps on the filename in memory that the LOAD OBJECT command is using?

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 21st Oct 2003 05:28
It's possible. You could try adding some "if nRunner > nMaxRunner" kind of logic and try to catch that problem.

Also, if you're incrementing nRunner should you not also be incrementing nObj? (Or, is that happening 'off screen'?)
--
TAZ
orv
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 21st Oct 2003 05:58
routine is calling:


so the object # is incrementing.
everything is working fine.

I started a new thread in the bugs area which shows my working code:
http://www.thegamecreators.com/?m=forum_view&t=18778&b=15

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1
las6
23
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Finland
Posted: 21st Oct 2003 13:27
Okay.. I have no clue on what's going on, but I'll pitch my thoughts:

Quote: "`LOAD OBJECT "C:\Program Files\Dark Basic Software\Dark Basic Professional\Projects\Alien Marathon\Alien.X", nObj
nObj = loadAnObject("Alien.x")"

Now, you are doing this the reverse way, on the first time, the nObj
would be zero = resulting into problems.

secondly, DB usually shows the Wrong line so the problem could be in the line below the error line. (the function that searches for the object.

Thirdly, I see you are using booleans. Booleans don't actually work, so use 0 and 1 instead.

the fourth point would be that many parts of that small snippet is useless, because you are using it inside a function. Variables are Local inside the function.

those won't necessarily fix your current problem... but may help in the future...

orv
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 21st Oct 2003 16:19
@las:
Ah! for the booleans i have a constant called TRUE which is set to 1
and a constant called FALSE that is set to 0!

also the first time this loadAnObject() function would be called, it [i]would[/] return the value of 1 not 0 (i checked)!

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1
orv
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 21st Oct 2003 16:21
also, if i was using zero for an object #, id get some other error regarding that Not an error saying that the file i specify does not exist (which it does)!

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1

Login to post a reply

Server time is: 2026-07-26 05:21:25
Your offset time is: 2026-07-26 05:21:25