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 / link with mouse

Author
Message
Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 18th Aug 2003 02:35
Im trying to make a link type of page so when the pointer is over the text is changes colors, but i dont want all the text to change colors, just the text that the mouse is pointing over. Heres what ive got so far, but i get nesting error and they all text changes to the color when mouse pointer is over certain text. can anyone help?
thanks.

Do
Text 30,50,"Conversions"
Text 30,70,"Geometry"
If mousex()>30 and Mousex()50 and mousey()30 and Mousex()50 and mousey()30 and mousex()70 and mousey()30 and mousex()70 and mousey()
Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 18th Aug 2003 02:36
sorry heres the whole code.. I dont know how to get it to use the snipet button...

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 18th Aug 2003 03:20
Something like this perhaps:

The programmer formerly known as sonic
Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 18th Aug 2003 04:12
Alright! Thanks.
It seems like with your source code it would go to the link regardless of where the mouse click was. That is why I added one to change colors and another to go to the link if the mouse click was in the sweet spot... Can you explain how yours works?

Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 18th Aug 2003 04:16
Yours works. But how?
thanks.

Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 18th Aug 2003 04:59
oh... i Think i got it. The first If affects everything until it says endif. I was thinking that if the if=0 it moved on to the next command disregarding the first if. SO if you have two ifs both are are still working until it says endif, the first if controls both color, and where the sweet spot is..
So,
if mouseclick()=1 then goto conversions if the mouse pointer is in the sweetzone. Is this how it works? anyone?

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 18th Aug 2003 07:12
Spooky is nesting an If-Then within an if-then, which says look at these position values, IF a condition is met THEN do the following code which happens to be IF some other condition is true THEN do some more other code...understand? It can get crazy but a good rule of thumb is if you find yourself nesting ump-teen levels in you should rethink your code/design because you may be missing a part of the bigger picture.

peace
Rustler

How do ya do there son
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 18th Aug 2003 13:28
I am a programmer at heart and used to multiple nesting if's so looks simple to me, but I do understand your confusion.

I must apologise to using the two different uses of IF in same section. This is bad practice!

Modified code:

The programmer formerly known as sonic
Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 19th Aug 2003 04:08
Thanks CattleRustler and spooky. Im finally moving to a mouse type of control. I was pretty exicited when I was able to use spooky's way of the code to get the links to works. Before I had it where the user typed in the first the letter of the title of the link to get to another screen (,really boring and ugly looking). But no more of that. Im thinkin now I could use what Ive learned to make a Myst style game. Where I could point on a sweet spot and a video sequence would play or when i move the pointer to a sweetspot the pointer would dissapear and a loaded bitmap of hand pointing in the direction I wanted to go would pop up where the mouse pointer was, I would click on it and it load a bitmap showing what would be to the left... Ill probably make it of my house. It will be like a virtual tour of all the rooms, but it would be good practice...

Thaks again.

Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 20th Aug 2003 01:22
Alright. I guess maybe i havnt figured it out quite yet..... y cant i see the image?
I was trying to have a picture of a hand pointing left to pop up when the mouse pointer went to the left of the screen. I was also gonna place the bitmap on the left, but i cant even get the picture to show up with this simple code. Whats the prob?
Thanks.

Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 20th Aug 2003 02:05
For some reason, switching the cls and hide mouse command allowed it to work wierd..?

Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 20th Aug 2003 02:09
Ignore last post, its cause of the assigned number at end of bitmap.
either way works.

Bolt Lightning
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location:
Posted: 20th Aug 2003 03:44
Im trying to create a myst like game, but the little hand pointer are come up slow, because theres too much to do between the do and loop. Can any one help with cleaning up my code?
Thanks

k0shi
21
Years of Service
User Offline
Joined: 30th Dec 2002
Location: Cyberspace
Posted: 20th Aug 2003 04:02 Edited at: 20th Aug 2003 04:12
Ok this should work. No sync command?

Famous last words ...
"Pull the pin and count to what?"
k0shi
21
Years of Service
User Offline
Joined: 30th Dec 2002
Location: Cyberspace
Posted: 20th Aug 2003 04:12
oops, ok here..

Famous last words ...
"Pull the pin and count to what?"

Login to post a reply

Server time is: 2024-09-20 19:48:39
Your offset time is: 2024-09-20 19:48:39