• Home
  • Index
  • Search
  • Download
  • Server Rules
  • House Roleplay Laws
  • Player Utilities
  • Player Help
  • Forum Utilities
  • Returning Player?
  • Toggle Sidebar
Interactive Nav-Map
Tutorials
New Wiki
ID reference
Restart reference
Players Online
Player Activity
Faction Activity
Player Base Status
Discord Help Channel
DarkStat
Server public configs
POB Administration
Missing Powerplant
Stuck in Connecticut
Account Banned
Lost Ship/Account
POB Restoration
Disconnected
Member List
Forum Stats
Show Team
View New Posts
View Today's Posts
Calendar
Help
Archive Mode




Hi there Guest,  
Existing user?   Sign in    Create account
Login
Username:
Password: Lost Password?
 
  Discovery Gaming Community The Community Real Life Discussion Software & Hardware
« Previous 1 … 7 8 9 10 11 … 91 Next »
AutoHotKey question (Non-Freelancer related)

Server Time (24h)

Players Online

Active Events - Scoreboard

Latest activity

AutoHotKey question (Non-Freelancer related)
Offline Trogdor
07-03-2014, 08:08 AM,
#1
Member
Posts: 1,236
Threads: 64
Joined: Feb 2009

Hi,

I was told in the Disco help channel that discussing AHK is OK as long as it does not pertain to Freelancer.

So I just got Deus Ex: Human Revolution Director's Cut. It's a first person shooter where you can aim down weapon sights (ADS). However, the ADS is a toggle, instead of a hold. I want it to be a hold.

I had this same issue with Bioshock Infinite, and I was able to fix it with a simple AutoHotkey script that was basically

Code:
#IfWinActive Bioshock Infinite
$RButton::Send {Rbutton}
$RButton Up::Send {Rbutton}

However, Deus Ex is being a jerk. I keep getting 'stuck' in ADS, and when that happens, my script is then fighting me, with the Rbutton Up call putting me back into ADS after I try to click out of it.

I figured, okay, there must be a time delay for ADS in this game, wherein after you click to go into ADS, any further clicks are ignored until the animation is completed.

And so I set about making my script more complicated, to handle this time-delay.

Code:
#Include Timer.ahk

#IfWinActive Deus Ex: Human Revolution
$RButton::Send {Rbutton}

$RButton Up::
Timer("ADS",500)

if Timer("ADS")
{
Send {Rbutton}
}
Else
{
Sleep Timer("ADS","L")
Send {Rbutton}
Timer("ADS","U")
}
return

I'm using this guy's timer code.

What should happen, is that when the script sees Rbutton Up:: , it checks Timer("ADS"), which returns true or false depending on whether the timer's period is expired. If true, it should immediately Send {Rbutton}. If false, it should get the remaining time Timer("ADS","L") and sleep for that duration, and then Send Rbutton.

..And it works... sometimes. I can confirm that it does sometimes do what it's supposed to, because to test it, I set the duration to like 4 seconds, and sure enough, after I clicked into ADS and took my hand off the mouse, it would exit ADS 4 seconds later.

But it's like the game is sometimes ignoring my clicks, because I'm still sometimes getting stuck in ADS. Sometimes it enters when I click but doesn't leave, like the game ignored the second Rbutton from the script. Other times, it ignores the first click, and enters ADS when it sees the Rbutton Up. It's, like, 50/50 that it'll either work like it's supposed to, or get stuck.

Any suggestions?

At this point, I'm suspecting that it's a problem with the game.

[Image: i4h0ll.gif]
[Image: zonerzonerzoner.gif]
Reply  
Offline Zen_Mechanics
07-22-2014, 10:48 AM,
#2
Member
Posts: 2,262
Threads: 196
Joined: Oct 2012

I have no doubt, or I'd say I'm almost completely convinced its not the game 's issue. Alot of keyboards can't proccess multiple key-selections and alot of them also dont function well when a number of keys are being pressed at the same time.

Were fools to make war on our brothers in arms.

Reply  
Offline utrack
07-22-2014, 12:36 PM,
#3
Member
Posts: 368
Threads: 16
Joined: Jan 2013

Shouldn't you send Rbutton and Rbutton::up as well on Rbutton down?

[11:20:20] aerelm: its not fl dev work if you dont have to power through the whole thing on your own
[11:20:32] aerelm: help is for pussy devs like in dota
topic Discovery Server Watcher | FL Open Server | Account Manager G2 topic
something something zoners
  Reply  
Offline Trogdor
07-22-2014, 09:06 PM,
#4
Member
Posts: 1,236
Threads: 64
Joined: Feb 2009

@Zen, like I said, I didn't have this problem using AHK to perform the same job with Bioshock Infinite. It would get stuck like this once in a while, yeah, but it was very playable. In Deus EX:HR, it's getting 'stuck' about 75% of the time.

@utrack I tried it that way and it didn't make any difference.

When I'm not running AHK, the issue with it 'ignoring clicks' goes away. I've been getting used to having my ADS be a toggle instead of a hold... I guess. But it's consistent, and therefore better than dealing with the derpiness that AHK brings to this game. -_-

[Image: i4h0ll.gif]
[Image: zonerzonerzoner.gif]
Reply  
Offline Syrus
08-01-2014, 02:17 PM, (This post was last modified: 08-01-2014, 02:35 PM by Syrus.)
#5
Member
Posts: 1,583
Threads: 86
Joined: Mar 2010

Have you tried using a simple while-loop?
Code:
*$RButton::
    Click Down R
    Sleep, 50
    Click Up R

    While GetKeyState("RButton","P")
    {
        Sleep, 10
    }

    Click Down R
    Sleep, 50
    Click Up R
Return
(The * is to have it activate even when you hit a modifier, not 100% sure if necessary.)

It worked 95% of the time in BF4: only time's it didn't work when tested was when tapping the RButton only very shortly. It might be though that BF4 can't handle RDS on and off that quickly following each other, or the 50ms+10ms in the loop is a bit too long. You could try if it works with <50ms Sleep between down and up. I know that BF4 (and especially 3) are both horrible when it comes to registering very short button-taps...Before anyone complains: I only use it for spotting, which I could put on my mousewheel because I don't use it to scroll through weapons.

Why "Sleep" between the "Click" commands?
I noticed quite a few times that programs don't register mouseclicks/buttonpresses if you don't give them enough time between a "button down" and "button up" (or just use a "Send[Input]").
The sleep in the loop is just to have it do something in the loop, not sure how much processor it otherwise takes up, if it works I suggest keeping it at 10ms (or higher), if you have problems, try setting it lower (1ms). Haven't tried how it works if there's no sleep in there, but I could imagine it might cause problems.

(I never worked with timer's myself...and I have quite an old version of AHK anyway, as I just noticed. Should still work I think.)

[Image: 7tAtSZe.png]
Reply  


  • View a Printable Version
  • Subscribe to this thread


Users browsing this thread:
1 Guest(s)



Powered By MyBB, © 2002-2025 MyBB Group. Theme © 2014 iAndrew & DiscoveryGC
  • Contact Us
  •  Lite mode
Linear Mode
Threaded Mode