|
Post by zenkrye on Mar 26, 2020 18:42:29 GMT
I am trying to dynamically click on an image. I have a dialog to set the deficulty and instead of doing an if then else against all of the option I was wondering if I could build out the image dynamically.
My current image table:
Diff = { Dif1 ={ P = Pattern("Dif1.png"), R = Region(266, 549, 80, 80), }, Dif2 ={ P = Pattern("Dif2.png"), R = Region(269, 834, 80, 80), }, Dif3 ={ P = Pattern("Dif3.png"), R = Region(266, 1072, 80, 80), }, }
dialogInit()
addTextView(" Difficulty: ") difficulty = {'Easy, "Normal", "Hard"} addSpinnerIndex("spDifficulty", difficulty, 3) newRow() dialogShow()
Image:R("Diff.Dif" .. spDifficulty .. ".R"):existsClick("Diff.Dif" .. spDifficulty .. ".R")
I am getting an error when I try this. Am I way off with what I am trying to do?
|
|
|
Post by Exilereven on Mar 26, 2020 21:21:55 GMT
I am trying to dynamically click on an image. I have a dialog to set the deficulty and instead of doing an if then else against all of the option I was wondering if I could build out the image dynamically. My current image table: Diff = { Dif1 ={ P = Pattern("Dif1.png"), R = Region(266, 549, 80, 80), }, Dif2 ={ P = Pattern("Dif2.png"), R = Region(269, 834, 80, 80), }, Dif3 ={ P = Pattern("Dif3.png"), R = Region(266, 1072, 80, 80), }, }
dialogInit()
addTextView(" Difficulty: ") difficulty = {'Easy, "Normal", "Hard"} addSpinnerIndex("spDifficulty", difficulty, 3) newRow() dialogShow()
Image:R("Diff.Dif" .. spDifficulty .. ".R"):existsClick("Diff.Dif" .. spDifficulty .. ".R") I am getting an error when I try this. Am I way off with what I am trying to do? Not sure what your going for but I fixed a couple syntax errors this atleast runs. Rest up to you . --My current image table: Diff = { Dif1 ={ P = Pattern("Dif1.png"), R = Region(266, 549, 80, 80), }, Dif2 ={ P = Pattern("Dif2.png"), R = Region(269, 834, 80, 80), }, Dif3 ={ P = Pattern("Dif3.png"), R = Region(266, 1072, 80, 80), }, } dialogInit() addTextView(" Difficulty: ") local difficulty = {'Easy', 'Normal', 'Hard'} addSpinnerIndex("spDifficulty", difficulty, difficulty[3]) newRow() dialogShow() Image:R("Diff.Dif1" .. spDifficulty .. ".R"):existsClick("Diff.Dif1" .. spDifficulty .. ".R")
|
|
|
Post by AnkuLua on Mar 27, 2020 0:02:35 GMT
I am trying to dynamically click on an image. I have a dialog to set the deficulty and instead of doing an if then else against all of the option I was wondering if I could build out the image dynamically. My current image table: Diff = { Dif1 ={ P = Pattern("Dif1.png"), R = Region(266, 549, 80, 80), }, Dif2 ={ P = Pattern("Dif2.png"), R = Region(269, 834, 80, 80), }, Dif3 ={ P = Pattern("Dif3.png"), R = Region(266, 1072, 80, 80), }, }
dialogInit()
addTextView(" Difficulty: ") difficulty = {'Easy, "Normal", "Hard"} addSpinnerIndex("spDifficulty", difficulty, 3) newRow() dialogShow()
Image:R("Diff.Dif" .. spDifficulty .. ".R"):existsClick("Diff.Dif" .. spDifficulty .. ".R") I am getting an error when I try this. Am I way off with what I am trying to do? Try this Diff = { { P = Pattern("Dif1.png"), R = Region(266, 549, 80, 80), }, { P = Pattern("Dif2.png"), R = Region(269, 834, 80, 80), }, { P = Pattern("Dif3.png"), R = Region(266, 1072, 80, 80), }, }
dialogInit()
addTextView(" Difficulty: ") difficulty = {'Easy, "Normal", "Hard"} addSpinnerIndex("spDifficulty", difficulty, 3) newRow() dialogShow()
Diff[spDifficulty].R:existsClick(Diff[spDifficulty].P)
|
|
|
Post by Exilereven on Mar 27, 2020 2:48:41 GMT
I am trying to dynamically click on an image. I have a dialog to set the deficulty and instead of doing an if then else against all of the option I was wondering if I could build out the image dynamically. My current image table: Diff = { Dif1 ={ P = Pattern("Dif1.png"), R = Region(266, 549, 80, 80), }, Dif2 ={ P = Pattern("Dif2.png"), R = Region(269, 834, 80, 80), }, Dif3 ={ P = Pattern("Dif3.png"), R = Region(266, 1072, 80, 80), }, }
dialogInit()
addTextView(" Difficulty: ") difficulty = {'Easy, "Normal", "Hard"} addSpinnerIndex("spDifficulty", difficulty, 3) newRow() dialogShow()
Image:R("Diff.Dif" .. spDifficulty .. ".R"):existsClick("Diff.Dif" .. spDifficulty .. ".R") I am getting an error when I try this. Am I way off with what I am trying to do? Try this Diff = { { P = Pattern("Dif1.png"), R = Region(266, 549, 80, 80), }, { P = Pattern("Dif2.png"), R = Region(269, 834, 80, 80), }, { P = Pattern("Dif3.png"), R = Region(266, 1072, 80, 80), }, }
dialogInit()
addTextView(" Difficulty: ") difficulty = {'Easy, "Normal", "Hard"} addSpinnerIndex("spDifficulty", difficulty, 3) newRow() dialogShow()
Diff[spDifficulty].R:existsClick(Diff[spDifficulty].P) I think the 3, needs to be [3], in the spinnerIndex
|
|
|
Post by zenkrye on Mar 27, 2020 11:08:26 GMT
I will try both of these. Thank you.
|
|
|
Post by dpayforton on Feb 3, 2021 15:59:18 GMT
difficulty = {"Easy", "Normal", "Hard"}
|
|