I have a question about how to code a macro to get data, store it, and continue to keep getting data a undefined number of times. I can probably explain what I want to do better by giving an example.
I have a game that has 4 different colors, and it will flash these colors is a sequence, and then one must copy that pattern to advance. It's a game like "Simon". I'm wanting to create something that can "remember" the pattern, and then repeat it. At each level, the pattern gets more complex by 1 color. (Say the first level is "Yellow", then the second level could be "Yellow" then "Blue") It would need to be able to remember the pre-existing pattern, and then add on the new part of the sequence.
I've been playing with the code a little bit, but haven't come up with anything working. Any help would be greatly appreciated! If more info is needed, I'll be glad to try to explain things in more detail.
Wes
Getting data, storing it and getting more data
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I don't know how you are going to get the information or where you want to store it, or when you want to retrieve it or what you want to do with it, but ignoring all that for the moment, think about this:
You only need one line of code to keep the values in order.
The following routine will keep all the values in the variable LastValue. It is initializied with no value. When you want to update it, go to the label UpdateLastValue, add the new color to the existing string. In this example I have inserted a semicolon between the values. New Color could posssible be obtained from a GetPixelColor command, or some other method. When LastValue is updated, you may wnat to make a loop to split out the values with Separate> command, and then use Send> to send the values somewhere else, one at a time, in same sequence, like Simon.
You only need one line of code to keep the values in order.
The following routine will keep all the values in the variable LastValue. It is initializied with no value. When you want to update it, go to the label UpdateLastValue, add the new color to the existing string. In this example I have inserted a semicolon between the values. New Color could posssible be obtained from a GetPixelColor command, or some other method. When LastValue is updated, you may wnat to make a loop to split out the values with Separate> command, and then use Send> to send the values somewhere else, one at a time, in same sequence, like Simon.
Be sure not to have any Trailing Space characters on your lines of script.Let>LastValue=
...
...
...
Label>UpdateLastValue
Let>LastValue=%LastValue%;%NewValue%
...
...
...
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!