Sign in to follow this  
Followers 0
jammu

Hotkeyset not working!

26 posts in this topic

This is my script

HotKeySet("{F3}", "StartProg")

HotKeySet("{F4}", "ExitProg")

Func StartProg()

While 1

sleep(300)

MouseClick("left",463, 216)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",492, 215)

Sleep(300)

MouseClick("left",970, 753)

WEnd

Func ExitProg()

Exit

EndFunc

And it gives this error always when i syntaxcheck

: ERROR: syntax error

Func

^

: ERROR: ExitProg(): undefined function.

HotKeySet("{F4}", "ExitProg")

Share this post


Link to post
Share on other sites



Run it through tidy and you will understand (i hope):

HotKeySet("{F3}", "StartProg")
HotKeySet("{F4}", "ExitProg")

Func StartProg()
    While 1
        Sleep(300)
        MouseClick("left", 463, 216)
        Sleep(300)
        MouseClick("left", 964, 752)
        Sleep(300)
        MouseClick("left", 964, 752)
        Sleep(300)
        MouseClick("left", 492, 215)
        Sleep(300)
        MouseClick("left", 970, 753)
    WEnd
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
    Func ExitProg()
        Exit
    EndFunc   ;==>ExitProg
;### Tidy Error -> func is never closed in your script.

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

jammu,

You do not end StartProg before you start ExitProg!. You need to add an EndFunc between these 2 lines:

WEnd
; <<<<<<<<<<<<<<<<<<<<< Add EndFunc here
Func ExitProg()

2 tips:

1. Use Tidy on your scripts - it will pick up on these errors. Press Ctrl-T within SciTE or use the Tools menu.

2. When you post code, please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here).

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

i made it like this now

HotKeySet("{INSERT}", "StartProg")

HotKeySet("{END}", "ExitProg")

Func StartProg()

While 1

sleep(300)

MouseClick("left",463, 216)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",492, 215)

Sleep(300)

MouseClick("left",970, 753)

WEnd

EndFunc

Func ExitProg()

Exit

EndFunc

When i start it and press INSERT it wont start clicking :S annoying

Share this post


Link to post
Share on other sites

jammu,

You need to add some form of loop to keep your script active, otherwise it exits as soon as you have set the HotKeys. ;)

I would suggest:

While 1
    Sleep(10)
WEnd

M23

P.S. Did you read what I posted above about code tags?


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

damn, i'm just stupid ;) can you type that to my script please? :evil: i just can't get it

Share this post


Link to post
Share on other sites

jammu,

Where do you think it might go? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

i have no idea seriously :S i have while and wend there already?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

damn, i'm just stupid ;) can you type that to my script please? :evil: i just can't get it

c'mon, learn some basics to help yourself. Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

jammu,

You only have a While...WEnd loop inside one of your functions. ;)

Run through what you want your script to do:

It has 2 functions which you want to run when HotKeys are pressed - those are now properly defined by Func...EndFunc. The main part of the script sets these HotKeys and then does what? At the moment: nothing, it just exits. So you you need to keep the script active at this point:

Set HotKeys

Loop

Functions

When this is done the script remains active so your HotKeys can activate the functions. :evil:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

While 1

HotKeySet("{INSERT}", "StartProg")

HotKeySet("{END}", "ExitProg")

WEnd

Func StartProg()

While 1

sleep(300)

MouseClick("left",463, 216)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",964, 752)

sleep(300)

MouseClick("left",492, 215)

Sleep(300)

MouseClick("left",970, 753)

WEnd

EndFunc

Func ExitProg()

Exit

EndFunc

? ;) yeahyeah call me dumb whatever.. -.-

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

;\\\\\\\\\\\\\\\\\\\\Set hotkeys
HotKeySet("{F3}", "_Start")
HotKeySet("{F4}", "_Pause")
HotKeySet("{F5}", "_Exit")
;////////////////////

;\\\\\\\\\\\\\\\\\\\\Declare vars
Global $i
;////////////////////

;\\\\\\\\\\\\\\\\\\\\Main loop
While 1
    Sleep(1000)
WEnd
;////////////////////

;\\\\\\\\\\\\\\\\\\\\Functions
Func _Start()
    While 1
        Sleep(100)
        $i += 1
        ToolTip($i)
    WEnd
EndFunc   ;==>_Start

Func _Pause()
    ToolTip("Program paused.")
    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>_Pause

Func _Exit()
    Exit
EndFunc   ;==>_Exit
;////////////////////

Edited by Info

Share this post


Link to post
Share on other sites

Ok it works now but not in the game :/

I have KAROS online minimized and i open the script, then i go to karos and press "INSERT" it won't start but when i dont go to karos it starts.. Like the autoit wouldnt receive the command from me :e

Sorry for bad english. I hope you understand

Share this post


Link to post
Share on other sites

jammu,

And does that match what I suggested? NO! ;)

You are redeclaring your HotKeys every pass of that loop and you will run into huge problems with CPU usage - in fact I think you might well be at 100% and so you will not get your script to work properly.

Go and read what I posted above AGAIN and try and put the loop I suggested in the place I recommended.

M23

P.S. And if you post your code again without CODE TAGS, I will NOT help any more. :evil:


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

So, what i should type to that script if i want to get it working in game...

Share this post


Link to post
Share on other sites

jammu,

Which part of:

You need to add some form of loop to keep your script active, otherwise it exits as soon as you have set the HotKeys. I would suggest:

While 1

Sleep(10)

WEnd

and

Set HotKeys

Loop

Functions

do you not understand?

M23

P.S. That nice man Info has given you solution directly if you look carefully!


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Melba23, i have hotkeys working now but when i'm inside game, hotkeys won't work. If i'm not inside game, they work perfectly. :|

Share this post


Link to post
Share on other sites

jammu,

This is not good:

While 1
HotKeySet("{INSERT}", "StartProg")
HotKeySet("{END}", "ExitProg")
WEnd

It uses far too much of your processor and can even crash your system. :evil: As I said before, you only need to declare the HotKeys once. The code should read:

HotKeySet("{INSERT}", "StartProg")
HotKeySet("{END}", "ExitProg")

While 1
    Sleep(10)
WEnd

As to why it does not work in your game - ask a gamer! ;) Although I seem to have heard somewhere that certain games might be protected against things like botting - I wonder if that could have something to do with it? :evil:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Haha i understand, i removed those while and wend in hotkeyset thing^^ Yeah, only problem is that hotkeys doesnt follow to KAROS online ;) i would need it so bad.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0