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 / has anyone come across this? im stupified...

Author
Message
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 19th May 2003 10:26 Edited at: 19th May 2003 10:43
I can't find out what is making my program lag. Im trying to implement dockable toolbars, but when I detect mousex(),mousey(), and mouseclick() everything freezes, until I hit f12 and then it waits like 6 more secs to return to the editor. Try the code for yourself, click on the blue line on the left toolbar (with select,move,etc.), it freezes on me right there. Any help would be greatly appreciated.(right click, save as)
http://www.geocities.com/sixurbanninjas/Archive/DarkDirect.zip
Thanks in advance

BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th May 2003 11:00
Haven't looked at the code, but are you SYNCing? Even if you're waiting for something to happen, you must detect this in a loop with a SYNC in it.

Thanks in advance.
All the Best,
StevieVee
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 19th May 2003 18:21
yeah im syncing. what's really weird is that i had it working using a differernt method (arrow keys), then it started messing up and i hadn't even changed any code.
Here is the code, it freezes somewhere in checkxyclick().

Pricey
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 19th May 2003 22:21
it may be your mouse drivers

what type of mouse do you have?

I don't know i can't tell!
I push the button and run like hell!
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 20th May 2003 02:08
USB logitech optical scrollmouse. that shouldnt be the problem as it (this method of find xyClick) has worked before on other projects. someone try it out and lemme know if its just me who gets this temporary freeze. im thinking maybe its a bug that has to do with the way DBC handles the heirarchy of program branches.

freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 20th May 2003 02:34
I'm trying now

you 'd beter the set dir command to specify an absolute path... when you want to install your program in another folder it wont work anymore

you can just remove these two commands and place the source files in the same directory, like in the zip file

yes it freezes here too
and the toolbars are flickering all the time...
and after that the screen's black and the mouse shocks like there should be a very slow sync rate (or very very heavy calculations)

i'll have a look to figure out what's the problem...

in a first look I see that you have used functions everywhere, just as a shortcut to a couple of lines of code... normally they use gosubs instead but that's no problem here, its just a bit strange

somewhere I see this rule:
if mouseclick()=1 then checkxyclick()
in the checkxyclick() function description there's this rule:
c=mouseclick()

it's not really necessary to check this again, coz you're sure that mouseclick is one
anywa on very slow pc's it could be already 0 when it reaches that command so it's not always predictable


the above code shows a very unsafe way to exit a do...loop system
you can just use the exit command to jump out of the loop
I know, it was remmed in your actual code but you might use it later again and such things mostly cause a bug

okay finally I found why it freezes:

somewhere in your checkxyclick() function you have this:


and your program just stays in that loop...

when I remove the do and loop commands your program ends when I click the left mouse button... I suppose you still had to program that?
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 20th May 2003 02:35
ow I'm wrong, it doesn't end the program, it was just a break that was still there for testing purpose

no, it just does nothing when I left-click
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 20th May 2003 02:51
first off, please disregard the source clip above, download the zip and work off that.
here are my explanations....
flickering is due to cls (I was trying to narrow down where EXACTLY it freezes)
continuous loop is just because I wanted to see if it froze before it jumped to changetoolxy:, when it jumped to changetoolxy:, or after it had jumped to changetoolxy:.
try this portion instead:


so now it should get the click value, mousex(), and mousey(). then it checks to see it it is left-clicked on (roughly) the blue area. if so, goto checkclickxy..... rather than do what it is told, BANG!, it freezes. could it possibly be that im jumping to a label within a function, or is that allowed?
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 20th May 2003 03:05
first off, please disregard the source clip above, download the zip and work off that.
I did look at the dba file from the zip and not the added source code.

jumping from within a function declaration to a label is not allowed
you can use a gosub (because then you return and the function is closed)
coz thats the problem: when you jump out of that function the program is still waiting for that endfunction command
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 20th May 2003 07:36
thought so. thanks -end transmission-
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 20th May 2003 08:25
i changed it from a 'goto label' to another function call but it still freezes. i think i'll just make a transparent layer of sprites on top of everything and use collision. if you figure anything out lemme know.
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 20th May 2003 09:53
can you post your actual source code please?
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 20th May 2003 23:59
actually, i figured it out... thanx

"The secret to creativity is knowing how to hide your sources." - Einstein
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 21st May 2003 01:31
okay

[href]www.bernardfrancois.com[/href]

Login to post a reply

Server time is: 2025-05-18 15:31:40
Your offset time is: 2025-05-18 15:31:40