muchas gracias

Esta sección es para preguntas sobre programación/scripting usando AutoHotkey.
Thorx
Posts: 36
Joined: 23 Nov 2015, 18:53

muchas gracias

26 Nov 2015, 09:10

muchas gracias
Last edited by Thorx on 14 Aug 2016, 22:18, edited 1 time in total.
User avatar
Flipeador
Posts: 1019
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: COMBINAR 2 SCRIPTS EN UNO SOLO

26 Nov 2015, 09:33

Hola Thorx,
¿Puedes poner ambos scripts?
--------------------------------------------
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
Thorx
Posts: 36
Joined: 23 Nov 2015, 18:53

Re: COMBINAR 2 SCRIPTS EN UNO SOLO

26 Nov 2015, 13:05

Hola gracias
Last edited by Thorx on 27 Nov 2015, 09:09, edited 1 time in total.
User avatar
Flipeador
Posts: 1019
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: COMBINAR 2 SCRIPTS EN UNO SOLO

27 Nov 2015, 04:23

No se bien cual es la funcion de los scripts , pero acá los tienes unidos (sin probar):
F1 = activar/desactivar no-recoil
F2 = activar/desactivar crosshair
F11 = salir
F12 = recargar

Code: Select all

#NoEnv
#SingleInstance, Force
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, ToolTip, Screen 

Hotkey, ~LButton, Auto_Fire, Off

Hotkey, PGDN, _PGDN, Off
Hotkey, HOME, _HOME, Off
Hotkey, ^Up, _Up, Off
Hotkey, ^Down, _Down, Off
Hotkey, ^Right, _Right, Off
Hotkey, ^Left, _Left, Off
Hotkey, NumpadDiv, _NumpadDiv, Off
Hotkey, NumpadMult, _NumpadMult, Off
Hotkey, NumpadSub, _NumpadSub, Off
Hotkey, NumpadAdd, _NumpadAdd, Off
return

;on/off
F1::
Hotkey, ~LButton, Toggle
return
F2::
_f2 := !_f2
ToolTip
if (_f2) {
	gosub, Load_Settings
} else {
	SetTimer, Menu, Off
} Hotkey, PGDN, Toggle
Hotkey, HOME, Toggle
Hotkey, ^Up, Toggle
Hotkey, ^Down, Toggle
Hotkey, ^Right, Toggle
Hotkey, ^Left, Toggle
Hotkey, NumpadDiv, Toggle
Hotkey, NumpadMult, Toggle
Hotkey, NumpadSub, Toggle
Hotkey, NumpadAdd, Toggle
return

;recargar
F12::Reload

;salir
F11::ExitApp

;no-recoil
Auto_Fire:
while (GetKeyState("LButton", "P")) {
	SendInput, {LButton DownTemp}
	Sleep, 22
	DllCall("User32.dll\mouse_event", "UInt", 1, "UInt", 0, "UInt", 1, "UInt", 0, "UPtr", 0)
	SendInput {LButton Up}
	Sleep 22
}
return

Load_Settings:
ScriptName := "Crosshair" ;SplitPath, A_ScriptName,,,, ScriptName
vm := ft := 1, chv := 0
IniRead, chxt, %ScriptName%.ini, Crochair tol,chxt
IniRead, chyt, %ScriptName%.ini, Crochair tol,chyt
IniRead, chp, %ScriptName%.ini, Crochair Picture, PictureNum
IniRead, chcl, %ScriptName%.ini, Crochair Picture, Picturecolor
IniRead, chc, %ScriptName%.ini, Crochair Picture, Picturecolorval
IniRead, chimg, %ScriptName%.ini, Crochair Picture, PictureFile
IniRead, chimgw, %ScriptName%.ini, Crochair Picture, PictureWidth
IniRead, chimgh, %ScriptName%.ini, Crochair Picture, PictureHeight
SetTimer, menu, 200
goto, menu
return

;cross-hair
_PGDN:
vm := !vm
SetTimer, Menu, % vm?200:"Off"
if !(vm)
	ToolTip,,,, 1
else gosub, Menu
return

Menu:
ToolTip, % "Crosshair Type:" A_Tab chp
	. "`nCrosshair Color:" A_Tab chcl
	. "`nCrosshair Size:" A_Tab chimgw
	. "`n---------------------------------------------"
	. "`nPageDown:" A_Tab "Show/Hide Menu"
	. "`nHome:" A_Tab A_Tab "Show/Hide Crosshair"
	. "`n/:" A_Tab A_Tab "Change Crosshair type"
	. "`n*:" A_Tab A_Tab "Change Crosshair color"
	. "`n+:" A_Tab A_Tab "Increase Crosshair Size"
	. "`n-:" A_Tab A_Tab "Decrease Crosshair Size"
	. "`nCtrl+Arows:" A_Tab "Move Crosshair Position", 0, 0
return

_HOME:
if (chv) {
	Gui, Hide
	SetTimer, tick, Off
	chv := 0
} else {
	gosub, % ft?"showch":"drawch"
	chv := 1
	SetTimer, tick, 200
}
return

