Jump to content

Noob Requesting Assitance


Recommended Posts

I'm trying to create a macro to Bfly for Gunz: The Duel, but I'm having some problems with creating it using AutoIt (since I am a noob at scripting). I want my script to do "Spacebar" "w (or a,s,d) twice really fast" "Left mouse click" and "shift" in that order pretty fast when I use a hotkey "w" (or a,s,d), but I can't seem to get it to work.

I'm not sure what I'm doing wrong so any help would be appreciated.

Here's the script.

Global $Paused
HotKeySet("{F1}", "TogglePause")
HotKeySet("{F2}", "Terminate")
HotKeySet("w", "BflyForward")
HotKeySet("s", "BflyBackward")
HotKeySet("a", "BflyLeft")
HotKeySet("d", "BflyRight")

Func BflyForward()
    Send("{space}")
        sleep (250)
    Send("ww")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
EndFunc

Func BflyBackward()
    Send("{space}")
        sleep (250)
    Send("ss")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
EndFunc

Func BflyLeft()
    Send("{space}")
        sleep (250)
    Send("aa")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
EndFunc

Func BflyRight()
    Send("{space}")
        sleep (250)
    Send("dd")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
Endfunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc
Link to comment
Share on other sites

you have a hotkey set to w. You send the letters ww. the send command activates the hotkey. try this

Func BflyForward()
    HotKeySet ("w", "")
    Send("{space}")
        sleep (250)
    Send("ww")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet ("w", "BflyForward")
EndFunc

which will unset the hotkey first, do what it needs to do, then set the hotkey back to its original function. Do that to all your functions and you should be good to go :whistle:

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

you have a hotkey set to w. You send the letters ww. the send command activates the hotkey. try this

Func BflyForward()
    HotKeySet ("w", "")
    Send("{space}")
        sleep (250)
    Send("ww")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet ("w", "BflyForward")
EndFunc

which will unset the hotkey first, do what it needs to do, then set the hotkey back to its original function. Do that to all your functions and you should be good to go :whistle:

Won't get that far with-out the main loop

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Ok, I updated my script but now I get an error saying unknown function name when I try to use the hotkeys w, a, s, d.

Heres the current script with updates.

; Press F2 to terminate script, F1 to "pause"

Global $Paused
HotKeySet("{F1}", "TogglePause")
HotKeySet("{F2}", "Terminate")
HotKeySet("w", "BflyForward")
HotKeySet("s", "BflyBackward")
HotKeySet("a", "BflyLeft")
HotKeySet("d", "BflyRight")


While 1
    Sleep(250)
Wend


Func BflyForward()
    HotKeySet("w", "")
    Send("{space}")
        sleep (250)
    Send("ww")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet("w", "BflyForward")
EndFunc

Func BflyBackward()
    HotKeySet("s", "")
    Send("{space}")
        sleep (250)
    Send("ss")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet("s", "BflyBackward")
EndFunc

Func BflyLeft()
    HotKeySet("a", "")
    Send("{space}")
        sleep (250)
    Send("aa")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet("a", "BflyLeft")
EndFunc

Func BflyRight()
    HotKeySet("d", "")
    Send("{space}")
        sleep (250)
    Send("dd")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet("d", "BflyRight")
Endfunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc
Link to comment
Share on other sites

oops sorry

heres the fixed code

; Press F2 to terminate script, F1 to "pause"

Global $Paused
HotKeySet("{F1}", "TogglePause")
HotKeySet("{F2}", "Terminate")
HotKeySet("w", "BflyForward")
HotKeySet("s", "BflyBackward")
HotKeySet("a", "BflyLeft")
HotKeySet("d", "BflyRight")


While 1
    Sleep(250)
Wend


Func BflyForward()
    HotKeySet("w")
    Send("{space}")
        sleep (250)
    Send("ww")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet("w", "BflyForward")
EndFunc

Func BflyBackward()
    HotKeySet("s")
    Send("{space}")
        sleep (250)
    Send("ss")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet("s", "BflyBackward")
EndFunc

Func BflyLeft()
    HotKeySet("a")
    Send("{space}")
        sleep (250)
    Send("aa")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet("a", "BflyLeft")
EndFunc

Func BflyRight()
    HotKeySet("d")
    Send("{space}")
        sleep (250)
    Send("dd")
        sleep (50)
    MouseClick ("Left")
        Sleep (50)
    Send("{shift}")
    HotKeySet("d", "BflyRight")
Endfunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

should use

HotKeySet ("w")

instead of

HotKeySet ("w", "")

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

@OP,

For future reference, when posting a thread title, make its title remotely pertinent to question/subject you are posting about.

This is the support section of the forum, its meant for questions, so naming a thread "I Have A Problem", or "Question", or "Help Me My, Code Doesn't Work", or "Noob Requesting Assistance" Is redundant, and makes it harder for anyone else who has the same/similar questions as you to find the answer by searching the forums, which in turn means people often make extra threads, and people who are answering the threads just end up repeating the same answer several times over.

It is counter-productive.

Edited by Paulie
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...