larcerkev Posted September 23, 2009 Posted September 23, 2009 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.
Mat Posted September 23, 2009 Posted September 23, 2009 1) GUICtrlCreatePic 2) GUICtrlSetState 3) a) MsgBox _ IniRead _ c) random 4) random Mat AutoIt Project Listing
larcerkev Posted September 23, 2009 Author Posted September 23, 2009 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?
dantay9 Posted September 23, 2009 Posted September 23, 2009 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.
larcerkev Posted September 23, 2009 Author Posted September 23, 2009 (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 September 23, 2009 by larcerkev
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