Jump to content

gui setup


 Share

Recommended Posts

Im trying to set this up, i am trying to add a bunch of flash games together and be able to choose then from a combo box... but for each game i want it to do something else.. i can figure out how to check if the game is a game do this...

but there may be alot to choose from... bascially does anyone have any ideas how to set up what im looking for in a nice easy way?

here is some code:

;###/"Includes and Options"\###
#include <GuiConstants.au3>
Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)

;###/"Choose Game - Gui"\###

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Multi-Flash Bot", 290, 90,(@DesktopWidth-290)/2, (@DesktopHeight-90)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Group_1 = GuiCtrlCreateGroup("Choose a Game from List", 10, 10, 270, 70)
$Combo = GuiCtrlCreateCombo("Games", 30, 40, 140, 21)
    GUICtrlSetData($Combo,"ReBound")
    GUICtrlSetData($Combo,"Clickage")
$BotButton = GuiCtrlCreateButton("Bot!", 190, 30, 70, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit
Link to comment
Share on other sites

Im trying to set this up, i am trying to add a bunch of flash games together and be able to choose then from a combo box... but for each game i want it to do something else.. i can figure out how to check if the game is a game do this...

but there may be alot to choose from... bascially does anyone have any ideas how to set up what im looking for in a nice easy way?

Your question is unclear... are you looking for something like this in your While loop?

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $BotButton
        If GuiCtrlRead($combo) = "ReBound" Then MsgBox(48,"Debug","You chose ReBound")
        If GuiCtrlRead($combo) = "Clickage" Then MsgBox(48,"Debug","You chose Clickage")
    Case Else
        ;;;
    EndSelect
WEnd

If you could clarify your question I could post a better answer.

Regards,

Link to comment
Share on other sites

lol thanks... im not sure what i was looking for.. sorry that will work perfect :D

[EDIT]

For some reason my script wont open the second GUI Window after i selected a game... any ideas?

#include <GuiConstants.au3>
Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)

;###/"Choose Game - Gui"\###

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

