Alright, so I'm using the simple mouse because, frankly, I'm having trouble understanding the GUI aspect and such of the GUIMouse....
But anyway, I have a picture set up on the graphscreen and what I need is that when it clicks the button between the pixels
Code: If Y>57 and 6<X<12
It will do what that button is suppose to do.
I guess what I'm asking for is a way to know where the click takes place and check if it fits between these parameters.
BTW I'm doing this for a contest so please no code posting . I don't want to get disqualified.
I thought you were allowed to get help about the DCS Basic Libs...
At any rate, the coordinates where the mouse clicked (along with the type of click) are returned in a 3-element list in Ans, in the order {X,Y,click}, where click is 1 for left-click, 2 for right-click
Yeah, but I can't find the list.
EDIT: Just realized it, so would it be something like Ans(1), Ans(2), and Ans(3)"
EDIT(2): Tried it out and that works fine. Looks like i really didn't need the help after all
Yeah, most of the routines that return stuff do it in Ans, so you are correct.
The X coordinate is Ans(1), the Y Ans(2), and the click type Ans(3).
Unfortunately, by the nature of Ans, you'll have to store it elsewhere before you can store to other variable, at which point it may be better to just use a list instead of an X and Y variable.
Yeahh, I double checked the DCS SDK site and re-read that after you posted it and decided to check it out. Glad it works
.
What somebody should do is find a way to override the ANS feature and have it stored directly to a variable.
Just do "sum(6,X,Y->C" or whatever you want your list to be called.
More compact than the possible:
Code: sum(6,X,Y,"C
I ended up doing
Code: :sum(6,47,32
:Ans(1)->X
:Ans(2)->Y
oh and btw, is there any way to execute an app from a basic prog?
Svakk wrote:
I ended up doing
Code: :sum(6,47,32
:Ans(1)->X
:Ans(2)->Y
oh and btw, is there any way to execute an app from a basic prog?
No way that I know of, it'd have to be very hackish, not to mention I'm not sure how you'd return to the BASIC program.
(A DoorsCS SE that allows you to run other apps from DCS returns to the homescreen when the secondary app is finished, not DCS.)
Alright. well i finished the program i was working on because of this. I ran it on my calc, and I was given a
Code: [x] Error # 510
BASIC Exec Error
1. Quit
2. Goto error
When I click goto error, it takes me to
the Sum(6,45,32 line.
Any ideas?
"# Error 510: Domain Error [ERR: DOMAIN] "
You've got a domain error... don't know if you can post your code (read: for contest) I'll look at it in a second on my calc
alright i'll go double check.
EDIT: It says I cannot post the code, unless it is DCS specific about problems or bugs. I guess this could be, considering it is about the DCSLib Function... not sure.
try running it a couple of times, I noticed DCS doesn't /always/ go straight to the code that has the problem. Else substitute some different values for the sum(6 code
Alright I'll give it a try.
EDIT:
Thinking about it,
wouldn't Ans(2)->Y
just multiply the ans by two and store it to Y???
EDIT(2):
Yeahh, thats all it did.
I added brackets {} around it, but
that didn't help either. i've run it about 30 times,
with the origional values, changed values,
and second changed values with no luck. I'm wondering
if there might be a problem with the code I have around
it... :/
try this:
sum(6,stuff,here->L1
L1(1)->X
L1(2)->Y
Umm...one thing I wonder, try variables that aren't X and Y, like maybe S and T. The drawing commands do funny stuff to X and Y iirc
Svakk wrote:
I ended up doing
Code: :sum(6,47,32
:Ans(1)->X
:Ans(2)->Y
oh and btw, is there any way to execute an app from a basic prog? This code won't work. When you store Ans(1)->X, then X becomes the new Ans, and that last line is basically just X->Y. Better to use the code Player suggested:
_player1537 wrote:
Code: sum(6,stuff,here->L1
L1(1)->X
L1(2)->Y
Svakk, if you want to PM me your code, I can double-check if the problem is a DCS-triggered Domain error, or something in your other code, in which case I won't tell you exactly what's causing it. I will indeed try to track down the issue with errors not showing up in the right place, though.
KermMartian wrote:
_player1537 wrote:
Code:
sum(6,stuff,here->L1
L1(1)->X
L1(2)->Y
Svakk, if you want to PM me your code, I can double-check if the problem is a DCS-triggered Domain error, or something in your other code, in which case I won't tell you exactly what's causing it. I will indeed try to track down the issue with errors not showing up in the right place, though.
The problem is that I'm trying to have the location of the click stored, and by the looks of this, it looks like all that this will do is store the y value into List 1.
Also, i'll double check and see if I can get this fixed first, then I'll send you the code, that way I can double check and make sure it isn't just what I'm doing that is messing it up.
EDIT: I tried it on the calc, and the error still persisted. Kerm, I'm moving the file over to my computer now, and I'll PM it to you once I get it uploaded to SC.
*facepalm* I forgot something in my code, change X to S, and Y to T, it should work then if its data problems (Y being messed up)
Svakk, I traced down your Domain error. Try the sum(1) thing with a vertical line at the left, right, top, and bottom edges of the screen in Pic 1 instead of whatever Pic 1 you were using, and you'll see the difference. I'm pretty sure the problem was from you trying to draw text offscreen.
Wait a second, now I'm confused. Should I do it with the blank screen or with my current Pic1?
Svakk wrote:
Wait a second, now I'm confused. Should I do it with the blank screen or with my current Pic1?
I tried with a Pic 1 that had Verticals at Xmin and Xmax, and Horizontals at Ymin and Ymax. Maybe send me your Pic1 so I can try it with that?