sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #54204
[Question #688960]: How to randomly choose between two potential options?
New question #688960 on Sikuli:
https://answers.launchpad.net/sikuli/+question/688960
The only real language I'm familiar with is C# so I don't know anything about java or python or what "jython" even is. Effectively if the thing I want to do isn't in the docs with an example showing me how to do it I don't know how to figure it out and can't find it on google because apparently there isn't a huge backlog of questions about jython on stackexchange.
1. I'm setting up a macro for a game but I want to make sure the macro has some randomness in it to spoof any potential macro detection in the game (ie I want it to not be perfectly consistent) and I'd like to for example give it two images to click on, and have it randomly choose one image. So kinda how this would look in my head is: "rand(1,2) if.rand==1 click(a) else click(b)" but that doesn't work and I don't know what to type instead.
2. Also couldn't find in the docs, is I want to know how to make the script move to a "backup" if it can't find something instead of just erroring and stopping because it can't find it. So how it would look in my head is: "click(d), else click(e)" but that doesn't actually work.
Can I get some guidance on setting these up? I know exactly what I need to do and how the logic/syntax should look but I don't know what the actual functions are called...
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.