Quote:
Originally Posted by SuneC
2) Is that your whole script? If so, I understand why it won't work. You've forgot to do $cGUI = GUICreate("GWCA") and GUIRegisterMsg(0x500, "WndCallback").
When using GWCA, no matter if you use a GUI interface or not, you have to create a new one assigned to $cGUI.
When you say it works 50% of the time, it just confuses me though, that makes no sense.
The speed of window messages (which GWCA uses), can vary a lot. If you are having great issues with speed reduction when not focused your PC sounds pretty slow.
I have developed another method of doing communication between script and Dll though, so I might implement that. With a speed increase of around 10x. But it's a lot of work, so definitely won't happen before the Wintersdays.
|
Thank you for the fast answer. I tried using the latest version but it didn't help. But If you know some people who are able to use GWCA in conjunction with windows 7 then I guess the problem must be somewhere on my end.
You are right, thats not my whole script. I just rewrote the script here from my mind instead of copying it and forgot about the gui. My laptop is a 1.8GHz dual core with 2gb ram and a gforce 7600go. I know thats not top-notch but I don't think its too slow... (well, I hope it isn't:D).
Sometimes CmdCB($CA_GetAllegiance,$Agent) just comes back blank (this doesn't chage if I switch to CmdCBEX).
For example I wrote this script for interrupting:
Code:
;####### Includes #######
#include <GWCAConstants.au3>
#include <GUIConstantsEx.au3>
#include <Array.au3>
;####### Variables #######
global $IruptImportant = IniReadSection("interrupt.ini","important"),$useIrupt = 1
;####### Gui setup #######
#Region ### START Koda GUI section ### Form=
$cGui = GUICreate("Interrupt", 200, 400, 200, 190)
$IruptLog = GUICtrlCreateEdit("", 5, 10, 190, 390)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;####### Program Body #######
GUIRegisterMsg(0x500, "WndCallback")
GUIRegisterMsg(0x4A, "Interrupt")
Cmd($CA_SETLOGANDHWND, 1, $cGUI)
HotKeySet("0","_debug")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
_SetIruptSkill ()
WEnd
Func Interrupt($hwnd, $msg, $wparam, $lparam)
local $timer = TimerInit()
Local $recv = DllStructCreate("ptr;dword;ptr", $LParam)
Local $skillStruct = DllStructCreate($tagSKILLLOGSTRUCT, DllStructGetData($recv, 3))
Local $Agent = DllStructGetData($SkillStruct,"AgentId")
$CBType = "int"
;CmdCB($CA_GetAllegiance,$Agent) ;check wether spell is casted by an enemy
;If $CBVar[0] <> 768 then return
Local $SkillID = _ArraySearch($IruptImportant,DllStructGetData($skillStruct,"SkillId"),0,0,0,0,1); checks if spell needs to be interrupted
CmdCB(0x467,$Agent) ; 0x467 = CA_GetMyDistanceToAgent
If $SkillID <> -1 and $CBVar[0]<1300 Then ; If skill needs to be interrupted and caster is in spellrange
CmdCB($CA_SkillRecharge,$useIrupt)
If $CBVar[0] <> 0 then ; If no normal interrupt is ready use emergency interrupt
Cmd($CA_UseSkillbarSkill,8,$Agent)
Else
Cmd($CA_UseSkillbarSkill,$useIrupt,$Agent)
EndIf
GUICtrlSetData($IruptLog,$IruptImportant[$SkillID][1]&@CRLF,1) ; log the skill thatshould be interrupted
EndIf
ToolTip(TimerDiff($timer),0,0)
EndFunc
Func _SetIruptSkill ()
CmdCB($CA_SkillRecharge,1)
If $CBVar[0] = 0 Then
$useIrupt = 1
Else
CmdCB($CA_SkillRecharge,2)
If $cbVar[0] = 0 Then
$useIrupt = 2
Else
$useIrupt = 3
EndIf
EndIf
EndFunc
Func _debug ()
$CBType = "int"
CmdCB($CA_GetAllegiance,-1)
ToolTip("debug: "&$CBVar[0],0,0)
EndFunc
interrupt.ini:
Code:
[important]
1126=Empathic Removal
266=Peace and Harmony
309=Holy Veil
954=Expel Hexes
941=Blessed Light
2003=Cure Hex
282=Word of Healing
1687=Zealous Benediction
This works perfectly within approximatly 3ms until I uncomment this part:
;CmdCB($CA_GetAllegiance,$Agent) ;check wether spell is casted by an enemy
;If $CBVar[0] <> 768 then return
At wich point the function stops to work. When trying to find the error myself I noticed that $CBVar[0] is blank all the time and so the condition is not met.
If I just uncomment the CmdCB(...) part then the time goes up to about 20ms... (I dont know if this is relevant).
Furthermore I've ran into a third question:
3.) what exactly does CA_SetEngineHook do?
from the describtion I thought that it only disables the rendering of the graphics but when I used it in the above script (inserted before the loop) I noticed that the time needed to run the _interrupt function goes up to over 2 seconds.