AutoHotkey Community

It is currently May 27th, 2012, 8:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1913 posts ]  Go to page Previous  1 ... 39, 40, 41, 42, 43, 44, 45 ... 128  Next
Author Message
 Post subject:
PostPosted: December 16th, 2006, 9:49 pm 
Offline

Joined: September 3rd, 2006, 5:34 am
Posts: 601
Location: Iowa, U.S.
Here, it works now:

Code:
sequence = 123
seatswitch = 1

$k::
StringMid tool, sequence, %seatswitch%, 1
Send {f%tool%}
seatswitch++
If (seatswitch > StrLen(sequence))
seatswitch = 1
Return


I remapped k to WheelUp. It is easier to access.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2006, 10:19 pm 
Offline

Joined: August 31st, 2006, 1:37 pm
Posts: 24
Hi Slomz. Thanks for the quick help, but it is not working still. Is this script dependent on ahk version?????


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2006, 10:21 pm 
Offline

Joined: September 3rd, 2006, 5:34 am
Posts: 601
Location: Iowa, U.S.
Well it works for me. Did you dl latest version just in case? Di you try it in an editor?

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2006, 10:47 pm 
Offline

Joined: August 31st, 2006, 1:37 pm
Posts: 24
Hi Slomz. I have just installed the latest version, but still no joy. With the latest ahk I am unable to bring the script out of suspend using this script? Has it changed.......
; Get the process name of the active window (i.e. Notepad.exe)
WinGet, szProcessName, ProcessName, A
if szProcessName = bf2.exe
{
Suspend, off
}
else
{
Suspend, on
}
return

I will check it in the editor to see what is going wrong.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2006, 11:00 pm 
Offline

Joined: August 31st, 2006, 1:37 pm
Posts: 24
I have run it in the editor, and I can't see no errors. Hmmm dunno what I am doing wrong.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2006, 11:07 pm 
Offline

Joined: August 31st, 2006, 1:37 pm
Posts: 24
Ok, the script works fine in windows, but does not work in bf2. Any ideas?
Most script problems in bf2 are down to delay timings, but it should not be the case with this script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: modd'd code
PostPosted: December 17th, 2006, 1:57 am 
Offline

Joined: October 14th, 2006, 8:46 am
Posts: 18
datalore44 wrote:
Ok, the script works fine in windows, but does not work in bf2. Any ideas?
Most script problems in bf2 are down to delay timings, but it should not be the case with this script.


You MUST send the down and the up for the F keys, especially for Battlefield2 and Battlefield2142.

I touched up the code* a little so I can use in bf2142.
*note: substr is available as of 1.0.46 (get most current version)

Code:
;;;;;;
;; position.ahk (bf2142.ahk)
;;;;;;;
;; Press and hold the Caps lock key, then press '1' to cycle through the
;; vehicle seat positions 123456
;;
;; to change the order, simply change the sequence, i.e.  if you want
;; to switch to left gunner or right gunner in the blackhawk, change
;; sequence to 23 and _start_position to 2
;;;;;;

;; begin AUTO-EXECUTE

#NoEnv
SendMode Input
SetCapsLockState, AlwaysOff

_start_position = 1
_sequence = 123456       ;; CHANGE this sequence for vehicles with
                                     ;; fewer/more seats.
;;;;;;
;; timers
;;;;;;

SetTimer,if_not_battlefield_suspend,1000

;;;;;;
;; end AUTO-EXECUTE
;;;;;;
;; hotkeys and remappings
;;;;;;

CapsLock & 1::cycleSeat()

;;;;;;
;; timer target labels
;;;;;;

if_not_battlefield_suspend:
  Suspend permit
  WinGet, this_name, ProcessName, A
  if (this_name = "bf2.exe") or (this_name = "BF2.exe") or (this_name = "BF2142pace.exe") or (this_name = "BF2142.exe")
        Suspend off
  else
        Suspend on
return

;;;;;;
;; function definitions
;;;;;;

cycleSeat()
{
  global _sequence
  global _current_seat

  seat := SubStr(_sequence,_current_seat, 1)

  Send {f%seat% down}
  Sleep 100
  Send {f%seat% up}
 
  _pos++
  if (_current_seat > StrLen(_sequence))
    _current_seat = 1
}

;;;;;;
;; end script
;;;;;


This code was tested in both bf2 and bf2142 and works.


Last edited by carsong on December 18th, 2006, 10:13 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2006, 2:44 am 
Offline

Joined: August 31st, 2006, 1:37 pm
Posts: 24
Thanks for the info Carsong.
I will give it a go later. Do you know how to suspend scripts when you are not in BF2 using the new autohotkey?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2006, 3:31 am 
Offline

Joined: December 11th, 2006, 4:54 pm
Posts: 5
carsong//
Thanks for the help :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2006, 8:08 pm 
Offline

Joined: August 31st, 2006, 1:37 pm
Posts: 24
Carsong, the script worked a treat. Thanks.
Now please can anyone tell me how to suspend a bf2 script automatically. It used to be this.
; Get the process name of the active window (i.e. Notepad.exe)
WinGet, szProcessName, ProcessName, A
if szProcessName = bf2.exe
{
Suspend, off
}
else
{
Suspend, on
}
return

But since I have installed the latest AHK, it will not come out of suspend.
Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2006, 8:39 pm 
Code:
#NoEnv
SendMode Input

_auto := true

~LButton::autofire()
+LButton::_auto := ! _auto
+RButton::ExitApp

autofire()
{
  global _auto
  if _auto
  {
    Loop
    {
      if GetKeyState("LButton", "P")
      {
        SendInput {LButton DownTemp}
        Sleep 85
        mouseXY(0, 6)
        SendInput {LButton Up}
        Sleep 45
      }
      else
        break
    } ;; loop
  } ;; if
} ;; autofire()

mouseXY(x,y)
{
    DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0)
}



For m16/ak i think the recoilfix is different, someone any clue ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2006, 7:26 am 
here is a video of the guys im talking about
www.nxt-level.com/reaching_the_next_level.rar


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2006, 10:17 am 
Offline

Joined: October 14th, 2006, 8:46 am
Posts: 18
datalore44 wrote:
Carsong, the script worked a treat. Thanks.
Now please can anyone tell me how to suspend a bf2 script automatically. It used to be this.
; Get the process name of the active window (i.e. Notepad.exe)
WinGet, szProcessName, ProcessName, A
if szProcessName = bf2.exe
{
Suspend, off
}
else
{
Suspend, on
}
return

But since I have installed the latest AHK, it will not come out of suspend.
Thanks.


You're missing the Suspend permit

See below

Code:
;; autoexecute section (top of script)

SetTimer,check_if_bf2,1000  ;; this goes in auto execute section

;; labels and targets (after all hotkey and remappings)

check_if_bf2:
  Suspend permit
  WinGet, this_name, ProcessName, A
  if (this_name = "bf2.exe") or (this_name = "BF2.exe")
        Suspend off
  else
        Suspend on
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: ?
PostPosted: December 18th, 2006, 2:17 pm 
How can i use this macros????


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2006, 3:52 pm 
Quote:
How can i use this macros????
Slowly????


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1913 posts ]  Go to page Previous  1 ... 39, 40, 41, 42, 43, 44, 45 ... 128  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group