UnknownWarrior Posted April 24, 2009 Share Posted April 24, 2009 Well, I've read, re-read, and read my script over and over again. It just isn't making sense. I'll start off by giving my entire script so you know whats going on: expandcollapse popup#include <misc.au3> #include <NomadMemory.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet("{HOME}", "On") HotKeySet("{Esc}", "OFF") HotKeySet("{^p}", "Hpcolor") HotKeySet("{^r}", "Hpreset") Opt("GUICloseOnEsc",1) Global $start = 0, $Mem_Handle, $PID = ProcessExists(":"), $hpbox = "0x01E6B9B0", $hpbox2 = "0x01E6B9B4", $hpbox3 = "0x01E6B9B8", $hpbox4 = "0x01E6B9BC", $PixelColor, $MPos, $x = 0, $hpstart = 0 $Mem_Handle = _MemoryOpen($PID) #Region ### $Form1_1 = GUICreate(":", 498, 197, 194, 126) $Label1 = GUICtrlCreateLabel("Press Ctrl+p on HP bar", 256, 16, 171, 17) $Combo1 = GUICtrlCreateCombo("F1", 24, 48, 89, 25) GUICtrlSetData(-1, "F2|F3|F4|") $Label2 = GUICtrlCreateLabel("Select the key that will use the HEALTH pots.", 136, 48, 220, 17) $Input2 = GUICtrlCreateInput("", 24, 120, 209, 21) $Combo2 = GUICtrlCreateCombo("F1", 24, 160, 89, 25) GUICtrlSetData(-1, "F2|F3|F4|F5|F6|F7|F8|F9|F10") $Label3 = GUICtrlCreateLabel("Type in when you want a pot box to be used", 256, 120, 214, 17) $Label4 = GUICtrlCreateLabel("(how many pots remaining)", 256, 136, 129, 17) $Label5 = GUICtrlCreateLabel("Select the key that will use the Health BOXES.", 128, 168, 224, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 If $start Then Hp() EndIf WEnd Func Hp() $reader = GUICtrlRead($Combo1) $hpboxread = _MemoryRead($reader, $Mem_Handle) If $PixelColor <> PixelGetColor($MPos[0], $MPos[1]) Then Send("{" & GUICtrlRead($Combo1) & "}") Sleep(400) ElseIf GuiCtrlRead($Input2) >= $hpboxread Then Send("{" & GUICtrlRead($Combo2) & "}") EndIf EndFunc Func Hpcolor() If $hpstart = 1 Then MsgBox(0, "Woops", "You already have a color recorded.") ElseIf $hpstart = 0 Then $hpstart = 1 $MPos = MouseGetPos() $PixelColor = PixelGetColor($MPos[0], $MPos[1]) MsgBox(0, "HP", "HP has been recorded, you may press F5 whenever to start auto-potting.", 10) $x = 1 EndIf EndFunc Func Hpreset() $hpstart = 0 MsgBox(0, "Reset", "Press Ctrl+p to record your new HP position.") $x = 0 EndFunc Func On() If $x = 1 Then If $start = 0 Then $start = 1 ElseIf $start = 1 Then $start = 0 EndIf If $PID <> 0 And $Mem_Handle = "" Then $Mem_Handle = _MemoryOpen($PID) ElseIf $PID = 0 Then MsgBox(0,"Error","Please open Conquer 2.0 before starting the program.") $start = 0 EndIf ElseIf $x <> 1 Then MsgBox(0, "Oops", "Please record your HP position on your health bar. Refer to the ReadMe if unsure on what you are doing.") EndIf EndFunc Func OFF() _MemoryClose($PID) Exit EndFuncoÝ÷ Ø Ýj|°k++mêÞÌ!z·¢¶+&zË"©!·¥ëÞjëh×6Func Hpcolor() If $hpstart = 1 Then MsgBox(0, "Woops", "You already have a color recorded.") ElseIf $hpstart = 0 Then $hpstart = 1 $MPos = MouseGetPos() $PixelColor = PixelGetColor($MPos[0], $MPos[1]) MsgBox(0, "HP", "HP has been recorded, you may press F5 whenever to start auto-potting.", 10) $x = 1 EndIf EndFuncoÝ÷ ØZ½í7êlµªí±ëm£H§¶ÚÇ(¥æ¶¢(Û!¢é]h¶2È£âZÁ¬¨Ç¦·¬°+kêkmZº'hmz÷§ëZë,j£'w^kzË8Á"¶Æ²²Ø^zºè®g¬±¨¶a{H§¶>!z·ºÚ"µÍY ÌÍÔ^[ÛÛÜ ÉÝÈ^[Ù]ÛÛÜ ÌÍÓTÜÖÌK ÌÍÓTÜÖÌWJH[ I've actually used this same script with the potter feature (the part that is messing up), so I really have no idea what to fix. I know its somewhere in the Hpcolor() because that MsgBox isn't popping up, but why isn't it? Thanks for any help :S Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 24, 2009 Share Posted April 24, 2009 Giving us the line number from the error would have made it easier. The problem is that you are trying to read $MPos before it was assigned to be an array. Link to comment Share on other sites More sharing options...
Soru Posted April 24, 2009 Share Posted April 24, 2009 I tried running the script myself and saw that the hotkey used to call "Hpcolor" was not working.I changed it to HotKeySet("^{p}", "Hpcolor")instead ofHotKeySet("{^p}", "Hpcolor")After that I had no error and the hotkey worked... (I commented out the memory stuff though so not sure if that works ) [b][/b] Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 24, 2009 Share Posted April 24, 2009 Get rid of the {}. You only use those for special keys. Link to comment Share on other sites More sharing options...
UnknownWarrior Posted April 24, 2009 Author Share Posted April 24, 2009 (edited) I tried running the script myself and saw that the hotkey used to call "Hpcolor" was not working. I changed it to HotKeySet("^{p}", "Hpcolor") instead of HotKeySet("{^p}", "Hpcolor") After that I had no error and the hotkey worked... (I commented out the memory stuff though so not sure if that works ) Aha, that is what was wrong I see now. On my previous script I did notice I have ^p (same thing as ^{p})... So that would make $MPos not have an array as the ctrl+p never really assigned it... I'll test it out in a bit... Thanks a bunch guys EDIT 2:... Nvm I see my mistake... $reader = GUICtrlRead($Combo1) $hpboxread = _MemoryRead($reader, $Mem_Handle) well $reader is just the F key from the combo... So the $hpboxread isn't reading the memory address like it should be... How could I like relate the F key from $Combo1 to the $hpbox#'s at the top in the global... $hpbox3 = "0x01E6B9B8" = F3 Key in memory $hpbox4 = "0x01E6B9BC" = F4 Key in memory Would I just have to make an extra If statement? Like so: If $reader = "F3" Then $blah = $hpbox3 EndIf $reader = GUICtrlRead($Combo1) $hpboxread = _MemoryRead($blah, $Mem_Handle)oÝ÷ Ø*+ç-Ig¥kçb¶+wöÄ ²ì¥©¦x-áxì´ß ¨º6Z˶ا+h}ûh穲¦)àض~ËZµéجw(®·´æÊ)éºÖèÄZ½íÒ!j÷·>ly²iËMú £T¨Â+a+-jצz{¡×Ç|k¢ ÚåEæãM7èéºÝ¸× Edited April 24, 2009 by UnknownWarrior Link to comment Share on other sites More sharing options...
UnknownWarrior Posted April 24, 2009 Author Share Posted April 24, 2009 Bump Link to comment Share on other sites More sharing options...
UnknownWarrior Posted April 25, 2009 Author Share Posted April 25, 2009 Why won't anyone help me... I'm giving my entire script and telling my exact problem... Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 25, 2009 Share Posted April 25, 2009 Please show your current version of the script in one block. Right now, we have the full original code with no fixes, and your smaller blocks of things you think are the problem. And people like to help, just remember that we have things like jobs. Link to comment Share on other sites More sharing options...
UnknownWarrior Posted April 25, 2009 Author Share Posted April 25, 2009 Please show your current version of the script in one block. Right now, we have the full original code with no fixes, and your smaller blocks of things you think are the problem. And people like to help, just remember that we have things like jobs. Ahh ok, sorry... I appreciate your response.... heres the new full code. The part that is messing up is in the Hp() Func in the ElseIf statement here: ElseIf GuiCtrlRead($Input2) >= $hpboxread Then Send("{" & GUICtrlRead($Combo2) & "}") EndIf Full Code: expandcollapse popup#include <misc.au3> #include <NomadMemory.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet("{HOME}", "On") HotKeySet("{Esc}", "OFF") HotKeySet("^p", "Hpcolor") HotKeySet("^r", "Hpreset") Opt("GUICloseOnEsc",1) Global $start = 0, $Mem_Handle, $PID = ProcessExists(":"), $hpbox = "0x01E6B9B0", $hpbox2 = "0x01E6B9B4", $hpbox3 = "0x01E6B9B8", $hpbox4 = "0x01E6B9BC", $PixelColor, $MPos, $x = 0, $hpstart = 0 Global $blah ;hpmem = The actual HP numbers ;hp box = How many pots you actually have $Mem_Handle = _MemoryOpen($PID) #Region ### $Form1_1 = GUICreate(":", 498, 197, 194, 126) $Label1 = GUICtrlCreateLabel("Press Ctrl+p on HP bar", 256, 16, 171, 17) $Combo1 = GUICtrlCreateCombo("F1", 24, 48, 89, 25) GUICtrlSetData(-1, "F2|F3|F4|") $Label2 = GUICtrlCreateLabel("Select the key that will use the HEALTH pots.", 136, 48, 220, 17) $Input2 = GUICtrlCreateInput("", 24, 120, 209, 21) $Combo2 = GUICtrlCreateCombo("F1", 24, 160, 89, 25) GUICtrlSetData(-1, "F2|F3|F4|F5|F6|F7|F8|F9|F10") $Label3 = GUICtrlCreateLabel("Type in when you want a pot box to be used", 256, 120, 214, 17) $Label4 = GUICtrlCreateLabel("(how many pots remaining)", 256, 136, 129, 17) $Label5 = GUICtrlCreateLabel("Select the key that will use the Health BOXES.", 128, 168, 224, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 If $start Then Hp() EndIf WEnd Func Hp() ;MsgBox(0,"", "hey") $reader = GUICtrlRead($Combo1) If $reader = "F1" Then ;MsgBox(0,"", $reader) $blah = $hpbox ElseIf $reader = "F2" Then $blah = $hpbox2 ElseIf $reader = "F3" Then $blah = $hpbox3 ElseIf $reader = "F4" Then $blah = $hpbox4 EndIf $hpboxread = _MemoryRead($blah, $Mem_Handle) If $PixelColor <> PixelGetColor($MPos[0], $MPos[1]) Then Send("{" & GUICtrlRead($Combo1) & "}") Sleep(400) ElseIf GuiCtrlRead($Input2) >= $hpboxread Then Send("{" & GUICtrlRead($Combo2) & "}") EndIf EndFunc Func Hpcolor() If $hpstart = 1 Then MsgBox(0, "Woops", "You already have a color recorded, press Ctrl+r to reset the color.") ElseIf $hpstart = 0 Then $hpstart = 1 $MPos = MouseGetPos() $PixelColor = PixelGetColor($MPos[0], $MPos[1]) MsgBox(0, "HP", "HP has been recorded, you may press F5 whenever to start auto-potting.", 10) $x = 1 EndIf EndFunc Func Hpreset() $hpstart = 0 MsgBox(0, "Reset", "Press Ctrl+p to record your new HP position.") $x = 0 EndFunc Func On() If $x = 1 Then If $start = 0 Then $start = 1 ElseIf $start = 1 Then $start = 0 EndIf If $PID <> 0 And $Mem_Handle = "" Then $Mem_Handle = _MemoryOpen($PID) ElseIf $PID = 0 Then MsgBox(0,"Error","Please open : before starting the program.") $start = 0 EndIf ElseIf $x <> 1 Then MsgBox(0, "Oops", "Please record your HP position on your health bar. Refer to the ReadMe if unsure on what you are doing.") EndIf EndFunc Func OFF() _MemoryClose($PID) Exit EndFunc Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 25, 2009 Share Posted April 25, 2009 To start, change While 1 If $start Then Hp() EndIf WEndoÝ÷ ÚÚºÚ"µÍÚ[HBY ÌÍÜÝ[ B[YÛY L BÑ[ And see if the pause is enough time to let the game use the new key press. Link to comment Share on other sites More sharing options...
UnknownWarrior Posted April 29, 2009 Author Share Posted April 29, 2009 Should that even matter? The ElseIf statement should be based on 'If' (duh xD) the statement is true, then execute the next block of code... For some reason though it is executing it even though it is NOT true... >< Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 30, 2009 Share Posted April 30, 2009 Sometimes you get an error called a "race condition". It only happens when things move too fast. Just a suggestion. I can't accurately diagnose your problem without the game. Oh, and something else I noticed wrong with your code. Remove the { } from around your send value. For regular keys, you DO NOT use them. If you need to use a special key, you can just put {F1} in your GUI box. The send command might be a problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now