Sign in to follow this  
Followers 0
lopolop

ToolTip problem...

3 posts in this topic

ok i am making a logon bot and working pretty well except i have a tool tip that pops up for 10 seconds to tell you what the HotKeys are to run the bot to aut logon, Exit the Game, or Exit the AutoIt program. It works good if i wait 10 seconds when it goes away then i hit Ctrl+Shift+S to start it and works good..

But if i hit that before it goes away it gets to Run($path) and says that $path isnt declared....

; ----------'HotKeys'----------
HotKeySet("^+e", "End_D2")
HotKeySet("^+s", "Run_D2")
HotKeySet("^+x", "Terminate")

; ----------'Start Up'----------

ToolTip("Press Ctrl+Shift+S To Start Diablo II" & @CRLF _
& "Press Ctrl+Shift+E To End Diablo II" & @CRLF _
& "Press Crtl+Shift+X To Exit D2Logon.exe", 400, 384)
Sleep(10000)
ToolTip("")
; ----------'Variables'----------
$path = IniRead ( "D2Logon Info.ini", "Processes", "D2_Path", "Unknown" )
$window = IniRead ( "D2Logon Info.ini", "Processes", "D2_WinName", "Unknown" )
; $exe = IniRead ( "D2Logon Info.ini", "Processes", "D2_Exe", "Unknown" )
$account = IniRead ( "D2Logon Info.ini", "Account", "Ac_Account", "Unknown" )
$pass = IniRead ( "D2Logon Info.ini", "Account", "Ac_Password", "Unknown" )
$slot = IniRead ( "D2Logon Info.ini", "Account", "Ac_Slot", "Unknown" )
$friend = IniRead ( "D2Logon Info.ini", "Extra", "Ex_Friends", "Unknown" )

; ===========
; Run_D2 Func Start
; ===========
Func Run_D2()
; ----------'Load'----------
ToolTip("")
Sleep(1000)
SplashTextOn("", "Starting Diablo 2", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(300)
SplashTextOn("", "Starting Diablo 2.", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(300)
SplashTextOn("", "Starting Diablo 2..", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(300)
SplashTextOn("", "Starting Diablo 2...", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(300)
SplashTextOn("", "Starting Diablo 2", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(300)
SplashTextOn("", "Starting Diablo 2.", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(300)
WinMinimizeAll()
SplashTextOn("", "Starting Diablo 2..", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(300)
Run($path)
Sleep(300)
SplashTextOn("", "Starting Diablo 2...", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(300)
SplashTextOn("", "Starting Diablo 2", 600, 22, 200 ,384 ,1 ,"System", "", "")
Sleep(500)

WinWaitActive( "Diablo II" )

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Just move your variables to above the startup area.

The script reads from the top to the bottom, so it finds out about your hotkeys, then it does your startup tooltip, then it waits for 10 seconds, then it makes the variables you need. So if you press the hotkey early you get errors because the variables you need havent been made yet.

Its always a good idea to declare any variables you need as close to the start of a script as you can.

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

ooo ic thanks alot!


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