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 / simple rollover help

Author
Message
Dsarchy
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: UK- Kent
Posted: 15th Mar 2005 03:42
i found my copy of darkbasic pro and installed it and once again trying to grasp the basics here is a simple piece of code, a simple menu rollover.


as you can see very crude but it does work, so i tried to take it a lil further:



now its a bit tidier and it still works, now here is my problem, im trying to convert it to a function, here is what i have:



as you can see the code, no longer works, if anyone can help thanks to them in advance, Dan Smith

[IMG] http://www.sharksoftdbspot.com/Ban.gif[/IMG]
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 15th Mar 2005 03:59
your problem is that xpos and ypos in the function will always be 0. This is because you did not define them as global so they do not get passed to the function. to define something as 'global' just type global before declaring the variable at the top of your code like this:



Also, I have edited your code slightly so it runs faster, you should be able to understand what I have done. Hope this helps.

Part of solving the problem is actually noticing that the problem is there in the first place

Dsarchy
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: UK- Kent
Posted: 15th Mar 2005 04:07
ow i see, thanks alot and really helps to have that explained aswell, i see instead of checking for each coord it just assigns a range, thanks again for your help something to take away and have a play with, Dan

[IMG] http://www.sharksoftdbspot.com/Ban.gif[/IMG]
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 16th Mar 2005 04:29
anything to help a fellow kent person.

p.s. change your sig to lowercase, cos then it will work.

Part of solving the problem is actually noticing that the problem is there in the first place

Login to post a reply

Server time is: 2024-11-13 19:58:01
Your offset time is: 2024-11-13 19:58:01