Sign in to follow this  
Followers 0
PalliePascal

If _IsPressed Problem

8 posts in this topic

I'm trying to make a script that makes my healing in world of warcraft a bit easier. Because I can't set my left mousebutton to a hotkey in-game. B)

My current healing hotkey is F2 in-game. So I want the script to press F2 when I press my left mouse button, but the script gives an error when I do that.

It looks like this, but I don't know what the problem is. The -> <- part gives the error. :o

Func SimpleHealer()
While 1
->  If _IsPressed(01) then  <-
Send("{F2}")
else
Sleep(10)
EndIf 
Wend
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm trying to make a script that makes my healing in world of warcraft a bit easier. Because I can't set my left mousebutton to a hotkey in-game. B)

My current healing hotkey is F2 in-game. So I want the script to press F2 when I press my left mouse button, but the script gives an error when I do that.

It looks like this, but I don't know what the problem is. The -> <- part gives the error. :o

Func SimpleHealer()
While 1
->  If _IsPressed(01) then  <-
Send("{F2}")
else
Sleep(10)
EndIf 
Wend
EndFunc
Do you have "#Include <Misc.au3>" at the top of your script. If you do could you please post the error.

Edit - Copied from help file

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    If _IsPressed("23", $dll) Then
        MsgBox(0,"_IsPressed", "End Key Pressed")
        ExitLoop
    EndIf
WEnd
DllClose($dll)
Edited by BigDod


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Why is this post in AutoItX? This is for the DLL/COM version of AutoIt.

BTW: I tryed _IsPressed('01') and it works just fine, no error. I tryed the whole script only replacing Send({F2}) with MsgBox(0, '', '') and I got a MessageBox each time I clicked with no error.

Share this post


Link to post
Share on other sites

Btw: Sorry if I posted this in the wrong section. B)

I still can't get the script working. I tried BigDod's script, but it doesn't work. :graduated:

I know I can do this with hotkeys, but I use the hotkeys to active and pause my bot.

This is the complete script:

HotKeySet("{F5}", "HealBot")
HotKeySet("{F6}", "PauseBot")
HotKeySet("{F7}", "ExitBot")

MsgBox(0, "Heal-Bot Hotkeys", "F5 = Play Bot" & @CRLF & "F6 = Pause Bot" & @CRLF & "F7 = Exit Bot")

  While 1
      Sleep(10)
  Wend

Func HealBot()
  While 1
    if _IsPressed("01") then
      MsgBox(0, "Congrats", "It works!")
    else
      Sleep(100)
    EndIf 
  Wend
EndFunc

Func PauseBot()
  While 1
      Sleep(100)
  Wend
EndFunc

Func ExitBot()
    Exit
EndFunc

But the if _IsPressed() part still gives an error, any ideas how to fix that? :o

Share this post


Link to post
Share on other sites

your script first line must be: #include <Misc.au3>

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Please inform us to the exact message error. You may not be #include-ing as poisonkiller says.

@poisonkiller: it doesn't have to be the first line, just before it gets used

Edited by Icekirby1

Share this post


Link to post
Share on other sites

@Icekirby1: Yea i know, but in my script all #includes are first lines B)

Share this post


Link to post
Share on other sites

It's just one of the code-readability things. I do it to.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0