The problem I'm having is that I have an image that appears on two pages in the same book.
I wish the script to only react once to the image and then ignore the same image on another page. Once it has done that I want it to reset so the process is repeated.
namespace testpad { class Interaction: Scene { public override string Name => "Interaction"; public static RectMap imageone = new RectMap() { X = 239, Y = 199, Width = 125, Height = 18 }; public static RectMap imagetwo = new RectMap() { X = 217, Y = 317, Width = 428, Height = 12 public override bool Match(ScriptBase script) { return script.Match(imageone, 90), || script.Match(imagetwo, 90); } public override void OnMatched(ScriptBase script) { if (script.Match(imageone, 90)) { script.PressKey() { A = true }); Thread.Sleep(100); } else if (script.Match(imagetwo, 90)) { script.Press() { B = true }); Thread.Sleep(1000); } } }
Would a hashset be of use in this paticular case?