|
Post by oomkoos on Nov 20, 2019 9:49:35 GMT
I have a variable , lets call it numberRows
I started the following actionlist:
actionList = { {action = "touchDown", target = p1},
{action = "wait", target = 1},
{action = "touchMove", target = p2},
{action = "touchMove", target = p2a},
{action = "touchMove", target = p2b},
{action = "touchMove", target = p2c},
{action = "touchMove", target = p2d},
{action = "touchMove", target = p2e},
Now, if numberRows >= 1, i want to add a movement if numberRows >= 2, i want to add a movement until numberRows = 13
I tried a if statement inside the action list but that didnt want to work
is there a way of doing this ?
|
|
|
Post by AnkuLua on Nov 21, 2019 0:09:05 GMT
Is this what you want?
Added following when actionList was built.
while(numberRows <= 13) do table.insert(actionList , {action = "touchMove", target = p2c}) -- change to action and target that you want numberRows = numberRows + 1 end
|
|
|
Post by oomkoos on Nov 21, 2019 4:26:28 GMT
Is this what you want? Added following when actionList was built. while(numberRows <= 13) do table.insert(actionList , {action = "touchMove", target = p2c}) -- change to action and target that you want numberRows = numberRows + 1 end AWESOME, thank you
|
|
|
Post by oomkoos on Dec 4, 2019 4:43:46 GMT
Struggling to get my head around this
I have a set of Location coordinates, they come in pairs, 13 pairs in total
LocationLeft1 LocationRight1 LocationLeft2 LocationRight2 LocationLeft3 LocationRight3 ... ... LocationLeft13 LocationRight13
I was thinking of putting them in 2 tables, leftTable and RightTable That i can do fairly easily
Now here comes my problem:
TouchDown is at a specific point. Lets say Location0
Based on a user input variable (moves), i now need to move from touchdown to the sets of Locations above ie
if moves = 1 it should move from touchdown to locationLeft1 to locationRight1, and touchUp at LocationRight1
if moves = 2 it should move from touchdown to locationLeft1 to locationRight1 move to LocationLeft2 to locationRight2 and touchUp at locationRight2
all the way to moves=13
Currently i have 13 if statements which is becoming too much
i can easily extract the locations in pairs with a (for i=1 to moves) statement, How to do assign the locations stored in the table to the actionlist ?
|
|
|
Post by oomkoos on Dec 4, 2019 4:59:21 GMT
is my thinking below correct, or is there a better way ?
leftTable = { Location(20,30), Location(30,50), Location(80,11) ....... } --13 Locations in total rightTable= {Location(110,50), Location(200,75), Location(400,30) .....} --13 Locations in total
table.insert(actionList , {action = "toucDown", target = Location0}) for l=1 to moves do table.insert(actionList , {action = "touchMove", target = leftTable[l]}) table.insert(actionList , {action = "touchMove", target = rightTable[l]}) end table.insert(actionList , {action = "toucUp", target = rightTable[moves]})
manualTouch(actionList)
|
|
|
Post by oomkoos on Dec 4, 2019 8:17:47 GMT
finally got it working leftTable = { Location(271,447), Location(245,435), Location(222,424) } rightTable = { Location(550,305), Location(526,293), Location(500,283) } function newPlantHarvest(n) plantList = {{action = "touchDown", target = p1}, {action = "wait", target=1} } for k = 1, numberRows,1 do table.insert(plantList , {action = "touchMove", target = leftTable[k] }) table.insert(plantList , {action = "touchMove", target = rightTable[k]}) end up = rightTable[numberRows] table.insert(plantList , {action = "touchUp", target = up}) manualTouch(plantList)
end
|
|