Jump to content

error? why it isn't works?


Recommended Posts

hi. i've got a simple script. I think the source is good but it don't want to work. (some errors are posible) so the script:

msgbox(0, "Help", "Hotkeys:" & @CRLF & " " & @CRLF & "F1 - RPGmenu" & @CRLF & "F2 - RTV" & @CRLF & "F3 - RPGrank" & @CRLF & "F6 - Votekick" & @CRLF & "F5 - Voteban" & @CRLF & "Esc - Exit script")

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F1}", "rpgmenu")
HotKeySet("{F2}", "RTV")
HotKeySet("{F3}", "rpgrank")
HotKeySet("{F5}", "votekick")
HotKeySet("{F6}", "voteban")

Func rpgmenu()
    Send("{y}")
    sleep(200)
    Send("rpgmenu")
    Send("{ENTER}")
EndFunc

Func RTV()
    Send("{y}")
    sleep(200)
    Send("rtv")
    Send("{ENTER}")
EndFunc

Func rpgrank()
    Send("{y}")
    sleep(200)
    Send("rpgrank")
    Send("{ENTER}")
EndFunc

Func voteban()
    Send("{y}")
    sleep(200)
    Send("votekick")
    Send("{ENTER}")
EndFunc

Func votekick()
    Send("{y}")
    sleep(200)
    Send("voteban")
    Send("{ENTER}")
EndFunc

is there any error in the source? if i start it it starts for 1ms and it exit.

Edited by Unc3nZureD
Link to comment
Share on other sites

Your script does nothing except defining function and intercepting hotkeys you define.

Place a waiting loop right after the block of HotKeySet(...) calls.

While 1
    Sleep(10)
WEnd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

You need to add a while loop so the program doesn't run through all the code immediately (and exits when done).

I suggest you add it between the funcs and HotKeySets, because if you add it before there, your script will never reach HotKeySet (because it remains in the loop).

(...)

HotKeySet("{F5}", "votekick")
HotKeySet("{F6}", "voteban")

While 1
;Optional: You could add Sleep(XXX) here so the script won't be too heavy for your memory.
WEnd


Func rpgmenu()
    Send("{y}")
    sleep(200)

(...)
Edited by nf67
Link to comment
Share on other sites

nf67,

A Sleep(<something small>) is more than recommended: it's necessary to avoid hogging a core to 100% uselessly. With a small Sleep, the core usage will be low (in the few %).

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

nf67,

A Sleep(<something small>) is more than recommended: it's necessary to avoid hogging a core to 100% uselessly. With a small Sleep, the core usage will be low (in the few %).

Just as an additional information, in this particular case sleep value doesn't have to be small at all, meaning any sleep would be good. This is due to the fact that sleeps larger than 10 are split into chunks of sleeps 10 internally by AutoIt (for it not to fall asleep). Seems.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

That's new to me. I'll dig further someday, thanks Trancexx (you deserve an uppercase!).

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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...