showch:
if !(ft)
	return
wint := WinExist("A")
WinGetPos, winx, winy, winw, winh, ahk_id %wint%
gosub, posch
Gui, +AlwaysOnTop -Caption +LastFound
WinSet, TransColor, White
Gui, Add, Picture, w%chimgw% h%chimgh% AltSubmit, %A_ScriptDir%\IMG\%chimg%
Gui, Color, FFFFFF
Gui, Show, NA x%chx% y%chy%
ft := 0
return

posch:
chx := winx + (winw / 2) + chxt - chimgw
chy := winy + (winh / 2) + chyt - chimgh
return

drawch:
gosub, posch
Gui, Show, NA x%chx% y%chy%
return

tick:
if (WinActive("ahk_id " wint)) {
	WinGetPos, winx1, winy1, winw1, winh1, ahk_id %wint%
	if !(winx1=winx) || !(winy1=winy) || !(winw1=winw) || !(winh1=winh) {
		WinGetPos, winx, winy, winw, winh, ahk_id %wint%
		if (chv)
			gosub, drawch
	}
} else Gui, Hide
return

_Up:
chyt--
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Down:
chyt++
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Left:
chxt--
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return
_Right:
chxt++
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return

_NumpadDiv:
if !(chv)
	return
if chp between 1 and 5
	chp++
else chp := 1
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chp%, %ScriptName%.ini , Crochair Picture, PictureNum
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadMult:
if !(chv)
	return
chc := chc=1?2:chc=2?3:chc=3?4:chc=4?1:chc
chcl := chc=1?"Green":chc=2?"Red":chc=3?"Yellow":chc=4?"Blue":chcl
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chcl%, %ScriptName%.ini , Crochair Picture, Picturecolor
IniWrite, %chc%, %ScriptName%.ini , Crochair Picture, Picturecolorval
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadSub:
if !(chv)
	return
chimgw--
chimgw := chimgw<5?5:chimgw
chimgh--
chimgh := chimgh<5?5:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadAdd:
if !(chv)
	return
chimgw++
chimgw := chimgw>200?20:chimgw
chimgh++
chimgh := chimgh>200?200:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return
Nota: debes ponerlo en el mismo directorio junto con el archivo Crosshair.ini y la carpeta IMG
Thorx
Posts: 36
Joined: 23 Nov 2015, 18:53

muchas gracias

27 Nov 2015, 08:58

muchas gracias
Last edited by Thorx on 14 Aug 2016, 22:19, edited 1 time in total.
User avatar
Flipeador
Posts: 1019
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: COMBINAR 2 SCRIPTS EN UNO SOLO

27 Nov 2015, 10:09

¿a que te refieres con menú desplegable?
el ¿ToolTip?
lo puedes ocultar con la tecla "Page Down", en mi teclado "AV PÁG"
le hice algunos pequeños cambios:

Code: Select all

#NoEnv
#SingleInstance, Force
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, ToolTip, Screen 

Hotkey, ~LButton, Auto_Fire, Off

Hotkey, PGDN, _PGDN, Off
Hotkey, HOME, _HOME, Off
Hotkey, ^Up, _Up, Off
Hotkey, ^Down, _Down, Off
Hotkey, ^Right, _Right, Off
Hotkey, ^Left, _Left, Off
Hotkey, NumpadDiv, _NumpadDiv, Off
Hotkey, NumpadMult, _NumpadMult, Off
Hotkey, NumpadSub, _NumpadSub, Off
Hotkey, NumpadAdd, _NumpadAdd, Off
return

;on/off
F1::
Hotkey, ~LButton, Toggle
return
F2::
_f2 := !_f2
ToolTip
Gui, Destroy
if (_f2) {
	gosub, Load_Settings
} else {
	SetTimer, Menu, Off
} Hotkey, PGDN, Toggle
Hotkey, HOME, Toggle
Hotkey, ^Up, Toggle
Hotkey, ^Down, Toggle
Hotkey, ^Right, Toggle
Hotkey, ^Left, Toggle
Hotkey, NumpadDiv, Toggle
Hotkey, NumpadMult, Toggle
Hotkey, NumpadSub, Toggle
Hotkey, NumpadAdd, Toggle
return

;recargar
F12::Reload

;salir
F11::ExitApp

;no-recoil
Auto_Fire:
while (GetKeyState("LButton", "P")) {
	SendInput, {LButton DownTemp}
	Sleep, 22
	DllCall("User32.dll\mouse_event", "UInt", 1, "UInt", 0, "UInt", 1, "UInt", 0, "UPtr", 0)
	SendInput {LButton Up}
	Sleep 22
}
return

