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 / Mouse Problems... errrr

Author
Message
Philip 1337
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 5th Apr 2003 16:15
The following code seems to not work on my PC
}:>

Could anyone tell me if I am doing it wrong

Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 5th Apr 2003 16:17
hi m8
log onto chat

I have a word of advice...
..don't piss on an electric fence!
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 5th Apr 2003 16:18
oh i know!

Set Cursor 0,0
Do
Mx#=MouseX()
My#=MouseY()
Print "Mouse Position X=",Mx#
Print "Mouse Position Y=",My#
Loop

you have a semi colon instead of a comma!

I have a word of advice...
..don't piss on an electric fence!
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 5th Apr 2003 16:27
hope that helps mate cus i tried yours and it didnt work then i replaced the ; with a , and it worked fine.

I have a word of advice...
..don't piss on an electric fence!
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 5th Apr 2003 16:29
you could also make it a bit more direct by saying oh and your set cursor 0,0 should go in the loop!

Do
set cursor 0,0
Print "Mouse Position X=",Mousex()
Print "Mouse Position Y=",Mousey()
Loop

I have a word of advice...
..don't piss on an electric fence!
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 5th Apr 2003 18:25
@Frobscottle,

I think that the idea is to use the mx# and my# values elsewhere rather than calling MouseX() every time it is needed (as that is not very efficient).

Same applies to Set Cursor 0,0

@darkfox

Remember that the ";" character effectively means "new line".

So if you type:

print "MouseX";mx#

DBPro sees:

print "MouseX"
mx#

Current Project: Retro Compo. Entry.
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 5th Apr 2003 18:46
it depends on how often you are planning to ask for the co-ordinates of the mouse. if your only going to do it once then there is no point in setting up variables

I have a word of advice...
..don't piss on an electric fence!
Khumba
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 5th Apr 2003 23:00
Or:

...
Cls
Print "Mouse Position X=";Mx#
Print "Mouse Position Y=";My#
...
DangYankee
23
Years of Service
User Offline
Joined: 19th Feb 2003
Location: United States
Posted: 6th Apr 2003 00:03 Edited at: 6th Apr 2003 00:09
darkfox--I don't know what they are talking about , it works fine on my machine.

the ; in basic it does not mean new line just "print next to me" as it did on my computer , for me.

It's not the size of your code but how efficiently you use it!
Xoid
23
Years of Service
User Offline
Joined: 8th Mar 2003
Location:
Posted: 6th Apr 2003 00:10 Edited at: 6th Apr 2003 00:12
Your correct DangYankee,

print "HELLO";
print "HELLO"

Output:

HELLOHELLO

; effectively means 'leave cursor at end of line'

I don't know where they got that info from? :S

Do not anticipate the outcome of the engagement, let nature take it's course, and your tools will strike at the right moment - from "Tao of Jeet Kune Do" by Bruce Lee
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 6th Apr 2003 01:40 Edited at: 6th Apr 2003 01:43
they!!!!!

im not sure about what rob k said but im pretty sure of what i said.
it doesnt tell you the mouse co-ordinates if you have a ;
it does tell you the mouse co-ordinates if you have a ,

PLAIN AND SIMPLE TRIED AND TESTED

;DONT WORK
,DOES WORK

[img]:d:d:d:d:d:d[/img]

(i am not shouting, just making a point)

I have a word of advice...
..don't piss on an electric fence!
DangYankee
23
Years of Service
User Offline
Joined: 19th Feb 2003
Location: United States
Posted: 6th Apr 2003 01:49 Edited at: 6th Apr 2003 01:51
I didn't see your post I was testing the program by the time I acually posted and refreashed, there you were. Gee I wasn't picking on anyone.
PS It ran fine unmodified for me....
but I did think of one more point to make the program ran fine as written, DF may have wanted the x,y,coordinate in the upper left hand corner I don't know DF didn't say.

It's not the size of your code but how efficiently you use it!
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 6th Apr 2003 01:56
dont worry i know him!
he just got confused between ; and ,!

I have a word of advice...
..don't piss on an electric fence!
DangYankee
23
Years of Service
User Offline
Joined: 19th Feb 2003
Location: United States
Posted: 6th Apr 2003 09:13
DarkFox, Did we answer the question?

It's not the size of your code but how efficiently you use it!
Xoid
23
Years of Service
User Offline
Joined: 8th Mar 2003
Location:
Posted: 6th Apr 2003 20:59
oh sorry, I meant HE (as in Rob K), NOT THEY

Do not anticipate the outcome of the engagement, let nature take it's course, and your tools will strike at the right moment - from "Tao of Jeet Kune Do" by Bruce Lee
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 7th Apr 2003 19:40
its ok people i spoke to him and he now officialy feels like a plonker

I have a word of advice...
..don't piss on an electric fence!
Philip 1337
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 7th Apr 2003 20:49
HEY!
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 8th Apr 2003 18:55
lol (well you looked like you did) [img][/img]

I have a word of advice...
..don't piss on an electric fence!

Login to post a reply

Server time is: 2026-07-10 19:48:08
Your offset time is: 2026-07-10 19:48:08