Jump to content

Recommended Posts

Posted

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.

Posted

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?

Posted

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.

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...