Load_Settings:
ScriptName := "Crosshair" ;SplitPath, A_ScriptName,,,, ScriptName
vm := ft := 1, chv := 0
IniRead, chxt, %ScriptName%.ini, Crochair tol,chxt
IniRead, chyt, %ScriptName%.ini, Crochair tol,chyt
IniRead, chp, %ScriptName%.ini, Crochair Picture, PictureNum
IniRead, chcl, %ScriptName%.ini, Crochair Picture, Picturecolor
IniRead, chc, %ScriptName%.ini, Crochair Picture, Picturecolorval
IniRead, chimg, %ScriptName%.ini, Crochair Picture, PictureFile
IniRead, chimgw, %ScriptName%.ini, Crochair Picture, PictureWidth
IniRead, chimgh, %ScriptName%.ini, Crochair Picture, PictureHeight
SetTimer, menu, 200
goto, menu
return

;cross-hair
_PGDN:
vm := !vm
SetTimer, Menu, % vm?200:"Off"
if !(vm)
	ToolTip,,,, 1
else gosub, Menu
return

Menu:
ToolTip, % "Crosshair Type:" A_Tab chp
	. "`nCrosshair Color:" A_Tab chcl
	. "`nCrosshair Size:" A_Tab chimgw
	. "`n---------------------------------------------"
	. "`nPageDown:" A_Tab "Show/Hide Menu"
	. "`nHome:" A_Tab A_Tab "Show/Hide Crosshair"
	. "`n/:" A_Tab A_Tab "Change Crosshair type"
	. "`n*:" A_Tab A_Tab "Change Crosshair color"
	. "`n+:" A_Tab A_Tab "Increase Crosshair Size"
	. "`n-:" A_Tab A_Tab "Decrease Crosshair Size"
	. "`nCtrl+Arows:" A_Tab "Move Crosshair Position", 0, 0
return

_HOME:
if (chv) {
	Gui, Hide
	SetTimer, tick, Off
	chv := 0
} else {
	gosub, % ft?"showch":"drawch"
	chv := 1
	SetTimer, tick, 200
}
return

showch:
if !(ft)
	return
wint := WinExist("A")
WinGetPos, winx, winy, winw, winh, ahk_id %wint%
gosub, posch
Gui, +AlwaysOnTop -Caption +LastFound +ToolWindow
WinSet, TransColor, White
Gui, Color, FFFFFF
Gui, Add, Picture, w%chimgw% h%chimgh% AltSubmit, %A_ScriptDir%\IMG\%chimg%
Gui, Show, NA x%chx% y%chy%
ft := 0
return

posch:
chx := winx + (winw / 2) + chxt - chimgw
chy := winy + (winh / 2) + chyt - chimgh
return

drawch:
gosub, posch
Gui, Show, NA x%chx% y%chy%
return

tick:
if (WinActive("ahk_id " wint)) {
	WinGetPos, winx1, winy1, winw1, winh1, ahk_id %wint%
	if !(winx1=winx) || !(winy1=winy) || !(winw1=winw) || !(winh1=winh) {
		WinGetPos, winx, winy, winw, winh, ahk_id %wint%
		if (chv)
			gosub, drawch
	}
} else Gui, Hide
return

_Up:
chyt--
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Down:
chyt++
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Left:
chxt--
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return
_Right:
chxt++
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return

_NumpadDiv:
if !(chv)
	return
if chp between 1 and 5
	chp++
else chp := 1
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chp%, %ScriptName%.ini , Crochair Picture, PictureNum
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadMult:
if !(chv)
	return
chc := chc=1?2:chc=2?3:chc=3?4:chc=4?1:chc
chcl := chc=1?"Green":chc=2?"Red":chc=3?"Yellow":chc=4?"Blue":chcl
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chcl%, %ScriptName%.ini , Crochair Picture, Picturecolor
IniWrite, %chc%, %ScriptName%.ini , Crochair Picture, Picturecolorval
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadSub:
if !(chv)
	return
chimgw--
chimgw := chimgw<5?5:chimgw
chimgh--
chimgh := chimgh<5?5:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadAdd:
if !(chv)
	return
chimgw++
chimgw := chimgw>200?20:chimgw
chimgh++
chimgh := chimgh>200?200:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return
Thorx
Posts: 36
Joined: 23 Nov 2015, 18:53

muchas gracias

27 Nov 2015, 15:12

muchas gracias
Last edited by Thorx on 14 Aug 2016, 22:19, edited 1 time in total.
User avatar
Flipeador
Posts: 1019
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: COMBINAR 2 SCRIPTS EN UNO SOLO

27 Nov 2015, 15:58

Algo me da error pero como que ya casi casi , algo falla cuando presiono f2
• Cuando apretas F2 te da error, porque tenes que poner el script con el archivo .ini (en el mismo directorio).
Ejemplo:
----- ..\Script.ahk
----- ..\Crosshair.ini
----- ..\IMG
----- ..\IMG\*

Ejemplo del contenido de larchivo .ini (Crosshair.ini)

Code: Select all

[Crochair tol]
chxt=44
chyt=-2
[Crochair Picture]
PictureNum=4
Picturecolor=Red
Picturecolorval=3
PictureFile=CH43
PictureWidth=19
PictureHeight=19
• Otro motivo puede ser que no tengas actualizado AutoHotKey a la version actual (1.1.22.09)

