SHIFT key stuck, release?
SHIFT key stuck, release?
There is a point in my script where it opens a mail box with a mouse click. I have my own harvest function that, if it fails, turns 90 degrees and tries again. It repeats this until successful.
The PC is unattended. Sometimes when I check on it, I find it continuously scanning for the mail box but not turning. When I opened a file and click in it, it selects text as if shift is being pressed. If I tap shift it releases and the bot then turns between scans. I have noticed it hasn't opened the giftbags either so suspect maybe it is causing the bags not to open as well.
I suspect the shift is being locked when changing characters.
Is there a way to fix this or at least a command to release the shift key?
The PC is unattended. Sometimes when I check on it, I find it continuously scanning for the mail box but not turning. When I opened a file and click in it, it selects text as if shift is being pressed. If I tap shift it releases and the bot then turns between scans. I have noticed it hasn't opened the giftbags either so suspect maybe it is causing the bags not to open as well.
I suspect the shift is being locked when changing characters.
Is there a way to fix this or at least a command to release the shift key?
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Administrator
- Site Admin
- Posts: 5344
- Joined: Sat Jan 05, 2008 4:21 pm
Re: SHIFT key stuck, release?
I guess you could manually press (not just release, as this sometimes doesn't work as you'd expect) any problematic keys.
I'm not entirely sure this is a problem with MicroMacro or the bot, though. I've noticed on several occasions that keys such as CTRL, SHIFT, or ALT get stuck and stay stuck until i physically press that key. This happens even when MicroMacro is not open.
Code: Select all
keyboardPress(key.VK_SHIFT);
Re: SHIFT key stuck, release?
The thing is I'm not even touching the computer. Anyway, I'll try the above.Administrator wrote:I guess you could manually press (not just release, as this sometimes doesn't work as you'd expect) any problematic keys.I'm not entirely sure this is a problem with MicroMacro or the bot, though. I've noticed on several occasions that keys such as CTRL, SHIFT, or ALT get stuck and stay stuck until i physically press that key. This happens even when MicroMacro is not open.Code: Select all
keyboardPress(key.VK_SHIFT);
Regardless of the cause, I'm fairly certain the shift key interfered with turning. I'm not so sure if it's the cause of the bags not opening. Do you know if the shift key would cause problems with opening bags?
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Administrator
- Site Admin
- Posts: 5344
- Joined: Sat Jan 05, 2008 4:21 pm
Re: SHIFT key stuck, release?
Could be. It could cause any number of strange occurrences. Have you checked the hotkeys for opening or closing bags?
Re: SHIFT key stuck, release?
Sorry I meant the giftbags.Administrator wrote:Could be. It could cause any number of strange occurrences. Have you checked the hotkeys for opening or closing bags?
Anyway, since I added a manual opening of the first gift bag in the first script, I haven't had any trouble with that.
With the mailbox, I tried the command above. I inserted it after every scan but it still doesn't turn. I still discover it scanning but not turning. I found, though, that I don't have to tap shift to release it. All I have to do is pause with the END key then continue with the DELETE key. It then immediately turns and scans until it finds the mail box.
Maybe I should try player:faceDirection(dir). Maybe that will be more reliable.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Administrator
- Site Admin
- Posts: 5344
- Joined: Sat Jan 05, 2008 4:21 pm
Re: SHIFT key stuck, release?
When pausing the script, it is using a callback which is releasing the SHIFT key (among others). It's pretty much the same thing.
Re: SHIFT key stuck, release?
I've discovered, even with simple small tests, that player:turnDirection() and player:faceDirection() don't work. It just twitches and doesn't turn.
While looking at player:faceDirection I got the idea to try camera:setRotation(). This works perfectly and I find it a lot more reliable. Also it doesn't turn physically while scanning, which looks less bottish.
So I have a suggestion for player:target_NPC(). Can you change the turning behavior so that it only turns the camera view?
The benefits are;
1. More reliable.
2. Less bottish.
3. I suspect it might fix the problem of not turning when trying to target an npc while mounted.
While looking at player:faceDirection I got the idea to try camera:setRotation(). This works perfectly and I find it a lot more reliable. Also it doesn't turn physically while scanning, which looks less bottish.
So I have a suggestion for player:target_NPC(). Can you change the turning behavior so that it only turns the camera view?
The benefits are;
1. More reliable.
2. Less bottish.
3. I suspect it might fix the problem of not turning when trying to target an npc while mounted.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Administrator
- Site Admin
- Posts: 5344
- Joined: Sat Jan 05, 2008 4:21 pm
Re: SHIFT key stuck, release?
Are you saying you tested using camera:setRotation() in CPlayer:target_NPC(), or that you used camera:setRotation() inside CPlayer:setDirection()? Does it work OK if you have QUICK_TURN enabled? Does it break gathering?
Re: SHIFT key stuck, release?
I don't like to modify the original functions.Administrator wrote:Are you saying you tested using camera:setRotation() in CPlayer:target_NPC(), or that you used camera:setRotation() inside CPlayer:setDirection()? Does it work OK if you have QUICK_TURN enabled? Does it break gathering?
What I did is create a function like this. It makes 100% sure that it opens the frame, be it a mailbox, or bulletin board or speakframe.
Code: Select all
function SureHarvest(_objID, _frameName)
sendMacro("CloseAllWindows()")
local ang = 0 -- Start angle
repeat
player:harvest(_objID,true) -- scan for object
camera:setRotation(ang)
ang = ang +1.57 yrest(1000) -- 90 degree turn
until RoMScript("_G['".._frameName.."']:IsVisible()")
yrest(2000)
return true
endI'm not asking you to change Harvest as it is fine the way it is. Rotating while harvesting would be impractical. All I'm suggesting is changing the turning method for target_NPC to camera:setRotation as you don't need to physically turn to target an NPC and you get the benefits stated in my previous post.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: SHIFT key stuck, release?
Ok, I did the test for you. In the target_NPC function I changed the self:turnDirections with camera:faceDirection.
I changed this;to this;
I also initialized scanDirection near the other 2 variable initializations;
It works perfectly. It even works when mounted. QUICK_TURN has no effect on it and it looks less like a bot.
I highly recommend you use this.
I changed this;
Code: Select all
if( counter == 2 ) then
self:turnDirection(-45);
elseif( counter == 3 ) then
self:turnDirection(90);
elseif( counter > 3 and counter < 9) then
self:turnDirection(45);
elseif( counter > 8 ) then
break;
endCode: Select all
if( counter == 2 ) then
scanDirection=scanDirection - math.pi/4
elseif( counter == 3 ) then
scanDirection=scanDirection + math.pi/2
elseif( counter > 3 and counter < 9) then
scanDirection=scanDirection + math.pi/4
elseif( counter > 8 ) then
break;
end
camera:setRotation(scanDirection)Code: Select all
local found_npc = false;
local counter = 0;
local scanDirection = self.DirectionI highly recommend you use this.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Administrator
- Site Admin
- Posts: 5344
- Joined: Sat Jan 05, 2008 4:21 pm
Re: SHIFT key stuck, release?
Alright, thanks. It's been committed.