PsaltyDS Posted September 12, 2006 Share Posted September 12, 2006 I was wondering If I just have a script like this BG_Start Func BG_Start() Opt("SendKeyDownDelay", 1500) Send( "{UP}") Opt("SendKeyDownDelay", 500) Send( "{LEFT}") Opt("SendKeyDownDelay", 10000) Send( "{UP}") Bg_Graveyard() EndFunc oÝ÷ Ùh¥ ]¡©e¡ûa¢Ç)à²)è׫jëh«bq©eÊ)Üçbaz«¨´«Þɪݪê-jÛayéÝN§Ïêº^dj»pY`zw«j×ê뢶Þq«¬y©e~éܶ*'q©e²¯zÚ!j÷©j·§¶¬zǯzx¶²ßÚÞzjmÊz)j¶¦z׫²)ï¢[Þu*-«l¥vZ(X¤y«¢+Ù }MÑÉÐ ¤)Õ¹ MÑÉÐ ¤(ì5¥Í½¡É( }ÉÙåÉ ¤)¹Õ¹ There is no "automatically including" going on, so your call to Bg_Graveyard() will require that function to also be declared somewhere in your script. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
andrew01 Posted September 12, 2006 Author Share Posted September 12, 2006 Basically this is like what I am going to do: BG_Start() Func BG_Start() Opt("SendKeyDownDelay", 1500) Send( "{UP}") Opt("SendKeyDownDelay", 500) Send( "{LEFT}") Opt("SendKeyDownDelay", 10000) Send( "{UP}") Bg_Graveyard() EndFunc ;stuffstuffstuff ;stuffstuffstuff ;stuffstuffstuff Bg_Graveyard() Func Bg_Graveyard() 'bg graveyard script so when bg_graveyard is called at the end of bg_start it will go right to the Bg_graveyard function. I think that is right. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 12, 2006 Moderators Share Posted September 12, 2006 (edited) That's not a very good habbit to get into, you'll start getting recurrsion errors. Since the function doesn't return until it's finished or you command it to... just put it like:BG_Start() Bg_Graveyard();Doesn't start until BG_Start is finished Func BG_Start() Opt("SendKeyDownDelay", 1500) Send( "{UP}") Opt("SendKeyDownDelay", 500) Send( "{LEFT}") Opt("SendKeyDownDelay", 10000) Send( "{UP}") EndFunc Edited September 12, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
andrew01 Posted September 12, 2006 Author Share Posted September 12, 2006 Ahh, ok I will do that instead, I want to start good habits Thanks for the help. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 12, 2006 Share Posted September 12, 2006 (edited) That's not a very good habbit to get into, you'll start getting recurrsion errors. Since the function doesn't return until it's finished or you command it to... just put it like:BG_Start() Bg_Graveyard();Doesn't start until BG_Start is finished Func BG_Start() Opt("SendKeyDownDelay", 1500) Send( "{UP}") Opt("SendKeyDownDelay", 500) Send( "{LEFT}") Opt("SendKeyDownDelay", 10000) Send( "{UP}") EndFuncoÝ÷ Ûú®¢×ÚÞÃMX¢ç©ÝÂ)eü¨¹ÚºÚMú+½êòàq©e¢Ø^û§rبÇë¢l"¶§iû§rب)ãb²Ü¢êìz¸ Ûajا~)h¢ÚÞrêìÞ®º+±ªÞy«2¶ÚX§¶î¶'ò¢ìÛhnè¥vj+yÊ&¦Xj×jwjë®*m²Vzº'ʧyçm¢W®|!jÛhÁ«~ì£*.q©Ý¢+¢ºÞrÙrN»-¶§ØZ¶¥¦Ì"¶ajج¶Þéz»aj×îËb¢{¢}ý¶»§º{bÆ¥çZ×hm«Þ¶Þuç%j·iº/{^ëa{&«zëu*)ºÈZ¨º·îËb¢w^rV«jبËh¶¢Ûhò¢êìr¸©µh^+׬r¸©¶Æ¥Ø^~éܶ*'q©e±©Ýr^jÛazÚ)j·¢wyú+x¯z{-j»p®+bayû§rبÄáyø«²ÛޮȨíë®*mºË¥¢,)¶¬jëh×6; =============== ; Main Sequence ; =============== ; Start the BG (whatever that is) BG_Start() ; BG the Graveyard (or some such comment) Bg_Graveyard() ; =============== ; Local Functions ; =============== Func BG_Start() ; Not yet written EndFunc Func Bg_Graveyard() ; Not yet written EndFunc That's all just extra typing for a simple script with only a few lines, but as they get longer and more complicated you will need these habits to keep from going nuts! Edited September 12, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
andrew01 Posted September 12, 2006 Author Share Posted September 12, 2006 I see what you are saying and that does sound like a good idea before writing each of my future scripts. Before this script I attempted to write and algorithm, just to plan out what I was going to do but since I didnt (and still dont) know much about autoit or programming in general at the time, it wasnt very detailed. You guys are teaching me a lot of good stuff and I really appreciate it Ok I was browsing the forums and came across this thread: HEREBasically it has a mana/health dectector (I think). For those who dont play World of Warcraft, you can see the health and mana bars in the screen shots in my first post. The health is out of 100% and most people have around 3000-5000 Health points (HP). Basically I would like to try to implement that script into my program. In the end, I would like the program to return a health value, and know when it has 0 health (dead) so it can restart a certain fuction and stop the function it is carrying out at that time.Here is the script in that thread:Func LifeValue() $lifespot = 209 $lifepercent = 100 While $lifespot >= 94 If PixelGetColor($lifespot, 81) >= 6912 And PixelGetColor($lifespot, 81) <= 45312 Then $life = $lifepercent ExitLoop EndIf $lifespot = $lifespot - 1.15 $lifepercent = $lifepercent - 1 If $lifepercent <= 0 Then $life = 0 ExitLoop EndIf WEnd Return $life EndFuncHas anyone used this before? I'm not really sure if $life comes back with a number or percent or what, its kind of confusing. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now