• Si eso no lo soluciona, deja una imagen con el error.
Extrayendo solamente los codigos del croshair en color rojo y de cruz + [...]
• no entiendo, ¿que códigos en color rojo?, ¿imagen?
tiene muchas cosas incluido el menu que parpadea aun desactivandolo , queda una ventanita parpadeante [...]
• ¿que "ventanita"?, si puedes poner imágenes seria mejor.
la ventana del menu desplegable genera una corrupcion en la ventana del juego
• ¿a que te refieres con "Menu desplegable"?.
• ¿con "ventana" te refieres a "la ventanita" de lo que puse arriba o la ventana del punto de mira?.

-----------
Si quieres pon imágenes y lo vemos bien ;)

También puedes probar si te funciona este:
Nota: F3 hace la misma funcion que HOME
Ejemplo: pon el script con la carpeta de imagenes y Crosshair.ini, preciona F2, luego AV PÁG (para ocultar el ToolTip), luego con la ventana activa del juego, preciona F3.

Code: Select all

#NoEnv
#SingleInstance, Force
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, ToolTip, Screen 

Hotkey, ~LButton, Auto_Fire, Off

Hotkey, PGDN, _PGDN, Off
Hotkey, HOME, _HOME, Off
Hotkey, ^Up, _Up, Off
Hotkey, ^Down, _Down, Off
Hotkey, ^Right, _Right, Off
Hotkey, ^Left, _Left, Off
Hotkey, NumpadDiv, _NumpadDiv, Off
Hotkey, NumpadMult, _NumpadMult, Off
Hotkey, NumpadSub, _NumpadSub, Off
Hotkey, NumpadAdd, _NumpadAdd, Off
return

;on/off
F1::
Hotkey, ~LButton, Toggle
return
F2::
_f2 := !_f2
ToolTip
Gui, Destroy
if (_f2) {
	gosub, Load_Settings
} else {
	SetTimer, Menu, Off
} Hotkey, PGDN, Toggle
Hotkey, HOME, Toggle
Hotkey, ^Up, Toggle
Hotkey, ^Down, Toggle
Hotkey, ^Right, Toggle
Hotkey, ^Left, Toggle
Hotkey, NumpadDiv, Toggle
Hotkey, NumpadMult, Toggle
Hotkey, NumpadSub, Toggle
Hotkey, NumpadAdd, Toggle
return

;recargar
F12::Reload

;salir
F11::ExitApp

;no-recoil
Auto_Fire:
while (GetKeyState("LButton", "P")) {
	SendInput, {LButton DownTemp}
	Sleep, 22
	DllCall("User32.dll\mouse_event", "UInt", 1, "UInt", 0, "UInt", 1, "UInt", 0, "UPtr", 0)
	SendInput {LButton Up}
	Sleep 22
}
return

Load_Settings:
ScriptName := "Crosshair" ;SplitPath, A_ScriptName,,,, ScriptName
vm := ft := 1, chv := 0
IniRead, chxt, %ScriptName%.ini, Crochair tol,chxt
IniRead, chyt, %ScriptName%.ini, Crochair tol,chyt
IniRead, chp, %ScriptName%.ini, Crochair Picture, PictureNum
IniRead, chcl, %ScriptName%.ini, Crochair Picture, Picturecolor
IniRead, chc, %ScriptName%.ini, Crochair Picture, Picturecolorval
IniRead, chimg, %ScriptName%.ini, Crochair Picture, PictureFile
IniRead, chimgw, %ScriptName%.ini, Crochair Picture, PictureWidth
IniRead, chimgh, %ScriptName%.ini, Crochair Picture, PictureHeight
SetTimer, menu, 200
goto, menu
return

;cross-hair
_PGDN:
vm := !vm
SetTimer, Menu, % vm?200:"Off"
if !(vm)
	ToolTip,,,, 1
else gosub, Menu
return

Menu:
ToolTip, % "Crosshair Type:" A_Tab chp
	. "`nCrosshair Color:" A_Tab chcl
	. "`nCrosshair Size:" A_Tab chimgw
	. "`n---------------------------------------------"
	. "`nPageDown:" A_Tab "Show/Hide Menu"
	. "`nHome:" A_Tab A_Tab "Show/Hide Crosshair"
	. "`n/:" A_Tab A_Tab "Change Crosshair type"
	. "`n*:" A_Tab A_Tab "Change Crosshair color"
	. "`n+:" A_Tab A_Tab "Increase Crosshair Size"
	. "`n-:" A_Tab A_Tab "Decrease Crosshair Size"
	. "`nCtrl+Arows:" A_Tab "Move Crosshair Position", 0, 0
return
F3::
_HOME:
if (chv) {
	Gui, Hide
	SetTimer, tick, Off
	chv := 0
} else {
	gosub, % ft?"showch":"drawch"
	chv := 1
	SetTimer, tick, 200
}
return

