IF, OR, and WHILE help

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Mark Gevry
Pro Scripter
Posts: 63
Joined: Sat Dec 25, 2004 3:23 pm

IF, OR, and WHILE help

Post by Mark Gevry » Sun May 22, 2005 9:59 pm

Hi. IM trying to automate a video poker game. It has the 5 cards, etc..
and is there an easier way to do this....

if>{(card1=k) and (card3=k) while (card2=a) or (card2=2) or (card2=3)ETC...(same line)...and (card4=a) or (card4=2) ETC...(same line)..and (card5=a) or (card5=2)..ETC...
goto>A_LABEL
endif

I want it to be like, if there are two kings (card 1 and card 3), and any of the other cards are different, do something.

Kind Regards,
Mark

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sun May 22, 2005 11:03 pm

Mark,

Have you tried "" (not equal to)?

(Edit1)
You will also need % around your variables. If the "k" is a variable it will need % around it. If it is a string it will need quotes. In my example I'm assuming its a string.

if>{(%card1%="k") and (%card3%="k") and (%card2%"k") and (%card4%"k") and (%card5%"k")}
goto>A_LABEL
endif

Also, can you use "while" as a logic operator? I haven't been able to find documentation on it.

Hope this helps,
Dick
Last edited by JRL on Mon May 23, 2005 12:37 am, edited 2 times in total.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun May 22, 2005 11:05 pm

Consider using 11,12,13,1 for J,Q,K,A and then use basic math for something like this:

if>{(%card1%=12) and (%card3%=12) and (%card2%12).....
Last edited by Bob Hansen on Mon May 23, 2005 2:38 am, edited 2 times in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Mark Gevry
Pro Scripter
Posts: 63
Joined: Sat Dec 25, 2004 3:23 pm

Post by Mark Gevry » Mon May 23, 2005 12:53 am

Im getting an error...did i do this wrong?

if>{(%card1%=13) and (%card3%=13) while (%card2%13) and (%card4%13) and (%card5%13)}

I get a message from MS saying... "w not appropriate"

Thank you,
Mark

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon May 23, 2005 1:46 am

There is no "WHILE" in Macro Scheduler (except with VBScript, While/Wend).
Replace "while" with "and"

if>{(%card1%=13) and (%card3%=13) and (%card2%13) and (%card4%13) and (%card5%13)}
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Mark Gevry
Pro Scripter
Posts: 63
Joined: Sat Dec 25, 2004 3:23 pm

Post by Mark Gevry » Mon May 23, 2005 1:48 am

Yep, that works, thank you.

Mark

Mark Gevry
Pro Scripter
Posts: 63
Joined: Sat Dec 25, 2004 3:23 pm

Post by Mark Gevry » Mon May 23, 2005 2:01 am

actually, im still getting that error... "w not appropriate"

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon May 23, 2005 2:35 am

Be sure that you have removed all trailing spaces in your script.

Does program stop at that point? If YES, submit a copy of the log file.

Or, can you single step through and see where that is generated?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Mark Gevry
Pro Scripter
Posts: 63
Joined: Sat Dec 25, 2004 3:23 pm

Post by Mark Gevry » Mon May 23, 2005 2:40 am

I fixed the problem. I forgot to add a % sign to one of the variables, and the error went away and is working fine.

Thank you,
Mark

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts