a little background:
While trying to create a "MiniGame" of card memorization, i tried asking the player to select 3 cards in which later on he will have to remember.
i already managed counting the first three clicks and having boxes showing each click as "First/Second/Third Card = "
but i failed to store any value/string of the clicked item(picture = card) into variables.
i have seen something that might solve this using GuiControlGet but it always had errors when i tried running the code again.
the question:
how could i assign variables(for example a,b,c) to get the name(or value, rather) of the clicked card(represented by a picture)?
my code so far:
Code: Select all
#SingleInstance, Force
msgbox, Welcome To Memory!
;Gui Layout
;-----------------
Gui, Font, cAqua
Gui, Show, x600 y50 w700 h700, Memory
Gui, Color, Blue
Gui, Add, Text,cRed x10 y50, Instructions:
Gui, Add, Text, x10 y+7, Pick Three Cards
;Clubs
;----------------------
Gui, Add, Picture, x10 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\2_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\3_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\4_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\5_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\6_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\7_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\8_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\9_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\10_of_clubs.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\jack_of_clubs2.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\queen_of_clubs2.png
Gui, Add, Picture, x+5 y105 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\king_of_clubs2.png
;Diamonds
;----------------------
Gui, Add, Picture, x10 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\2_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\3_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\4_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\5_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\6_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\7_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\8_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\9_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\10_of_diamonds.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\jack_of_diamonds2.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\queen_of_diamonds2.png
Gui, Add, Picture, x+5 y210 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\king_of_diamonds2.png
;Hearts
;----------------------
Gui, Add, Picture, x10 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\2_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\3_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\4_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\5_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\6_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\7_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\8_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\9_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\10_of_hearts.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\jack_of_hearts2.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\queen_of_hearts2.png
Gui, Add, Picture, x+5 y315 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\king_of_hearts2.png
;Spades
;----------------------
Gui, Add, Picture, x10 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\2_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\3_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\4_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\5_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\6_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\7_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\8_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\9_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\10_of_spades.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\jack_of_spades2.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\queen_of_spades2.png
Gui, Add, Picture, x+5 y420 w50 h100 gPick, C:\Users\yawik\Desktop\AHK\test game\Memory\Playing Cards\king_of_spades2.png
Gui, Add, Picture, x0 y0 w700 h700, C:\Users\yawik\Desktop\AHK\test game\Memory\Memory.jpg
return
;Labels
;------------------
Pick:
counter++
if (counter = 1)
{
a := gPick ;first pick
GuiControlGet, a [, Picture, a, ]
msgbox, First Card = %a%
return
}
else if (counter = 2)
{
b := gPick ;second pick
msgbox, Second Card = %b%
return
}
else if (counter = 3)
{
c := gPick ;third pick
msgbox, Third Card = %c%
return
}
GuiClose:
ExitApp
return
;Functions
;------------------
;Hotkeys
;------------------
return
Esc::ExitApp
thanks in advance!
yawik