showch:
if !(ft)
	return
Gui, Destroy
wint := WinExist("A")
WinGetPos, winx, winy, winw, winh, ahk_id %wint%
gosub, posch
Gui, -Caption +LastFound +ToolWindow +Owner%wint%
WinSet, TransColor, White
Gui, Color, FFFFFF
Gui, Add, Picture, w%chimgw% h%chimgh%, %A_ScriptDir%\IMG\%chimg%
Gui, Show, NA x%chx% y%chy%
ft := 0
return

posch:
chx := winx + (winw / 2) + chxt - chimgw
chy := winy + (winh / 2) + chyt - chimgh
return

drawch:
gosub, posch
ft := 1
gosub, showch
;Gui, Show, NA x%chx% y%chy%
return

tick:
if (WinActive("ahk_id " wint)) {
	WinGetPos, winx1, winy1, winw1, winh1, ahk_id %wint%
	if !(winx1=winx) || !(winy1=winy) || !(winw1=winw) || !(winh1=winh) {
		WinGetPos, winx, winy, winw, winh, ahk_id %wint%
		if (chv)
			gosub, drawch
	}
} else Gui, Hide
return

_Up:
chyt--
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Down:
chyt++
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Left:
chxt--
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return
_Right:
chxt++
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return

_NumpadDiv:
if !(chv)
	return
if chp between 1 and 5
	chp++
else chp := 1
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chp%, %ScriptName%.ini , Crochair Picture, PictureNum
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadMult:
if !(chv)
	return
chc := chc=1?2:chc=2?3:chc=3?4:chc=4?1:chc
chcl := chc=1?"Green":chc=2?"Red":chc=3?"Yellow":chc=4?"Blue":chcl
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chcl%, %ScriptName%.ini , Crochair Picture, Picturecolor
IniWrite, %chc%, %ScriptName%.ini , Crochair Picture, Picturecolorval
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadSub:
if !(chv)
	return
chimgw--
chimgw := chimgw<5?5:chimgw
chimgh--
chimgh := chimgh<5?5:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return

_NumpadAdd:
if !(chv)
	return
chimgw++
chimgw := chimgw>200?20:chimgw
chimgh++
chimgh := chimgh>200?200:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
Thorx
Posts: 36
Joined: 23 Nov 2015, 18:53

muchas gracias

27 Nov 2015, 22:46

muchas gracias
Last edited by Thorx on 14 Aug 2016, 22:20, edited 1 time in total.
User avatar
Flipeador
Posts: 1019
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: COMBINAR 2 SCRIPTS EN UNO SOLO

28 Nov 2015, 06:03

Eso lo puedes modificar a gusto: ver documentación (hotkeys)
Quedaría: F1 y F2 que antes activaban el script, ahora no hacen nada, activar/desactivar con |. F3 quitado, usar HOME.

Code: Select all

#NoEnv
#SingleInstance, Force
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, ToolTip, Screen 
 
Hotkey, ~LButton, Auto_Fire, Off
 
Hotkey, PGDN, _PGDN, Off
Hotkey, HOME, _HOME, Off
Hotkey, ^Up, _Up, Off
Hotkey, ^Down, _Down, Off
Hotkey, ^Right, _Right, Off
Hotkey, ^Left, _Left, Off
Hotkey, NumpadDiv, _NumpadDiv, Off
Hotkey, NumpadMult, _NumpadMult, Off
Hotkey, NumpadSub, _NumpadSub, Off
Hotkey, NumpadAdd, _NumpadAdd, Off
return
 
;on/off
|::
Hotkey, ~LButton, Toggle
_f2 := !_f2
ToolTip
Gui, Destroy
if (_f2) {
	gosub, Load_Settings
} else {
	SetTimer, Menu, Off
} Hotkey, PGDN, Toggle
Hotkey, HOME, Toggle
Hotkey, ^Up, Toggle
Hotkey, ^Down, Toggle
Hotkey, ^Right, Toggle
Hotkey, ^Left, Toggle
Hotkey, NumpadDiv, Toggle
Hotkey, NumpadMult, Toggle
Hotkey, NumpadSub, Toggle
Hotkey, NumpadAdd, Toggle
return
 
;recargar
F12::Reload
 
;salir
F11::ExitApp
 
;no-recoil
Auto_Fire:
while (GetKeyState("LButton", "P")) {
	SendInput, {LButton DownTemp}
	Sleep, 22
	DllCall("User32.dll\mouse_event", "UInt", 1, "UInt", 0, "UInt", 1, "UInt", 0, "UPtr", 0)
	SendInput {LButton Up}
	Sleep 22
}
return
 
