Jump to content

Newbie Gui Creator


Recommended Posts

I very much would like to create my own Dungeons and Dragons Character Sheet using the Au3 Gui. I started making one, copy and pasting and a lil editing to make it the way i want. So far so good, but i need some help with things like knowing if i can get the progress bar to update while the Gui is running.

i want to add a number to an existing variable and have it read that number out in a tab and show progress on the progress bar... maybe if you check it out it'll make more sense, cuz i dont think my talking does.

; Script Start - Add your code below here
#include <GuiConstants.au3>

; GUI
GuiCreate("Dungeons & Dragons", 400, 400)





$totalexp = 0
$needexp = 1000
$exptotal = $totalexp/$needexp*100



If $totalexp > -1 OR $totalexp < 1000 Then
$level = 1
EndIf
GuiGetMsg(



; TAB
GuiCtrlCreateTab(0, 0, 400, 390)
GuiCtrlCreateTabItem("Page One")
GuiCtrlCreateLabel("Level: " & $level,5,55)
GuiCtrlCreateInput("Name Here", 5, 25, 130, 20)

GuiCtrlCreateTabItem("Page Two")
GuiCtrlCreateLabel("Exp: " & $totalexp & "/" & $needexp  ,5,25)
GuiCtrlCreateProgress(5, 45, 300, 20)
GuiCtrlSetData(-1, $exptotal)
$addexp = GuiCtrlCreateInput("Add Exp", 310, 45, 50, 20)
$addok = GuiCtrlCreateButton("+", 370, 45, 20, 20)

GuiCtrlCreateTabItem("Skills")
GuiCtrlCreateLabel("Skills",5,25)
GuiCtrlCreatecombo("Sample Combo", 250, 80, 120, 100)


GuiCtrlCreateTabItem("Spells")
GuiCtrlCreateLabel("Spells",5,25)

$treeOne = GuiCtrlCreateTreeView(5, 50, 200, 390)
$treeItem = GuiCtrlCreateTreeViewItem("Spells", $treeOne)
$abjuration = GuiCtrlCreateTreeViewItem("Abjuration", $treeItem)
$conjuration = GuiCtrlCreateTreeViewItem("Conjuration", $treeItem)
$SM1 = GuiCtrlCreateTreeViewItem("Summon Monster I", $conjuration)
$SM2 = GuiCtrlCreateTreeViewItem("Summon Monster II", $conjuration)

GuiCtrlSetState($treeone, $GUI_EXPAND)
$spellname = GuiCtrlRead("15")
GuiCtrlCreateLabel( $spellname & $treeone, 210, 50 )

Global $defaultstatus = "Ready"
Global $status


$filemenu = GUICtrlCreateMenu ("&File")
$fileitem = GUICtrlCreateMenuitem ("Open",$filemenu)
GUICtrlSetState(-1,$GUI_DEFBUTTON)
$helpmenu = GUICtrlCreateMenu ("Help")
$saveitem = GUICtrlCreateMenuitem ("Save",$filemenu)
GUICtrlSetState(-1,$GUI_ENABLE)
$infoitem = GUICtrlCreateMenuitem ("Info",$helpmenu)
$exititem = GUICtrlCreateMenuitem ("Exit",$filemenu)
$recentfilesmenu = GUICtrlCreateMenu ("Recent Files",$filemenu,1)
GUICtrlSetState(-1,$GUI_CHECKED)
GUICtrlSetState(-1,$GUI_FOCUS)


GUISetState ()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $fileitem Then
        $file = FileOpenDialog("Choose file...",@AppDataDir,"All (*.*)")
        If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentfilesmenu)
    EndIf 
    If $msg = $addok Then
        $totalexp = $totalexp+$addexp
    EndIf
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop
    If $msg = $infoitem Then Msgbox(0,"Info","Only a test...")
WEnd
GUIDelete()

Thank you for checking it out and it's not done yet, this is from 2 hours of playing around.

Link to comment
Share on other sites

Look at this. Maybe it will help you out.

; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>

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