$ChooseGame = GuiCreate("Multi-Flash Bot", 290, 90,(@DesktopWidth-290)/2, (@DesktopHeight-90)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Group_1 = GuiCtrlCreateGroup("Choose a Game from List", 10, 10, 270, 70)
$Combo = GuiCtrlCreateCombo("Games", 30, 40, 140, 21)
    GUICtrlSetData($Combo,"ReBound")
    GUICtrlSetData($Combo,"Clickage")
$BotButton = GuiCtrlCreateButton("Bot!", 190, 30, 70, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $BotButton
        If GuiCtrlRead($combo) = "ReBound" Then 
            $Game = "ReBound"
            GUIDelete($ChooseGame)
        EndIf
        If GuiCtrlRead($combo) = "Clickage" Then 
            $Game = "Clickage"
            GUIDelete($ChooseGame)
        EndIf
    Case Else
        
    EndSelect
WEnd

$oGame = ObjCreate ("ShockwaveFlash.ShockwaveFlash.1")
$FlashGui = GUICtrlCreateObj($oGame, 10, 10, 630, 440)
$MainGui = GuiCreate("MyGUI", 650, 500,(@DesktopWidth-650)/2, (@DesktopHeight-500)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$ChangeGame = GuiCtrlCreateButton("Change Game", 10, 460, 90, 30)
$Exit = GuiCtrlCreateButton("Exit", 120, 460, 90, 30)

;###/"Bot Function"\###
If $Game = "ReBound" then 
    With $oGame
        .bgcolor = "#000000"
        .Movie = 'http://farm.addictinggames.com/D78AQSAKQLQWI9/2898.swf'
        .ScaleMode = 2
        .Loop = True
        .wmode = "Opaque"
    EndWith
EndIf
If $Game = "Clickage" Then
    With $oGame
        .bgcolor = "#000000"
        .Movie = 'http://farm.addictinggames.com/D78AQSAKQLQWI9/2898.swf'
        .ScaleMode = 2
        .Loop = True
        .wmode = "Opaque"
    EndWith
EndIf

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit
Edited by lopolop
Link to comment
Share on other sites

For some reason my script wont open the second GUI Window after i selected a game... any ideas

I changed a few things.. This works for me:

#include <GuiConstants.au3>
Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)

;###/"Choose Game - Gui"\###

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

$ChooseGame = GuiCreate("Multi-Flash Bot", 290, 90,(@DesktopWidth-290)/2, (@DesktopHeight-90)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Group_1 = GuiCtrlCreateGroup("Choose a Game from List", 10, 10, 270, 70)
$Combo = GuiCtrlCreateCombo("Games", 30, 40, 140, 21)
    GUICtrlSetData($Combo,"ReBound")
    GUICtrlSetData($Combo,"Clickage")
$BotButton = GuiCtrlCreateButton("Bot!", 190, 30, 70, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $BotButton
        If GuiCtrlRead($combo) = "ReBound" Then
            $Game = "ReBound"
            ExitLoop
        EndIf
        If GuiCtrlRead($combo) = "Clickage" Then
            $Game = "Clickage"
            ExitLoop
        EndIf
    Case Else
       
    EndSelect
WEnd
GUIDelete($ChooseGame)


$MainGui = GuiCreate("MyGUI", 650, 500,(@DesktopWidth-650)/2, (@DesktopHeight-500)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$oGame = ObjCreate ("ShockwaveFlash.ShockwaveFlash.1")
$FlashGui = GUICtrlCreateObj($oGame, 10, 10, 630, 440)
$ChangeGame = GuiCtrlCreateButton("Change Game", 10, 460, 90, 30)
$Exit = GuiCtrlCreateButton("Exit", 120, 460, 90, 30)


;###/"Bot Function"\###
If $Game = "ReBound" then
    With $oGame
        .bgcolor = "#000000"
        .Movie = 'http://farm.addictinggames.com/D78AQSAKQLQWI9/2898.swf'
        .ScaleMode = 2
        .Loop = True
        .wmode = "Opaque"
    EndWith
EndIf
If $Game = "Clickage" Then
    With $oGame
        .bgcolor = "#000000"
        .Movie = 'http://farm.addictinggames.com/D78AQSAKQLQWI9/2898.swf'
        .ScaleMode = 2
        .Loop = True
        .wmode = "Opaque"
    EndWith
EndIf

GuiSetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Regards,

Link to comment
Share on other sites

That worked thanks...

im having some trouble though... i cant seem to find a way to setup so that i figure out which game is choosen then run that script. this sounds simple.. probably is :D any help would be great..

Link to comment
Share on other sites

That worked thanks...

im having some trouble though... i cant seem to find a way to setup so that i figure out which game is choosen then run that script. this sounds simple.. probably is :D any help would be great..

I don't understand your question... $game is set to the chosen game. you probably aren't seeing any difference in the two choices because with each object,
.Movie = 'http://farm.addictinggames.com/D78AQSAKQLQWI9/2898.swf'
points to the same movie file.

Regards,

Link to comment
Share on other sites

no i fixed that.. i woundering how i should set up the next part, after it loades the game... i want a hotkey like ` and when pressed runs a bot function, but how do i set it up so the ` works for the second game(choosen) and not the first... If you still dont under ill explain it better

Edited by lopolop
Link to comment
Share on other sites

no i fixed that.. i woundering how i should set up the next part, after it loades the game... i want a hotkey like ` and when pressed runs a bot function, but how do i set it up so the ` works for the second game(choosen) and not the first... If you still dont under ill explain it better

Case $msg = $BotButton
        If GuiCtrlRead($combo) = "ReBound" Then
            $Game = "ReBound"
            HotKeySet("{SPACE}", "_Game1Func")
            ExitLoop
        EndIf
        If GuiCtrlRead($combo) = "Clickage" Then
            $Game = "Clickage"
            HotKeySet("{SPACE}", "_Game2Func")
            ExitLoop

Change the hotkey to whatever is desired.

Regards,

Link to comment
Share on other sites

OK.. One final question, and i do think i learned alot about gui.. and thanks to everyone that helped...

My last question is i want a change game button... which goes back to the first gui. i was thinking of putting my whole script in a loop but that gave me errors saying that some things i didnt have WEnd at the end, so is there something else i can do?

Link to comment
Share on other sites

OK.. One final question, and i do think i learned alot about gui.. and thanks to everyone that helped...

My last question is i want a change game button... which goes back to the first gui. i was thinking of putting my whole script in a loop but that gave me errors saying that some things i didnt have WEnd at the end, so is there something else i can do?

This is one way of doing it, although there may be other ways:

#include <GuiConstants.au3>
Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)

;###/"Choose Game - Gui"\###

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

$ChooseGame = GuiCreate("Multi-Flash Bot", 290, 90,(@DesktopWidth-290)/2, (@DesktopHeight-90)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Group_1 = GuiCtrlCreateGroup("Choose a Game from List", 10, 10, 270, 70)
$Combo = GuiCtrlCreateCombo("Games", 30, 40, 140, 21)
    GUICtrlSetData($Combo,"ReBound")
    GUICtrlSetData($Combo,"Clickage")
$BotButton = GuiCtrlCreateButton("Bot!", 190, 30, 70, 40)

GuiSetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $BotButton
        If GuiCtrlRead($combo) = "ReBound" Then
            GuiSetState(@SW_HIDE, $ChooseGame)
            $Game = "ReBound"
            _GameGUI($game)         
            GuiSetState(@SW_SHOW, $ChooseGame)
        EndIf
        If GuiCtrlRead($combo) = "Clickage" Then
            GuiSetState(@SW_HIDE, $ChooseGame)
            $Game = "Clickage"
            _GameGUI($game) 
            GuiSetState(@SW_SHOW, $ChooseGame)
        EndIf
    Case Else
       
    EndSelect
WEnd

Func _GameGUI($game)
    $MainGui = GuiCreate("MyGUI", 650, 500,(@DesktopWidth-650)/2, (@DesktopHeight-500)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
    $oGame = ObjCreate ("ShockwaveFlash.ShockwaveFlash.1")
    $FlashGui = GUICtrlCreateObj($oGame, 10, 10, 630, 440)
    $ChangeGame = GuiCtrlCreateButton("Change Game", 10, 460, 90, 30)
    $Exit = GuiCtrlCreateButton("Exit", 120, 460, 90, 30)
    ;###/"Bot Function"\###
    If $Game = "ReBound" then
        With $oGame
            .bgcolor = "#000000"
            .Movie = 'http://farm.addictinggames.com/D78AQSAKQLQWI9/2898.swf'
            .ScaleMode = 2
            .Loop = True
            .wmode = "Opaque"
        EndWith
    EndIf
    If $Game = "Clickage" Then
        With $oGame
            .bgcolor = "#000000"
            .Movie = 'http://farm.addictinggames.com/D78AQSAKQLQWI9/2898.swf'
            .ScaleMode = 2
            .Loop = True
            .wmode = "Opaque"
        EndWith
    EndIf
    GuiSetState(@SW_SHOW, $MainGUI)
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                GUIDelete($MainGUI)
                Return
            Case $msg = $Exit
                GUIDelete($MainGUI)
                Return
        EndSelect
    WEnd
EndFunc

I separated the game gui into its own function. The $choosegame Gui calls the _GameGUI Function with $game as an argument.

I think this approach may prove more useful, given the nature of your program. For example, you could modify the function like

Func _GameGUI($game, $gameURL="")
so that the user could enter the URL of a custom flash game, should they desire. For more information on functions, consult the helpfile.

I hope this helps. :D

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