BuddyBoy Posted November 25, 2007 Share Posted November 25, 2007 (edited) Alright. This should be my last question, sorry to bug you all.I'm trying so hard to make a bot for my friend... I don't play the game and he does, and he keeps begging me to make him one... I know how to do all the coding but ONE part...With my previous problem I cannot have a Func in a Func...Well how can I have 3 separate groups that people can choose from... Whether its a GUI or "Press this button for optionA, Press this button for optionB"...My three "groups" are- Warrior/Trojan, Archer, AND fire...I just can't figure out how to organize them in a GUI or anything... I've been looking around the help file for roughly 30 mins-50 mins now and its getting tiresome lol.Also since I can't have a func in a func... How can I put a stop and start button for the whole program?Sorry I'm asking for so much, I just can't figure it out on my own READ BOTTOM POSTS THANKS Edited November 26, 2007 by BuddyBoy Link to comment Share on other sites More sharing options...
Uten Posted November 25, 2007 Share Posted November 25, 2007 (edited) Functions inside functions are not alowed in AutoIt.. Edited November 25, 2007 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 25, 2007 Author Share Posted November 25, 2007 So then how am I suppose to have F5 as my start button? And to also use the checkboxes? Link to comment Share on other sites More sharing options...
Generator Posted November 25, 2007 Share Posted November 25, 2007 Try.. expandcollapse popup#include <GuiConstants.au3> Opt("GUIOnEventMode",1) HotKeySet("{F5}", "_Start") HotKeySet("{F7}", "_NoClick") HotKeySet("{ESC}","Terminate") HotKeySet("^g", "_GetPos") $ClickIt = 0 Dim $SearchMob GUICreate("Bot", 400, 300) GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate") $Checkbox_1 = GUICtrlCreateCheckbox("Bot", 20, 40, 150, 20) GUISetState() While 1 Sleep( 10 ) WEnd Exit Func _Start () $ClickIt = 1 While $ClickIt = 1 If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then While 1 If $SearchMob Then Attack() Sleep(1000) WEnd Attack() Jump() EndIf WEnd EndFunc ;==>_Start Func _NoClick () ToolTip("") $ClickIt = 0 EndFunc ;==>_NoClick Func Terminate () Exit EndFunc ;==>Terminate Func Jump() $x=Random(0,1024,1) $y=Random(0,690,1) MouseMove($x, $y, 0) Send("{CTRLDOWN}") MouseClick("Left") Send("{CTRLUP}") Sleep(100) EndFunc Func Attack() PixelSearch(0, 0, @DesktopWidth, @DesktopHeight,"0xBD0000", 20) If NOT @error Then MouseClick("left",$Coords[0],$Coords[1],1,0) Else Jump() EndIf EndFunc Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 25, 2007 Author Share Posted November 25, 2007 It opened up fine... But when i selected the checkbox and pressed F5, nothing happened... I'll keep looking at it and pokin around to see if I can find a solution. Link to comment Share on other sites More sharing options...
Nevin Posted November 25, 2007 Share Posted November 25, 2007 I think Autoit should be renamed to The International Video Game Botting and Hacking Language. TIVGBHL (pronounced Tiv-gibble) It rolls off the tongue. Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 25, 2007 Author Share Posted November 25, 2007 Hey it wasn't my idea... It was my best friend... We've been good friends forever, how can I say no... *no I don't want your response lol* Link to comment Share on other sites More sharing options...
Generator Posted November 25, 2007 Share Posted November 25, 2007 (edited) Hey it wasn't my idea... It was my best friend... We've been good friends forever, how can I say no... *no I don't want your response lol*@Nevin If so then shouldn't asm or c++ be the virus language? Pointless post and waste of bandwidth.@BuddyBoy, set an event for the check box, use a bool to moniter if it's checked, and when you press F5, if not then return. Edited November 25, 2007 by Generator Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 25, 2007 Author Share Posted November 25, 2007 But I can't put a function in a function.... I didn't want to make a new post to take up more room... I'm going to start from scratch and all I need is the begining start... Just need a start/stop and how to make 3 groups... You don't have to give me a script (would be appreciated ), but you can just guide me on how to do it. Thanks in advance Ignore all the posts above this one Link to comment Share on other sites More sharing options...
Generator Posted November 26, 2007 Share Posted November 26, 2007 Made an example based on your situation, Fairly easy to understand. expandcollapse popup#include <GUIConstants.au3> Global $Type="Warrior" Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Radio Box Example", 377, 101, 193, 125) $Group1 = GUICtrlCreateGroup("Select Your Action", 8, 8, 361, 49) $Radio1 = GUICtrlCreateRadio("Warrior", 16, 24, 97, 25) $Radio2 = GUICtrlCreateRadio("Trojan/Archer", 120, 24, 129, 25) $Radio3 = GUICtrlCreateRadio("Archer", 256, 24, 113, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Start", 8, 64, 129, 33, 0) $Label1=GUICtrlCreateLabel("Your selection is " & $Type, 144, 64, 220, 28) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetState($Radio1,$GUI_CHECKED) GUICtrlSetOnEvent($Radio1,"_HandleRadio") GUICtrlSetOnEvent($Radio2,"_HandleRadio") GUICtrlSetOnEvent($Radio3,"_HandleRadio") GUICtrLSetOnEvent($Button1,"_Start") GUISetOnEvent($GUI_EVENT_CLOSE,"_Bye") While 1 Sleep(1) WEnd Func _HandleRadio() If @GUI_CtrlId=$Radio1 Then $Type="Warrior" GUICtrlSetData($Label1,"Your selection is " & $Type) ElseIf @GUI_CtrlId=$Radio2 Then $Type="Trojan" GUICtrlSetData($Label1,"Your selection is " & $Type) ElseIf @GUI_CtrlId=$Radio3 Then $Type="Fire" GUICtrlSetData($Label1,"Your selection is " & $Type) EndIf EndFunc Func _Start() GUICtrlSetState($Radio1,$GUI_DISABLE) GUICtrlSetState($Radio2,$GUI_DISABLE) GUICtrlSetState($Radio3,$GUI_DISABLE) GUICtrLSetData($Button1,"Cancel") _Action() EndFunc Func _Action() Switch $Type Case "Warrior" Case "Trojan" Case "Fire" EndSwitch EndFunc Func _Bye() Exit EndFunc Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 26, 2007 Author Share Posted November 26, 2007 (edited) Func _Action() Switch $Type Case "Warrior" Case "Trojan" Case "Fire" EndSwitch EndFunc Is there where I add each line of script for each class? While 1 If $SearchMob Then MobSearch() Sleep(1000) WEnd Func Swap() $SearchMob=NOT $SearchMob If $SearchMob Then GUICtrlSetData($Mess,"<HOME> to switch off") Else GUICtrlSetData($Mess,"<HOME> to switch on") EndIf EndFunc ;==> Swap() Func JumpAround() $xrand=Random(0,1024,1) $yrand=Random(0,690,1) MouseMove($xrand,$yrand,0) Send("{CTRLDOWN}") MouseClick("Left") Send("{CTRLUP}") Sleep(100) EndFunc;==> JumpAround() Func MobSearch() $Coords=PixelSearch(200,100,825,600,12059395,5) If NOT @error Then MouseClick("left",$Coords[0],$Coords[1]+30,1,0) Else JumpAround() EndIf EndFunc ;==> MobSearch() I found this somewhere, and just saved it... can't remember where I had found it at... I just fixed it up a little bit from my previous code... But thats what I PRETTY much want for each class to do... With a lot of modifications, but if I can get that going, I surely can get it working... How can I put all that in, without putting it in an already existing Func? Edited November 26, 2007 by BuddyBoy Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 26, 2007 Author Share Posted November 26, 2007 Sorry to be a noob spammer... I promised I would get this done to my friend ASAP... Could anyone just guide me? I'm not begging you or anything.. But from the code I gave you and the code generator gave... Is there anyway i can put all my code into his? Thanks Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 26, 2007 Author Share Posted November 26, 2007 Has anyone figured out the problem... I keep looking but Uten said I can't have a function in a function, so I'm stumped Link to comment Share on other sites More sharing options...
weaponx Posted November 26, 2007 Share Posted November 26, 2007 You can't declare a function within a function, this isn't allowed in any language i've seen.WRONG:Func doStuff() Func doMoreStuff() EndFuncEndFuncRIGHT:Func doStuff()EndFuncFunc doMoreStuff()EndFunc Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 26, 2007 Author Share Posted November 26, 2007 (edited) expandcollapse popup#include <GUIConstants.au3> Global $Type="Warrior" Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Radio Box Example", 377, 101, 193, 125) $Group1 = GUICtrlCreateGroup("Select Your Action", 8, 8, 361, 49) $Radio1 = GUICtrlCreateRadio("Warrior/Trojan", 16, 24, 97, 25) $Radio2 = GUICtrlCreateRadio("Archer", 120, 24, 129, 25) $Radio3 = GUICtrlCreateRadio("Fire Tao (Nado)", 256, 24, 113, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Start", 8, 64, 129, 33, 0) $Label1=GUICtrlCreateLabel("Your selection is " & $Type, 144, 64, 220, 28) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetState($Radio1,$GUI_CHECKED) GUICtrlSetOnEvent($Radio1,"_HandleRadio") GUICtrlSetOnEvent($Radio2,"_HandleRadio") GUICtrlSetOnEvent($Radio3,"_HandleRadio") GUICtrLSetOnEvent($Button1,"_Start") GUISetOnEvent($GUI_EVENT_CLOSE,"_Bye") Dim $SearchMob=0;I got this declared... ? While 1 Sleep(1) WEnd Func _HandleRadio() If @GUI_CtrlId=$Radio1 Then $Type="Warrior/Trojan" GUICtrlSetData($Label1,"Your selection is " & $Type) Sleep(1000) MsgBox(0, "Ultimate Plvler", "The bot will begin in 15 seconds") Sleep(15000) While 1 If $SearchMob Then Attack() Sleep(1000) Wend ElseIf @GUI_CtrlId=$Radio2 Then $Type="Archer" GUICtrlSetData($Label1,"Your selection is " & $Type) While 1 If $SearchMob Then Attack() Sleep(1000) Wend ElseIf @GUI_CtrlId=$Radio3 Then $Type="Fire" GUICtrlSetData($Label1,"Your selection is " & $Type) While 1 If $SearchMob Then Attack() Sleep(1000) Wend EndIf EndFunc Func Attack() $pixelsearch = Pixelsearch(0, 0, @Desktopwidth, @DesktopHeight, "0xBD0000", 1, 10) If NOT @error Then MouseClick("left",$Coords[0],$Coords[1]+30,1,0) Else Jump() EndIf EndFunc;==> MobSearch() Func Jump() $xrand=Random(0,1024,1) $yrand=Random(0,690,1) MouseMove($xrand,$yrand,0) Send("{CTRLDOWN}") MouseClick("Left") Send("{CTRLUP}") Sleep(100) EndFunc Func _Start() GUICtrlSetState($Radio1,$GUI_DISABLE) GUICtrlSetState($Radio2,$GUI_DISABLE) GUICtrlSetState($Radio3,$GUI_DISABLE) GUICtrLSetData($Button1,"Cancel") _Action() EndFunc Func _Action() Switch $Type Case "Warrior" Case "Trojan" Case "Fire" EndSwitch EndFunc Func _Bye() Exit EndFunc Alright I thought a little... And this is what I got... It runs fine... But once I select a Radio box and press start... nothing happens... It should pop-up that message box, then start the bot shouldn't it? Idk maybe I'm doing something wrong here. At least I gave it a shot. Func _HandleRadio() If @GUI_CtrlId=$Radio1 Then $Type="Warrior/Trojan" GUICtrlSetData($Label1,"Your selection is " & $Type) Sleep(1000) MsgBox(0, "Ultimate Plvler", "The bot will begin in 15 seconds") Sleep(15000) While 1 If $SearchMob Then Attack() Sleep(1000) Wend I just edited this section, and Dim $SearchMob= 0 or whatever at the top.... That section should do in order as I put it shouldn't it? Edited November 26, 2007 by BuddyBoy Link to comment Share on other sites More sharing options...
picaxe Posted November 26, 2007 Share Posted November 26, 2007 Try this to check your radio buttons If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) Then Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 26, 2007 Author Share Posted November 26, 2007 Still didn't work Link to comment Share on other sites More sharing options...
BuddyBoy Posted November 26, 2007 Author Share Posted November 26, 2007 Would an input box be easier? Like they could select warrior or archer or fire and then it goes to that script? Or is radio easier than that? Because i still can't figure out this radio problem 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