GuiCreate("MyGUI", 392, 323,(@DesktopWidth-392)/2, (@DesktopHeight-323)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Progress_1 = GuiCtrlCreateProgress(50, 190, 310, 50)
$Button_2 = GuiCtrlCreateButton("Button2", 110, 110, 190, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_2
        dim $Num
        $Num = $Num + 10
        GUICtrlSetData($Progress_1,$Num)
            
    ;;;
    EndSelect
WEnd
Exit

P.S. I been wanting to make a text RPG in autoit3. Would you be interested in joining?

.

Link to comment
Share on other sites

I went back and did some editing to your scripts. I change add exp to set exp. I would have did it for add but it is late and I don't do figuring that well when it is late. So take a look, marked the areas I change with ;;;;;;;;;;;;;;;;;;;;;;;;

; Script Start - Add your code below here
#include <GuiConstants.au3>

; GUI
GuiCreate("Dungeons & Dragons", 400, 400)





$totalexp = 0
$needexp = 1000
$exptotal = $totalexp/$needexp*100



If $totalexp > -1 OR $totalexp < 1000 Then
$level = 1
EndIf
GuiGetMsg()



; TAB
GuiCtrlCreateTab(0, 0, 400, 390)
GuiCtrlCreateTabItem("Page One")
GuiCtrlCreateLabel("Level: " & $level,5,55)
GuiCtrlCreateInput("Name Here", 5, 25, 130, 20)

GuiCtrlCreateTabItem("Page Two")
GuiCtrlCreateLabel("Exp: " & $totalexp & "/" & $needexp  ,5,25)
$ExpBar = GuiCtrlCreateProgress(5, 45, 300, 20)
GuiCtrlSetData(-1, $exptotal)
;;;;;;;;;;;;;;;;;;;;
$Setexp = GuiCtrlCreateInput("Set Exp", 310, 45, 50, 20)
$Setok = GuiCtrlCreateButton("Set", 370, 45, 20, 20)
$ExpBar = GuiCtrlCreateProgress(5, 45, 300, 20)
;;;;;;;;;;;;;;
GuiCtrlCreateTabItem("Skills")
GuiCtrlCreateLabel("Skills",5,25)
GuiCtrlCreatecombo("Sample Combo", 250, 80, 120, 100)


GuiCtrlCreateTabItem("Spells")
GuiCtrlCreateLabel("Spells",5,25)

$treeOne = GuiCtrlCreateTreeView(5, 50, 200, 390)
$treeItem = GuiCtrlCreateTreeViewItem("Spells", $treeOne)
$abjuration = GuiCtrlCreateTreeViewItem("Abjuration", $treeItem)
$conjuration = GuiCtrlCreateTreeViewItem("Conjuration", $treeItem)
$SM1 = GuiCtrlCreateTreeViewItem("Summon Monster I", $conjuration)
$SM2 = GuiCtrlCreateTreeViewItem("Summon Monster II", $conjuration)

GuiCtrlSetState($treeone, $GUI_EXPAND)
$spellname = GuiCtrlRead("15")
GuiCtrlCreateLabel( $spellname & $treeone, 210, 50 )

Global $defaultstatus = "Ready"
Global $status


$filemenu = GUICtrlCreateMenu ("&File")
$fileitem = GUICtrlCreateMenuitem ("Open",$filemenu)
GUICtrlSetState(-1,$GUI_DEFBUTTON)
$helpmenu = GUICtrlCreateMenu ("Help")
$saveitem = GUICtrlCreateMenuitem ("Save",$filemenu)
GUICtrlSetState(-1,$GUI_ENABLE)
$infoitem = GUICtrlCreateMenuitem ("Info",$helpmenu)
$exititem = GUICtrlCreateMenuitem ("Exit",$filemenu)
$recentfilesmenu = GUICtrlCreateMenu ("Recent Files",$filemenu,1)
GUICtrlSetState(-1,$GUI_CHECKED)
GUICtrlSetState(-1,$GUI_FOCUS)


GUISetState ()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $fileitem Then
        $file = FileOpenDialog("Choose file...",@AppDataDir,"All (*.*)")
        If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentfilesmenu)
        EndIf 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;        
    If $msg = $Setok Then
        Dim $a
        $a = guictrlread($Setexp) * .1
        guictrlsetdata($ExpBar,$a)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;      
    EndIf
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop
    If $msg = $infoitem Then Msgbox(0,"Info","Only a test...")
WEnd
GUIDelete()

.

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