Jump to content

2 gui in 1


Recommended Posts

okay like the title say i want first 1 gui to be showed when i click a button and then if i close the other gui then i could open it agian if i am needing to but the problem when i try open it 2 time it exit and come with this error "Global Const $ES_LEFT = 0

Global Const ^ ERROR"

my script

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
hotkeyset ("{f1}","auto_attack")
hotkeyset ("{f2}","auto_loot")
HotKeySet ("{f3}","auto_pot")

$100=0
$attackcount=0
$attackOn=0
$looton=0
$left=3
start()
global $form2,$form1
func start()

#Region ### START Koda GUI section ### Form=c:\documents and settings\lo\skrivebord\unlimted attack\form2.kxf
$Form2 = GUICreate("i dont know", 384, 210, 270, 201)
GUISetBkColor(0xA0A0A4)
$Radio1 = GUICtrlCreateRadio("Attacking left", 16, 24, 113, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Radio2 = GUICtrlCreateRadio("Attacking right", 16, 56, 113, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Group1 = GUICtrlCreateGroup("Hotkeys", 272, 16, 105, 177)
$Label2 = GUICtrlCreateLabel("Auto Attack ~ F1", 280, 40, 85, 17)
$Label3 = GUICtrlCreateLabel("Auto Loot ~F2", 280, 72, 72, 17)
$Label1 = GUICtrlCreateLabel("Auto Pot ~ F3", 280, 104, 93, 17)
$DelayQuestion= guictrlcreateinput("0",16,120,70,20)
$option=guictrlcreatebutton("Auto pot options!",10,150,100,20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $option 
            _options()
EndSwitch
$d1=guictrlread($DelayQuestion)
$r1=guictrlread($radio1)
$r2=guictrlread($radio2)
if $r1=$GUI_CHECKED Then
    $left=1
EndIf
if $r1=$GUI_UNCHECKED Then
    $left=0
EndIf
if $r2=$GUI_CHECKED Then
    $left=0
EndIf
if $r2=$GUI_UNCHECKED Then
    $left=1
EndIf
if $attackon=1 Then
    controlsend ("[CLASS:MapleStoryClass]","","","{LCTRL}")
    if $lootOn=1 then 
    controlsend ("[CLASS:MapleStoryClass]","","","{z}")

EndIf
sleep (200)

    $attackcount=$attackcount+1
EndIf
if $lootOn=1 Then
    controlsend ("[CLASS:MapleStoryClass]","","","{z}")
EndIf
if $attackcount=300 Then
    if $attackcount =1 then
    $attackon=0
EndIf
if $lootOn=1 then
    $lootOn=0
EndIf

if $left=0 Then
    WinActivate ("[CLASS:MapleStoryClass]","")
    send ("{left}")
        sleep (1)
    send ("{left}")
        sleep (1)
    send ("{left}")
    sleep (1)
    send ("{left}")
    sleep (10)
    send ("{right}")
        sleep (1)
    send ("{right}")
        sleep (1)
    send ("{right}")
        sleep (1)
    send ("{right}")
    
    EndIf
    if $left=1 then 
        WinActivate ("[CLASS:MapleStoryClass]","")
    send ("{right}")
sleep (1)
    send ("{right}")
sleep (1)         
    send ("{right}")
sleep (1)         
    send ("{right}")
sleep (10000)     
    send ("{Left}")
sleep (1)         
    send ("{Left}")
sleep (1)        
    send ("{Left}")
sleep (1)
    send ("{Left}")
EndIf
EndIf

WEnd
endfunc
func auto_attack ()
    $attackcount=0
    if $attackOn=0 then
    $attackOn=1

elseif $attackon=1 Then
    $attackon=0 
EndIf

EndFunc
func auto_loot ()
    $attackcount=0
    if $lootOn=0 Then
    $lootOn=1
elseif $lootOn=1 Then
    $lootOn=0 
EndIf

EndFunc
func auto_pot()

EndFunc

func _options()
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 340, 259, 183, 125)
GUISetBkColor(0xA0A0A4)
$Mpquestion = GUICtrlCreateInput("10", 16, 48, 49, 21)
$Labe1 = GUICtrlCreateLabel("How mutch mp each attack cost", 16, 24, 170, 17)
$Labe2 = GUICtrlCreateLabel("set how mutch mp each pot give", 16, 88, 170, 17)
$costquestion = GUICtrlCreateInput("100", 16, 112, 49, 21)
$recoverytime = GUICtrlCreateInput("60", 16, 168, 49, 21)
$Labe3 = GUICtrlCreateLabel("set how mutch mp you recover each time you recover some HP/MP", 16, 144, 170, 17)
$pots = GUICtrlCreateInput("0", 16, 224, 49, 21)
$Labe4 = GUICtrlCreateLabel("set how many pots you have of that kind there gives you  Hp/mp", 16, 200, 330, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

do
$nMsg = GUIGetMsg()
Switch $nMsg


    case $Labe3
        sleep (100)
    EndSwitch
$rmpq=guictrlread($Mpquestion)
$rcost=guictrlread($costquestion)
$rrec=guictrlread($recoverytime)
$rpots=guictrlread ($pots)
guictrlsetdata($labe4,"set how many pots you have of that kind there gives you "&$rcost&" Hp/mp")
sleep (100)

until $nmsg= $GUI_EVENT_CLOSE
GUIDelete()
EndFunc
Link to comment
Share on other sites

  • Moderators

TheOnlyOne,

The error occurs because you have includes in your function and so you are trying to reinclude them each time you call it. Hence the error as you cannot redeclare a constant. You only need to add standard includes once - and at the beginning is best. So remove the #include lines at the beginning of Func _options - although you may need to add EditConstants.au3 to the list at the beginning if you use it in your code.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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