-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cursor movement API #6162
Add cursor movement API #6162
Conversation
ip.mi.time = 0; | ||
|
||
int x, y; | ||
if (strncmp(function, "x", 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the advanced ballistics extension like format x:y
so you can just send both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe just use callExtensionArgs
.
|
||
// "bluefcs" callExtension "x100"; "bluefcs" callExtension "y-100" | ||
// Yes, they're backwards. No, I can't fix it because I don't know how to DLL. -Luke | ||
call compile format ['"ace_cursor_movement" callExtension "y%1"',_x]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call compile format? really?
"ace_cursor_movement" callExtension format ["%1:%2",_x,_y]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
April, April. Yes, really.
I do stuff the way I know how that it works. If there's a better way, tell instead of condescending for not knowing the better way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's a better way, tell instead of condescending for not knowing the better way.
Uhm...
"ace_cursor_movement" callExtension format ["%1:%2",_x,_y]
And my other comment about the format in the extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't write the extension. I don't know how to .DLL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And? Does that mean problems in your PR don't need to be fixed and can just be ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no protection to make sure that someone can't just move your cursor on your Desktop. At minimum this should check if Arma is in foreground and currently has focus.
@@ -0,0 +1,30 @@ | |||
/* | |||
* Author: LorenLuke (function), BaerMitUmlaut (Extension) | |||
* Simulates mouse input by number of pixels (not consistent/smooth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional animated movement? linear or even specific curves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rotating a foot-mobile is all in one go, but vehicles had some sort of acceleration and cap on how fast you can traverse, meaning it has to be inputting for more than one frame to do much of anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a foot-mobile
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A person. Don't you play proper Arma, that's standard callout. :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intended this to mean adding animation handled in a second thread.
Which also solves:
meaning it has to be inputting for more than one frame to do much of anything.
Because you just tell it "Move that much over that much time"
Second thread also needs the "Arma in focus" check so we can't accidentally move the mouse outside of Arma. And it needs a limit. Bad guy could just launch a 10 hour animation...
IMO this feature could use Intercept. Intercept_CBA already has "Arma in focus" checks for the keybinding stuff. It could internally take care of dialog-open check and others. Instead of basing them on scripts which a bad-guy could just ignore by using callExtension
directly.
ip.mi.dy = atoi(&function[1]); | ||
ip.mi.dx = 0; | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All other extensions use } else {
.
else
on same line.
return; | ||
} | ||
|
||
SendInput(1, &ip, sizeof(INPUT)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it also return "error" if SendInput fails?
Could also call this Would also be nice to get Also
Makes it even more imprecise. I guess baer want's this for the flashbang stuff? It would break if the player happens to be in whatever state where his mouse doesn't control camera movement. Yeees. I know I should've done one review with comments inside it instead of seperate comments. I always make that mistake 🗡️ EDIT: To the flashbang stuff. What I quoted above also means the flashbang effect is different depending on the Players mouse acceleration setting in Windows. |
/* | ||
* Author: LorenLuke (function), BaerMitUmlaut (Extension) | ||
* Simulates mouse input by number of pixels (not consistent/smooth) | ||
* Note- using with open dialogs may cause issues when in loops. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of issues? Moving out of game window?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And pinning your cursor to the corner of the desktop/monitor like it's a professional wrestler waiting for a three-count.
ip.mi.dx = atoi(&function[1]); | ||
ip.mi.dy = 0; | ||
} | ||
else if (strncmp(function, "y", 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strncmp for just one character is a little overkill..
function[0] == 'y'
https://github.com/LorenLuke/ACE3/blob/191f8cf0534f8608749c2e9ce58980ea1a019009/addons/common/functions/fnc_moveCursor.sqf#L2 The second half of both those lines are probably the best response I can give to like, 90% of your review. |
The intended use is to call it within a PFH. Check that the game isn't paused and a dialogue isn't open, then use a constant angle check in to tandem with a PID controller to direct a correspondence towards an orientation. |
Ehhh.... What? |
what's the purpose after merge? just wondering |
Should have been 'in tandem with'. Also not proofread semi-pseudocode, because I'm on my phone.
and just check angles between it and a desired aimpoint from there and feed them into the unit variable. @Cuel I recall in the slack regarding #6034 that someone said they wouldn't mind if a vertical component could be added somehow. This could do just that. However original plans were for this to be used with a to-be-written Shtora defensive system framework, one of the components of which involves rotating the entire turret automatically to face an incoming rocket. With an AI or even nobody in the turret, that's doable; with a player in this, less so. Additional capabilities of this can include laying off some automatic artillery pieces and the creation of auto-tracking, radar-guided guns like the Shilka would be. |
Hunter-Killer for tanks. |
Some time ago I was thinking about systems like Shilka: maybe it could be done with temporary moving player from main gunner to some other vehicle seat and creating UAV-like AI at gunner seat. AI could be ordered not fire till player orders. |
State? |
See all comments. Currently Stale it seems because author is unable to change stuff on the extension. |
I think we should wait until we have an actual use for this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- only one extension call should be used to change both X (0=left) and Y (0=top) (callExtensionArgs)
- absolute change, pixels are useless
- syntax for "move by X,Y from where you are now" and "move to X,Y regardless of where you are now"
Someone please explain to me why Windows has X as the ordinate. I am used to it being inverted by Arma too, but this just baffles me.
Ref.: https://community.bistudio.com/wiki/getMousePosition
For dialogs this function should probably just fall back to: https://community.bistudio.com/wiki/setMousePosition
I want this for Hunter-Killer :~)
@dedmen @PabstMirror |
When merged this pull request will:
Notes:
Be sure to have safeguards in place before using in loops.