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 / Functions executing autonomously?

Author
Message
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 3rd Aug 2012 17:16
Hi all,

Been a while! But I've come across a weird phenomenon. My game is hitting a bug inside of a function that can't possibly have run yet... I can't put the actual code because there's far too much of it, but think of it like this:



See how the function isn't even being called? The error I'm getting is "Effect does not exist" so it's not a syntax error causing it. It only happens during runtime... Anyone ever had this happen?


basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 3rd Aug 2012 17:25
I tried it. everything seems ok.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 3rd Aug 2012 18:11
Probably it's just that the line number of the error message is wrong.

[b]
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 4th Aug 2012 03:48
@basjak - No, no, I explained in the post. That's not the actual code. The actual code is too long. The code I put there is to help explain what's going on.

@Diggsey - You're probably right there...


MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 4th Aug 2012 06:54 Edited at: 5th Aug 2012 19:20
If you are using modular programming, best to enable error trapping, found in the STYX plugin...

EDIT

Linked STYX for future readers

Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 4th Aug 2012 20:45 Edited at: 4th Aug 2012 20:46
if this your code, and you hading this error when you closing the engine, then you should know that dbp runs all the commands that after your loop when it exists. even if its a function
the way you can fix this is simple put END command on the next line after the LOOP command.




Advanced Updater for your games!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Aug 2012 21:00
Yes, I always put an end statement there just in case I exit the loop for some reason. Seems possible that's what's happening here.
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 4th Aug 2012 21:31 Edited at: 4th Aug 2012 22:59
It sounds more like a resource handling problem. If the error message is "effect does not exist"
and is occurring at runtime I would put some error checking where you use all your effects.
Resource handling in a game engine is one of the most important basic requirements.
I believe I had this problem once when experimenting with "Advanced Lighting". It turned out
to be a error with Evolved's find free resource functions. I use Matrix1's commands instead for
resource management.
This is the most common error people make in DBpro. You must consider resource
management especially if you want to avoid the "Device Lost" scenario which is not a bug in
DBpro as so many claim. Also DBpro does not run functions after exiting the main game loop.




[img][/img]


WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 5th Aug 2012 05:56
Thanks guys, I think the issue was what Sergey K was saying. Seems to have fixed things.


Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 5th Aug 2012 15:02 Edited at: 5th Aug 2012 15:03
If you're having a runtime error then the program is still inside the loop.
It is not logical to think that calling "end" after the loop would solve a runtime error.
Dbpro does not go in and out of the loop during runtime. You most likely still have a resource issue.

[img][/img]


WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 5th Aug 2012 16:44
It's not. It's a compiler error. It's been confirmed.


basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 5th Aug 2012 19:03
I had similar problem before when I ran a very long code. two functions, first sound function, second dialog box function. they worked when I took those functions and put them in very short program. but conflicted when back to the program.

however. they worked I created a new file and put them in it.

don't ask me why but try different options.

Login to post a reply

Server time is: 2026-07-08 10:39:36
Your offset time is: 2026-07-08 10:39:36