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 / Click-able Link Mouse Image?

Author
Message
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 26th May 2011 02:15
The mouse change command is good but any time I go past 2 in mouse change it shows NOTHING... Could someone please tell me what number is the click-able link mouse? Thanks.


Cheers.

God help me, Please.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th May 2011 05:04 Edited at: 26th May 2011 17:25
It's because it expects you to add your own mouse cursors from 2 to 31.

0 = The Arrow
1 = Animated Hourglass
2 - 31 = Cursors you add to the project media
32 = No cursor

The first cursor you add to your project will be #2, the next #3 and so on.

Attached is a zip with the following code and some cursors.


2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 26th May 2011 15:25 Edited at: 26th May 2011 15:42
@Grog Grueslayer

Thanks for the help. Just asking but, what is the point of the command: "if timer()>tim+200" ?


Cheers.

God help me, Please.
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 26th May 2011 15:57
Wait! I am not sute how to set the cursors up an the numbers...

God help me, Please.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th May 2011 17:39 Edited at: 26th May 2011 17:42
It's a delay in time. The TIMER() command is always going up from the minute you turn on your computer. With TIMER() 1000 = 1 second. The line "tim=timer()" sets the variable "tim" to equal whatever the number is in TIMER() and "if timer()>tim+200" checks if the current value that's in TIMER() is more than the old value of TIMER() stored in "tim+200". So the delay is only 200 milliseconds (if it was "tim+1000" it would be a full second delay). Without the timer pressing the up arrow once would go through all the cursors and stop at 8 almost instantly.

I just noticed it depends on the IDE you use. If you're using the newest IDE you won't be able to use any .ani files (animated cursors) but you can use .bmp files (how odd). On the lower left of the IDE you'll see several tabs. The 3rd one down is the cursors tab (a picture of a cursor). Hit that and click on the folder picture at the top of the tab to add cursors to the project (see attached picture).

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 27th May 2011 15:37
@Grog Grueslayer
Thanks for the help! I just want to kow what is wrong with this line of code now:



The mouse changes, but doesn't change back... Any ideas why? Thanks.

Note: I've tried positioning the "else" command in various locations and none of them work.


Cheers.

God help me, Please.
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 27th May 2011 17:56 Edited at: 27th May 2011 17:57
I'm not sure you can use the then command and the else command in the same if statement.



Would be a better way of writing it.

>edit<

I just noticed you have 2 similar variable names, mouCur and MouseCur? Is this intentional?

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 27th May 2011 18:08
Quote: "I just noticed you have 2 similar variable names, mouCur and MouseCur? Is this intentional?"


You just found why it wasn't working for him.

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 27th May 2011 20:07
@=PRoF=
Thanks!


Cheers.

God help me, Please.
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 28th May 2011 01:01 Edited at: 28th May 2011 01:02
Sorry to keep asking but now that I have multiple click-able buttons on screen I'm having trouble making them all change and change back. Here is the code:



Any ideas how to do this? Thanks.


Cheers.

P.S.
Sorry for asking so much, and thanks for helping me out.

God help me, Please.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th May 2011 03:50 Edited at: 28th May 2011 03:59
Well for starters it's better move the mouse coordinates check around to the way a normal box is since you're basically looking at an imaginary box. The way the BOX command goes is x1,y1,x2,y2 so switch the x1,x2,y1,y2 around to mimic a BOX. Generally you use the smaller numbers first for x1 and y1 (upper left corner) then the larger for x2 and y2 (lower right corner).

You've got some ORs in there instead of ANDs which will mess it up a bit. You only want to use OR if you're separating sets of conditionals in the same IF statement... not good if you're checking if the mouse is within an area.

When you want something to be defaulted to zero (like the mouse cursor) it's best to do this:

1. Force the mouse cursor to be zero
2. Go through the checks that may or may not change the mouse cursor
3. Check if the mouse cursor changed by comparing the old mouse cursor and change the mouse cursor and keep the mouse cursor in a temporary variable



Don't worry about asking a lot of questions. We're all here to help you.

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 28th May 2011 05:58
@Grog Grueslayer
I know that this works but I don't understand how... I mean when I see:



How does thAT EVEN WORK? If OldMouse=MouCur then they can never be different, right?


Cheers.

God help me, Please.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th May 2011 08:28 Edited at: 28th May 2011 08:30
Here MouCur is forced to be zero:




Here the MouCur can change:



So when it reaches the part you copied MouCur could be 0, 1, 2, 3, or 4. When it changes is when OldMouse=MouCur but MouCur can change at any time through those IF/THEN checks. Like if you're within the area that makes MouCur=2 if you're still in the same area on the next loop it won't try to change the mouse cursor because OldMouse=2 also... move away from it and MouCur=0 then it'll change because OldMouse=2 still. It'll then stay the same until MouCur equals anything but zero.

I hope that clears it up for you. If not I'll try to explain better next time.

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 28th May 2011 15:50
OH! I understand it now. Since the Mouse=0 is IN the do loop it changes back! If it wasn't in it it just wouldn't work.

About this part:



I never knew that an if statement could be within an if statement. I'm learning everyday!


Cheers.

God help me, Please.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th May 2011 18:03 Edited at: 28th May 2011 18:04
Quote: "If it wasn't in it it just wouldn't work."


Yeah it would never be zero since it doesn't change MouCur to zero anywhere else in code.

Quote: "I never knew that an if statement could be within an if statement. "


You can have as many IFs "nested" inside each other as you need as long as you close each one with an ENDIF (or use the standard IF/THEN kind without an ENDIF). If you fail to close all IF statements you'll get a nesting error.

Quote: "I'm learning everyday! "


That's great!

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 30th May 2011 00:19 Edited at: 30th May 2011 00:31
Um, well I have a HUGE if statement that was working fine before but now it isn't...
Here it is:



Does anyone see anything wrong with this piece of code? It would keep highlighting this part:


so I changed it to this:



then it highlighted this part:


NOTE: This is a rem so how is that even possible?

Thanks for helping!


Cheers.

God help me, Please.
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 30th May 2011 03:40
Anybody?

God help me, Please.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th May 2011 06:37
Patience.

Is there more code? The only errors I see is that the labels BeginSection and OptionsSection don't exist.

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 30th May 2011 07:19
Yes, there is more... a lot more if you want I can send it to you. Oh and the sections are there.


Cheers.

God help me, Please.

Come on down to my site [href]http://unleashfps.webs.com/]Unleashed FPSCreators[/href]
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th May 2011 18:54
Yeah send it to me (and the media). I just noticed that you have a typo in that one too. You have it going to two different labels OptionSection and OptionsSection <-(with an S in the middle).

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 30th May 2011 19:00
Thank You for pointing that out. I changed it and it worked! I don't know why it highlighted other things though... Anyway, thanks!


Cheers.

God help me, Please.

Come on down to my site [href]http://unleashfps.webs.com/]Unleashed FPSCreators[/href]
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th May 2011 20:51
Generally when it says "this line is the problem" and the line it points out looks fine the problem is somewhere above that line. It's the nature of the beast.

Login to post a reply

Server time is: 2026-07-10 21:42:13
Your offset time is: 2026-07-10 21:42:13