Load_Settings:
ScriptName := "Crosshair" ;SplitPath, A_ScriptName,,,, ScriptName
vm := ft := 1, chv := 0
IniRead, chxt, %ScriptName%.ini, Crochair tol,chxt
IniRead, chyt, %ScriptName%.ini, Crochair tol,chyt
IniRead, chp, %ScriptName%.ini, Crochair Picture, PictureNum
IniRead, chcl, %ScriptName%.ini, Crochair Picture, Picturecolor
IniRead, chc, %ScriptName%.ini, Crochair Picture, Picturecolorval
IniRead, chimg, %ScriptName%.ini, Crochair Picture, PictureFile
IniRead, chimgw, %ScriptName%.ini, Crochair Picture, PictureWidth
IniRead, chimgh, %ScriptName%.ini, Crochair Picture, PictureHeight
SetTimer, menu, 200
goto, menu
return
 
;cross-hair
_PGDN:
vm := !vm
SetTimer, Menu, % vm?200:"Off"
if !(vm)
	ToolTip,,,, 1
else gosub, Menu
return
 
Menu:
ToolTip, % "Crosshair Type:" A_Tab chp
	. "`nCrosshair Color:" A_Tab chcl
	. "`nCrosshair Size:" A_Tab chimgw
	. "`n---------------------------------------------"
	. "`nPageDown:" A_Tab "Show/Hide Menu"
	. "`nHome:" A_Tab A_Tab "Show/Hide Crosshair"
	. "`n/:" A_Tab A_Tab "Change Crosshair type"
	. "`n*:" A_Tab A_Tab "Change Crosshair color"
	. "`n+:" A_Tab A_Tab "Increase Crosshair Size"
	. "`n-:" A_Tab A_Tab "Decrease Crosshair Size"
	. "`nCtrl+Arows:" A_Tab "Move Crosshair Position", 0, 0
return

_HOME:
if (chv) {
	Gui, Hide
	SetTimer, tick, Off
	chv := 0
} else {
	gosub, % ft?"showch":"drawch"
	chv := 1
	SetTimer, tick, 200
}
return
 
showch:
if !(ft)
	return
Gui, Destroy
wint := WinExist("A")
WinGetPos, winx, winy, winw, winh, ahk_id %wint%
gosub, posch
Gui, -Caption +LastFound +ToolWindow +Owner%wint%
WinSet, TransColor, White
Gui, Color, FFFFFF
Gui, Add, Picture, w%chimgw% h%chimgh%, %A_ScriptDir%\IMG\%chimg%
Gui, Show, NA x%chx% y%chy%
ft := 0
return
 
posch:
chx := winx + (winw / 2) + chxt - chimgw
chy := winy + (winh / 2) + chyt - chimgh
return
 
drawch:
gosub, posch
ft := 1
gosub, showch
;Gui, Show, NA x%chx% y%chy%
return
 
tick:
if (WinActive("ahk_id " wint)) {
	WinGetPos, winx1, winy1, winw1, winh1, ahk_id %wint%
	if !(winx1=winx) || !(winy1=winy) || !(winw1=winw) || !(winh1=winh) {
		WinGetPos, winx, winy, winw, winh, ahk_id %wint%
		if (chv)
			gosub, drawch
	}
} else Gui, Hide
return
 
_Up:
chyt--
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Down:
chyt++
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Left:
chxt--
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return
_Right:
chxt++
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return
 
_NumpadDiv:
if !(chv)
	return
if chp between 1 and 5
	chp++
else chp := 1
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chp%, %ScriptName%.ini , Crochair Picture, PictureNum
Gui, Destroy
ft := 1
gosub, showch
return
 
_NumpadMult:
if !(chv)
	return
chc := chc=1?2:chc=2?3:chc=3?4:chc=4?1:chc
chcl := chc=1?"Green":chc=2?"Red":chc=3?"Yellow":chc=4?"Blue":chcl
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chcl%, %ScriptName%.ini , Crochair Picture, Picturecolor
IniWrite, %chc%, %ScriptName%.ini , Crochair Picture, Picturecolorval
Gui, Destroy
ft := 1
gosub, showch
return
 
_NumpadSub:
if !(chv)
	return
chimgw--
chimgw := chimgw<5?5:chimgw
chimgh--
chimgh := chimgh<5?5:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return
 
_NumpadAdd:
if !(chv)
	return
chimgw++
chimgw := chimgw>200?20:chimgw
chimgh++
chimgh := chimgh>200?200:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
Thorx
Posts: 36
Joined: 23 Nov 2015, 18:53

muchas gracias

29 Nov 2015, 18:01

muchas gracias
Last edited by Thorx on 14 Aug 2016, 22:20, edited 1 time in total.
User avatar
Flipeador
Posts: 1019
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: COMBINAR 2 SCRIPTS EN UNO SOLO

29 Nov 2015, 19:11

Hola de nuevo, y que bueno que te haya servido.
No se mucho de esto , ni deseo incomodar tu valioso tiempo
no hay problema.
¿es posible unir el macro no recoil (para rifle) con mi macro rapidscope (para sniper)?
Si.
No puedo usar ninguna tecla de F1 al F12 , ni Insert , ni [...] activacion y desactivacion del macro no recoil [...] flecha direccional izquierda. activacion y desactivacion del macro sniper [...] flecha direccional derecha. salir [...] F4
Hecho. Aquí está todo combinado y con las teclas deseadas, sin probar.
Nota: adicional, la tecla END suspende/restaura todas las combinaciones de teclas.

