Thanks for trying to explain but that didnt help me much. xD
I guessed i need a loop but perhaps i didnt give a proper example since i never got it to work so i did not have any loops.
My idea was (to summarize in theory):
Code: Select all
Sequence1=Action PlayOnce
Sequence2=Move X 500
Sequence3=Move Y 300
Sequence3=Action Finish
Loop
{
Sequence:=Sequence%A_Index%
If InStr(Sequence, "Action Finish")
{
Break
}
If InStr(Sequence, "Action Play")
{
}
If InStr(Sequence, "Move X")
{
StringReplace, Sequence, Sequence, Move X,
WinMove do stuff
}
If InStr(Sequence, "Move Y")
{
StringReplace, Sequence, Sequence, Move Y,
WinMove do stuff
}
}
So i want to turn this:
Code: Select all
Sequence1=Action PlayOnce
Sequence2=Move X 500
Sequence3=Move Y 300
Sequence3=Action Finish
into this:
Code: Select all
; Set anim stuff like move and other stuff it should do.
AnimSeq=[Move X 500] [Move Y 300] [Action Pause 3000] [Move X 500] [Move Y 300] [Action Pause 3000] [Action StartAnim AnimSeq2]
AnimSeq2=[Move X 500] [Move Y 300] [Action Finish]
GetAnimProps:
; Or if it requires a loop, i still need a count of all the different commands in AnimSeq Var and need to extract them in sequence
MatchCount:=RegExMatch(AnimSeq,"i)(\[Action:.+?])+|(\[Move:.+?])",Command)
Loop %MatchCount%
Sequence%A_Index%:=Command%A_Index%
; OR
MatchCount:=Somehow get the count? or wait for end or repetition/empty var and break the loop?
Loop %MatchCount%
Sequence%A_Index%:=RegExMatch(AnimSeq,"i)(\[Action:.+?])+|(\[Move:.+?])",Command) ; where should i put A_Index to move onwards and what needle code i need?
Loop
{
Sequence:=Sequence%A_Index%
If InStr(Sequence, "Action Finish")
Break
else If InStr(Sequence, "Action Pause")
{
StringReplace, Sequence, Sequence, Action Pause,
Sleep %Sequence%
}
else If InStr(Sequence, "Action StartAnim")
{
StringReplace, Sequence, Sequence, Action StartAnim,
AnimSeq:=Sequence
GoSub GetAnimProps
Break
}
else If InStr(Sequence, "Move X")
{
StringReplace, Sequence, Sequence, Move X,
WinMove do stuff
}
else If InStr(Sequence, "Move Y")
{
StringReplace, Sequence, Sequence, Move Y,
WinMove do stuff
}
}
I can track down a single occurance but there can be multiple of same type but with different instructions so i need to extract them in sequence.
At least thats how it looks in my head. Im trying to condense code and make it easier to overview and edit an animation.
Look at AnimSeq as an animation event that will do a particular thing and if you command a new AnimSeq, a new anim event takes place until finish is encountered.
Or to go the manual way and add every sequence manually in order with instructions that will eat a lot of lines.
I know about while but i need loop so can perhaps add more functionality. In while, its limited. Also, its easier to track.
Sorry for the wall post, trying to be as clear as possible and im still not good enough in english to do it in fewer lines i guess.