|
Post by Ancalima on Dec 5, 2004 11:52:11 GMT -5
I am very new to scripting with AutoIT and I need a little help setting up a bot to raise my magic skills in FFXI like healing magic and enhancing magic. I have part of the code written already:
$MPForCure = 8 $MyMP = 140
Sleep(100000) While $MyMP >= $MinMPToCure Send("/ma "Cure" <me>") Sleep(8000) $MyMP = $MyMP - 8 WEnd
I am unsure as to whether or not this works because I don't yet have a windower to test it in FFXI. Please if you see any errors in my code let me know, I have absolutely no idea where I'm going with this. I was also wondering if there was any way to retrieve my MP value fro FFXI instead of using my current max whixh is what I am doing now. I read the tutorial and that helped alot but I think I need a little more specific help with my situation. Any help you can provide will be greatly appreciated.
|
|
|
Post by Ancalima on Dec 5, 2004 21:44:06 GMT -5
Well I modified the code a little and changed it to raise enhancing magic and it works pretty well for the time here is the code:
$MyMP = 140; My Current Max $MPForMagic = 12
WinWaitActive("FFXiApp"); Wait til FFXI starts AutoItSetOption("SendKeyDelay", 100) AutoItSetOption("SendKeyDownDelay", 50)
Sleep(10000); Gives time to get situated before bot
While 1 == 1 Do Sleep(5500) Send("!1"); Alt+1 is /ma "Barstonra" <me> $MyMP = $MyMP - 12 If $MyMP < $MPForMagic Then ExitLoop EndIf Sleep(5500) Send("!2"); Alt+2 is /ma "Barwatera" <me> $MyMP = $MyMP - 12 If $MyMP < $MPForMagic Then ; ExitLoop EndIf Sleep(5500) Send("!3"); Alt+3 is /ma "Baraera" <me> $MyMP = $MyMP - 12 Until $MyMP < $MPForMagic Send("/heal on") Send("{ENTER}") Do Sleep(105000); Delay for healing $MyMP = 140; Reset MP Variable to Max Until $MyMP = 140 Send("/heal off") Send("{ENTER}") Wend
This works well enough for now but when i lvl up I will have to modify the code...I was wondering if there was any way to retrieve my current and max MP from the game itself using AutoIt of do I need to get FFACT to do that or what? I dont want to have to modify and Tweak the code each time my stats change in-game. And if I do need to use FFACT to get the value how do I do that because I have no experience using that program. Please any help anyone can offer will be greatly appreciated and I thank you in advance if you do help me.
|
|
|
Post by JavaTaru on Jan 12, 2005 5:20:31 GMT -5
Ok i deleted my post, i have now completely remade that bot.
It requires ALOT of user input at the start but in theory the code NEVER needs to be changed.
It Will ask the user to input
1. Their max mp 2. How long it takes them to rest from 0 to full mana 3. The mp cost of their first spell 4. The mp cost of their second spell 5. The cast time of their first spell 6. The cast time of their second spell
The macros needed are
Control 3 /ma "spell1" <me>
Control 4 /ma "spell2" <me>
The bot will alternate these two spells untill out of mana and then rest to full. After this it will continue to do these spells.
Please be aware that i only just started scripting and WILL be using FFACT to grab most of the information asked to the user instead of the clumsy input boxes. When i figure out how to do this i will post the new / better code
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
; JavaTaru's ; basic WHM Skill Up Bot ; Healing & Enchancing ; V 1.0
AutoItSetOption("SendKeyDownDelay",200) AutoItSetOption("SendKeyDelay",50) SetUp() WinWaitActive("FFXiApp") while 1==1 CastSpells() If $Location == "yes" Then MogMP() If $location == "no" Then RestMP() wend
Func RestMP() send("/heal{ENTER}") sleep($mptime) send("/heal{ENTER}") sleep(3000) $mp = $mptotal EndFunc
Func CastSpells() while $mp > $mpcost1 Send("^3") $mp = $mp - $mpcost1 sleep($spelltime) Send("^4") $mp = $mp - $mpcost2 sleep($spelltime2) wend EndFunc
Func SetUp() Global $mp = 78 ;InputBox("Question", "What is your max mana?", "", "", -1, -1, 0, 0) Global $mptime = InputBox("Question", "How Long Does it take you to get to full mp?", "",
"", -1, -1, 0, 0) Global $mpcost1 = InputBox("Question", "How much does your spell in Macro Control3 cost to
cast?", "", "", -1, -1, 0, 0) Global $mpcost2 = InputBox("Question", "How much does your spell in Macro Control4 cost to
cast?", "", "", -1, -1, 0, 0) Global $spelltime = InputBox("Question", "how Long does the spell in macro control3 take
to cast?", "", "", -1, -1, 0, 0) Global $spelltime2 = InputBox("Question", "how Long does the spell in macro control4 take
to cast?", "", "", -1, -1, 0, 0) Global $Location = InputBox("Question", "Are You outside the moghouse?", "", "", -1, -1,
0, 0) Global $spelltime = $spelltime * 1000 Global $spelltime2 = $spelltime2 * 1000 Global $mptime = $mptime * 1000 Global $mptotal = $mp EndFunc
func MogMP() AutoItSetOption("SendKeyDownDelay",5000) AutoItSetOption("SendKeyDelay",5000) send("{NUMPAD8}") AutoItSetOption("SendKeyDownDelay",200) AutoItSetOption("SendKeyDelay",50) sleep(1000) send("{NUMPAD2}") Send("{TAB}") send("{ENTER}") Send("{DOWN}") send("{Enter}") sleep(16000) $mp = $mptotal EndFunc
|
|
|
Post by TinyTerror on Jan 12, 2005 7:15:59 GMT -5
Javataru, looks like you are off to a great start. Alot of people are intimidated by FFACT, and choose to use outdated and cumbersome pixelchecking routines insted. If you have any questions about FFACT just ask. You might also want to take a look at FFXI Helper. Its a FFACT Debug output parser that I wrote. It works fairly well for some of the basic info.
|
|
|
Post by JavaTaru on Jan 12, 2005 13:07:58 GMT -5
thanx tiny i spent a while changing it from 100% procedural to more object orientated... i am aware this isnt an object orientated langage but over use of functions is what i do best lol Anyways are there any examples which show VERY basic FFACT functions??? ive looked on the forums but only find advanced code thankies !!
|
|
|
Post by Duke Newrise on Jan 12, 2005 13:23:32 GMT -5
Right now FFXI Helper has some offset issues with the new FFACT debug menu so things might get confusing. Give me a few days and I'll update it. Keep up the good work!
|
|
|
Post by JavaTaru on Jan 12, 2005 13:31:49 GMT -5
OK code tested and changed please look at it as i am having a probem with the line "Global $mp = 78 ;InputBox("Question", "What is your max mana?", "", "", -1, -1, 0, 0)" As you can see i have commented out the input box and put in 78. The code works perfectly like this , however if i get rid of the 78 and put the input box back the script cannot (for some reason) see that the user has put a value in and treats it as 0. Therefore it skips out the spell casting phase and only heals!!!!! What is wrong with that line of code??? why wont that input box work (when it isnt commented) It was working before and now it isnt!!! argh!!!
|
|
|
Post by TinyTerror on Jan 12, 2005 17:50:09 GMT -5
Heh, I hate to piss on your parrade here, but you might be better off hardcoding the values. It would take just as much time as entering the values through input boxes. I hardcode alot of values in my scripts and they work fine
|
|
|
Post by JavaTaru on Jan 12, 2005 18:31:00 GMT -5
well i may do that, but can you think of a reason why it isnt working???
|
|
|
Post by spiralsigh on Jan 19, 2005 21:38:57 GMT -5
first off im not really sure why it doesnt work... and im sorry for butting in but it seems to me that the part of your script that is self updating is wrong. i just started so tell me if im wrong but at the end of your heal/mog functions it says: [glow=red,2,300]$mp = $mptotal[/glow], but it also has [glow=red,2,300]Global $mptotal = $mp[/glow] and [glow=red,2,300]Global $mp = 78 ;InputBox("Question", "What is your max mana?", "", "", -1, -1, 0, 0)[/glow] unless im quite mistaken this (theoretically)sets mp to the amount inputed by the user, but it also sets the mptotal to the inputed amount, as far as i can tell you dont have a way to get the new amount... the only way to do that (from what i can tell) is using ffact to get the mp value from the game...sorry if im way off the mark here ;D
|
|
|
Post by JavaTaru on Jan 20, 2005 7:18:29 GMT -5
the part of the script which sets $mp is setting a value for mp which will change as spells are cast. the variable $mptotal is a value of the mp which will not change. This is so when $mp is reduced to the critical value and the player has healed it will be set back to full mana again by making $mp equal to $mptotal If anyone wants a script which is fully annotated and you just change in thesource, just ask
|
|
|
Post by spiralsigh on Jan 20, 2005 8:16:24 GMT -5
yeah hey could i have it ? dang im still confused oh well thanx! um could you explain to me how exactly $mp changes? im a n00b and would really appreciate the help wait so the cast spells function changes the mp? but why would it accept that as current mp? why wouldnt it revert back to what was entered at first before healing even starts?
|
|
|
Post by JavaTaru on Jan 21, 2005 20:46:44 GMT -5
; JavaTaru's ; basic WHM Skill Up Bot ; Healing & Enchancing ; V 1.0
;This part of the code is the main body which is run, the main method ;############################## AutoItSetOption("SendKeyDownDelay",200) ;sets the ammount of time the bot holds a key for AutoItSetOption("SendKeyDelay",50) ;sets the ammount of time between key strokes SetUp() ; runs the setup method WinWaitActive("FFXiApp") ; waits for ffxi to become the active window while 1==1 ; while loop , lasts forever as 1 is always 1 CastSpells() ; runs the Castspells method If $Location == "yes" Then MogMP() ;if location is yes , runs MogMP method If $location == "no" Then RestMP() ; if location is no, runs the RestMP method wend ; ends the while loop ;#############################
;this is the method to rest mp if not outside the moghouse ;############################# Func RestMP() ;name of the method send("/heal{ENTER}") ;sends the keys /heal and enter to ffxi (makes the player rest) sleep($mptime) ;Waits the amount of time the user specified it takes to rest to full mana send("/heal{ENTER}") ;sends the keys /heal and enter to ffxi (make the player get up) sleep(3000) ;waits 3 seconds $mp = $mptotal ;sets the players mp value to their full mp EndFunc ;###############################
;this is the method to make the player cast spells ;############################### Func CastSpells() ;name of the method while $mp > $mpcost1 ;while loop which lasts while the users MP is greater than the cost of the first spell Send("^3") ;sends keys control + 3 (macro for first spell) $mp = $mp - $mpcost1 ;subtracts the mp cost of the first spell from the user's mp sleep($spelltime) ;waits for the amount of time that spell takes to cast Send("^4") ;sends key control + 4 (macro for second spell) $mp = $mp - $mpcost2 ;subtracts the mp cost of the second spell from the user's mp sleep($spelltime2) ;waits for the amount of time that spell takes to cast wend ;ends the while loop EndFunc ;###############################
;this is the method which gets all the setup information to get the bot working ;############################### Func SetUp() ;the name of the method Global $mp = 78 ;InputBox("Question", "What is your max mana?", "", "", -1, -1, 0, 0) ;sets a global variable (can be accessed by any part of the program) which is the users maximum mana Global $mptime = InputBox("Question", "How Long Does it take you to get to full mp?", "", "", -1, -1, 0, 0) ;sets a global variable which is the time it takes the user to heal Global $mpcost1 = InputBox("Question", "How much does your spell in Macro Control3 cost to cast?", "", "", -1, -1, 0, 0) ;sets a global variable which is the cost of the first spell Global $mpcost2 = InputBox("Question", "How much does your spell in Macro Control4 cost to cast?", "", "", -1, -1, 0, 0) ;sets a global variable which is the cost of the second spell Global $spelltime = InputBox("Question", "how Long does the spell in macro control3 take to cast?", "", "", -1, -1, 0, 0) ;sets a global variable which is the time it takes the user to cast the first spell Global $spelltime2 = InputBox("Question", "how Long does the spell in macro control4 take to cast?", "", "", -1, -1, 0, 0) ;sets a global variable which is the time it takes the user to cast the second spell Global $Location = InputBox("Question", "Are You outside the moghouse?", "", "", -1, -1, 0, 0) ;sets a global variable which is where the user is Global $spelltime = $spelltime * 1000 ;sets the spelltime variable to be *1000 so that it is formatted from seconds into the time the program uses Global $spelltime2 = $spelltime2 * 1000 ;sets the spelltime2 variable to be *1000 so that it is formatted from seconds into the time the program uses Global $mptime = $mptime * 1000 ;sets the mptime variable to be *1000 so that it is formatted from seconds into the time the program uses Global $mptotal = $mp ;sets the $mptotal variable to be equal to $mp. This is a static variable which will always hold the value of the users full mp. EndFunc ;##################################
;this is the method to led the user regain mana by going into the moghouse ;################################## func MogMP() ;the name of the method AutoItSetOption("SendKeyDownDelay",5000) ;sets the ammount of time the bot holds a key for (changed for movement) AutoItSetOption("SendKeyDelay",5000) ;sets the ammount of time between key strokes (changed for movement) AutoItSetOption("SendKeyDownDelay",200) ;sets the ammount of time the bot holds a key for AutoItSetOption("SendKeyDelay",50) ;sets the ammount of time between key strokes sleep(1000) ;waits 1 second ;moves the user into the moghouse and makes him/her leave once they are in send("{NUMPAD2}") Send("{TAB}") send("{ENTER}") Send("{DOWN}") send("{Enter}") sleep(16000) $mp = $mptotal ;sets the users MP variable back to full EndFunc ;###############################
|
|
|
Post by spiralsigh on Jan 26, 2005 16:27:20 GMT -5
thanks alot this is really helpful!
|
|