Code: Select all

#NoEnv
#SingleInstance, Force
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, ToolTip, Screen 
 
Hotkey, ~LButton, Auto_Fire, Off
 
Hotkey, PGDN, _PGDN, Off
Hotkey, HOME, _HOME, Off
Hotkey, ^Up, _Up, Off
Hotkey, ^Down, _Down, Off
Hotkey, ^Right, _Right, Off
Hotkey, ^Left, _Left, Off
Hotkey, NumpadDiv, _NumpadDiv, Off
Hotkey, NumpadMult, _NumpadMult, Off
Hotkey, NumpadSub, _NumpadSub, Off
Hotkey, NumpadAdd, _NumpadAdd, Off

Hotkey, ~*LButton, rapid_scope, Off
return
 
;on/off
|::
Hotkey, ~LButton, Toggle
_f2 := !_f2
ToolTip
Gui, Destroy
if (_f2) {
	gosub, Load_Settings
} else {
	SetTimer, Menu, Off
} Hotkey, PGDN, Toggle
Hotkey, HOME, Toggle
Hotkey, ^Up, Toggle
Hotkey, ^Down, Toggle
Hotkey, ^Right, Toggle
Hotkey, ^Left, Toggle
Hotkey, NumpadDiv, Toggle
Hotkey, NumpadMult, Toggle
Hotkey, NumpadSub, Toggle
Hotkey, NumpadAdd, Toggle
return
 
;activar/desactivar no-recoil
Left::Hotkey, ~LButton, Toggle
 
;activar/desactivar 
Right::Hotkey, ~*LButton, Toggle

End::Suspend, Toggle

rapid_scope:
SendInput, {LButton down}
SendInput, {LButton up}
SendInput, {q down}
SendInput, {q up}
SendInput, {q down}
SendInput, {q up}
return
 
;recargar
;F12::Reload
 
;salir
F4::ExitApp
 
;no-recoil
Auto_Fire:
while (GetKeyState("LButton", "P")) {
	SendInput, {LButton DownTemp}
	Sleep, 22
	DllCall("User32.dll\mouse_event", "UInt", 1, "UInt", 0, "UInt", 1, "UInt", 0, "UPtr", 0)
	SendInput {LButton Up}
	Sleep 22
}
return
 
Load_Settings:
ScriptName := "Crosshair" ;SplitPath, A_ScriptName,,,, ScriptName
vm := ft := 1, chv := 0
IniRead, chxt, %ScriptName%.ini, Crochair tol,chxt
IniRead, chyt, %ScriptName%.ini, Crochair tol,chyt
IniRead, chp, %ScriptName%.ini, Crochair Picture, PictureNum
IniRead, chcl, %ScriptName%.ini, Crochair Picture, Picturecolor
IniRead, chc, %ScriptName%.ini, Crochair Picture, Picturecolorval
IniRead, chimg, %ScriptName%.ini, Crochair Picture, PictureFile
IniRead, chimgw, %ScriptName%.ini, Crochair Picture, PictureWidth
IniRead, chimgh, %ScriptName%.ini, Crochair Picture, PictureHeight
SetTimer, menu, 200
goto, menu
return
 
;cross-hair
_PGDN:
vm := !vm
SetTimer, Menu, % vm?200:"Off"
if !(vm)
	ToolTip,,,, 1
else gosub, Menu
return
 
Menu:
ToolTip, % "Crosshair Type:" A_Tab chp
	. "`nCrosshair Color:" A_Tab chcl
	. "`nCrosshair Size:" A_Tab chimgw
	. "`n---------------------------------------------"
	. "`nPageDown:" A_Tab "Show/Hide Menu"
	. "`nHome:" A_Tab A_Tab "Show/Hide Crosshair"
	. "`n/:" A_Tab A_Tab "Change Crosshair type"
	. "`n*:" A_Tab A_Tab "Change Crosshair color"
	. "`n+:" A_Tab A_Tab "Increase Crosshair Size"
	. "`n-:" A_Tab A_Tab "Decrease Crosshair Size"
	. "`nCtrl+Arows:" A_Tab "Move Crosshair Position", 0, 0
return

_HOME:
if (chv) {
	Gui, Hide
	SetTimer, tick, Off
	chv := 0
} else {
	gosub, % ft?"showch":"drawch"
	chv := 1
	SetTimer, tick, 200
}
return
 
showch:
if !(ft)
	return
Gui, Destroy
wint := WinExist("A")
WinGetPos, winx, winy, winw, winh, ahk_id %wint%
gosub, posch
Gui, -Caption +LastFound +ToolWindow +Owner%wint%
WinSet, TransColor, White
Gui, Color, FFFFFF
Gui, Add, Picture, w%chimgw% h%chimgh%, %A_ScriptDir%\IMG\%chimg%
Gui, Show, NA x%chx% y%chy%
ft := 0
return
 
