Jump to content

hotkey recursive errors


solrac
 Share

Recommended Posts

I'm trying to make a script for a bunch of useless phrases i say over and over again but i keep getting recursive error whenever i try to run it. I'm using about thirty hotkeys right about now. each one goes a little bit like this

hotkeyset("1","num1")

func num1()

send("solrac214 eats a sammich{!}")

endfunc

I have a bunch of those but whenever i hit the key it thinks then spits out a recursive error any help is apreciated :P

Link to comment
Share on other sites

This is not the whole code. You have to have a While/Wend loop somewhere in the program so as to have AU3 script wait for the hotkey - unless it ends and the hotkey is unset.

Apart from that, your problem seem to be the numbers (but I can't think of a good way at this moment):

hotkeyset("1","num1")
hotkeyset("2","num2")

While 1
Wend

Func num1()
Send("solrac eats a sammich!", 1)
EndFunc

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

I figured out my problem!!!

first of all that wasn't all my code i had the loop it was just a snippet.

i had some of them bound like this

hotkeyset("h","h")

func h()

send("solrac214 [bold]h[/bold]angs up his pants")

endfunc

the h recalls itself thus creating the recurssive error

Now my question is is there a command to unset the hotkey so i could have something like this

hotkeyset("h","h")

func h()

hotkeyunset("h")

send("solrac214 [bold]h[/bold]angs up his pants")

hotkeyset("h","h")

endfunc

Link to comment
Share on other sites

I figured out my problem!!!

first of all that wasn't all my code i had the loop it was just a snippet.

i had some of them bound like this

hotkeyset("h","h")

func h()

send("solrac214 [bold]h[/bold]angs up his pants")

endfunc

the h recalls itself thus creating the recurssive error

Now my question is is there a command to unset the hotkey so i could have something like this

hotkeyset("h","h")

func h()

hotkeyunset("h")

send("solrac214 [bold]h[/bold]angs up his pants")

hotkeyset("h","h")

endfunc

yes, unset by re-assigning the hotkey with an empty string as the function to be called, you can then re-set it right after. one thing you're going to run into though, with all of your hotkeys set, if you have a hotkey set to a char in your string being sent, it will call that function, so you're going to have alot of setting and unsetting. you may want to make a function that toggles them all on or off based on a boolean variable, and just call that at the beginning and end of each of your functions...
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...