Sign in to follow this  
Followers 0
larcerkev

Some GUI questions

5 posts in this topic

Okay to start, i have to create a game, and i chose to do it on the computer. I'm a little familiar with autoit, but have never used a GUI. I plan to use Koda to help me.

How might I do images in the GUI, like where will the image file be store and how to apply it.

How would I make another image appear and disappear on top of the first image.

How would I make a pop up that can extract text from a .ini file under a randomly generated number and display that as a message?

How do you do a random number generation?

P.S. This is a board game I'm trying to make, where there are flash card questions that will be randomly picked.

Share this post


Link to post
Share on other sites



Rather vague. right now im wondering how i would use the second command to make an image appear and disappear acording to a changing number, and how would i make text show up in a gui that would constantly update?

Share this post


Link to post
Share on other sites

The reason it was vague was so you would take a little bit of time and look up these functions in the help file. Mat answered every one of your questions correctly. It is your job to find out how they fit together and construct a script. Post the script that isn't working next time you have a problem.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Okay, well i have figure pretty much everything out up to the point where i want the value $playeronescore to update on the gui as it chages, whats wrong with this

EDIT: nevermind, i managed to fix it. =]

#include <GUIConstants.au3>
Opt("GUICloseOnESC", 1)
$Player = 1
$playeronescore = 100
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Game", 766, 604)
$Pic1 = GUICtrlCreatePic(@scriptDir & "\Images\Board.jpg",0,25,766,579); this is the game board background
$Label1 = GUICtrlCreateLabel("Player One:" & $Playeronescore, 100,0)
$Button1= GUICtrlCreateButton("Roll Dice", 0, 0, 81, 25, 0)
GUICtrlSetOnEvent($Button1, "OnButton1")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $message = GUIGetMsg()
    
    If $message = $button1 Then
        OnButton1()
    EndIf
WEnd

Func OnButton1()
    $diceroll = Random(1,6,1)
    MsgBox(0, "You clicked on", "Rolled a " & $diceroll)
    $Playeronescore+=1
    GUICtrlSetData($label1, "Player one:" & $playeronescore)
    
EndFunc
Edited by larcerkev

Share this post


Link to post
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
Sign in to follow this  
Followers 0