posch:
chx := winx + (winw / 2) + chxt - chimgw
chy := winy + (winh / 2) + chyt - chimgh
return
 
drawch:
gosub, posch
ft := 1
gosub, showch
;Gui, Show, NA x%chx% y%chy%
return
 
tick:
if (WinActive("ahk_id " wint)) {
	WinGetPos, winx1, winy1, winw1, winh1, ahk_id %wint%
	if !(winx1=winx) || !(winy1=winy) || !(winw1=winw) || !(winh1=winh) {
		WinGetPos, winx, winy, winw, winh, ahk_id %wint%
		if (chv)
			gosub, drawch
	}
} else Gui, Hide
return
 
_Up:
chyt--
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Down:
chyt++
gosub, drawch
IniWrite, %chyt%, %ScriptName%.ini, Crochair tol, chyt
return
_Left:
chxt--
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return
_Right:
chxt++
gosub, drawch
IniWrite, %chxt%, %ScriptName%.ini, Crochair tol, chxt
return
 
_NumpadDiv:
if !(chv)
	return
if chp between 1 and 5
	chp++
else chp := 1
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chp%, %ScriptName%.ini , Crochair Picture, PictureNum
Gui, Destroy
ft := 1
gosub, showch
return
 
_NumpadMult:
if !(chv)
	return
chc := chc=1?2:chc=2?3:chc=3?4:chc=4?1:chc
chcl := chc=1?"Green":chc=2?"Red":chc=3?"Yellow":chc=4?"Blue":chcl
chimg := "CH" chp chc
IniWrite, %chimg%, %ScriptName%.ini , Crochair Picture, PictureFile
IniWrite, %chcl%, %ScriptName%.ini , Crochair Picture, Picturecolor
IniWrite, %chc%, %ScriptName%.ini , Crochair Picture, Picturecolorval
Gui, Destroy
ft := 1
gosub, showch
return
 
_NumpadSub:
if !(chv)
	return
chimgw--
chimgw := chimgw<5?5:chimgw
chimgh--
chimgh := chimgh<5?5:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return
 
_NumpadAdd:
if !(chv)
	return
chimgw++
chimgw := chimgw>200?20:chimgw
chimgh++
chimgh := chimgh>200?200:chimgh
IniWrite, %chimgw%, %ScriptName%.ini , Crochair Picture, PictureWidth
IniWrite, %chimgh%, %ScriptName%.ini , Crochair Picture, PictureHeight
Gui, Destroy
ft := 1
gosub, showch
return
Thorx
Posts: 36
Joined: 23 Nov 2015, 18:53

muchas gracias

29 Nov 2015, 21:08

muchas gracias
Last edited by Thorx on 14 Aug 2016, 22:20, edited 1 time in total.
User avatar
Flipeador
Posts: 1019
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: COMBINAR 2 SCRIPTS EN UNO SOLO

29 Nov 2015, 21:35

¿quieres quitar el crosshair y dejar solo el rapidscope y el norecoil?
en el script anterior estaba todo junto pero no interfería uno con el otro, ya que usaban teclas distintas.
Pero aún así, si quieres solo estos dos últimos:
Flecha IZ: activar/desactivar norecoil
Flecha DE: activar/desactivar rapidscope
Home: activar/desactivar todo
F4: salir

Code: Select all

#NoEnv
#SingleInstance, Force
SetBatchLines, -1

Hotkey, ~LButton, no_recoil, Off
Hotkey, ~*LButton, rapid_scope, Off
return

Left::Hotkey, ~LButton, Toggle
 
Right::Hotkey, ~*LButton, Toggle

F4::ExitApp

HOME::Suspend, Toggle

rapid_scope:
SendInput, {LButton down}
SendInput, {LButton up}
SendInput, {q down}
SendInput, {q up}
SendInput, {q down}
SendInput, {q up}
return

no_recoil:
while (GetKeyState("LButton", "P")) {
	SendInput, {LButton DownTemp}
	Sleep, 22
	DllCall("User32.dll\mouse_event", "UInt", 1, "UInt", 0, "UInt", 1, "UInt", 0, "UPtr", 0)
	SendInput {LButton Up}
	Sleep 22
}
return
Nota: estoy viendo que me vuelves a poner el código de vuelta, el código que me pusiste lo modifiqué un poco para hacerlo mas compacto y de fácil lectura, pero funciona exactamente igual, o debería, si no es así, lo arreglamos. La próxima que pongas un script te recomiendo que uses la etiqueta "Code" en "Select code --> AHK".

Ha, y lee la documentación, en especial Hotkeys y Hotkey
Thorx
Posts: 36
Joined: 23 Nov 2015, 18:53

muchas gracias

29 Nov 2015, 22:10

muchas gracias

Return to “Pedir Ayuda”

Who is online

Users browsing this forum: No registered users and 2 guests