I am trying to make a script to run a blackjack game. I dont under stand how to type the script. If the card is 15 or lower i want it to click hit but if its 16 or higher i want it to hit stand. I know i have to get pixel colors for each card but how would i type it? pls give me an example.
NEWBIE
pixel colors........
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 will be able to use Pixel colors to ID value, but will leave that up to you at this time. Here is a rough pass (untested)with some structure to get you started:
If doing Cut/Paste from forum, be sure to remove any trailing space characters. In the Editor you can click on Edit, Show All Chars, and Remove Trailing Spaces.WaitWindowOpen>WindowName*
SetFocus>WindowName*
Label>Play
WaitReady>1
GetPixelColor>X,Y,ThisSpot
If>%ThisSpot%=4588445,Stand,Hit
Label>Stand
//Use "&" for underscore characters on button
PushButton>WindowName*,&Stand
Goto>Play
Label>Hit
PushButton>WindowName*,&Hit
Goto>Play
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Just a lttle confused
i dont know how read if its 16 or higher ( or 15 or lower)
I know i have to get pixel colors of the cards but how would i right it
Like this???
Label>start
setfocus>blackjack*
movewindow>blackjack*,0,0
getpixelcolor> ( this is where im lost )
If>%Im lost here to%=LOST HERE TO
*Now you get two cards at a time. How do i make it read 15 or lower or 16 or higher. I KNOW BY USING PIXEL COLORS BUT HOW DO I TYPE THEM ALL FOR EACH NUMBER CARD ( ace-2,3,4,5,6,7,8,9,10,j,q,k)
i dont know how read if its 16 or higher ( or 15 or lower)
I know i have to get pixel colors of the cards but how would i right it
Like this???
Label>start
setfocus>blackjack*
movewindow>blackjack*,0,0
getpixelcolor> ( this is where im lost )
If>%Im lost here to%=LOST HERE TO
*Now you get two cards at a time. How do i make it read 15 or lower or 16 or higher. I KNOW BY USING PIXEL COLORS BUT HOW DO I TYPE THEM ALL FOR EACH NUMBER CARD ( ace-2,3,4,5,6,7,8,9,10,j,q,k)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Only suggestion I can make is to map the area where the A-K shows up. Find a pixel that only shows up for each number and string together a bunch of IF,s and then add results......something like this:
You may want to handle the Aces a little differently, but this is a basic routine structure that can get you going.//Make similar sections for Ace, Two,....King with unique X,Y values to ID pixel color to ID the card.
GetPixelColor>X1,Y1,Spot
If>%Spot%=12345,Ace
GetPixelColor>X2,Y2,Spot
IF>%Spot%=23456,Two
...
...
...
GetPixelColor>X13,Y13,Spot
IF>%Spot%=78451,King
MessageModal>Could not ID card
Goto>End
//Make similar sections for Ace, Two,....King with values to add card value to total Score.
Label>Ace
Let>Value=1
//Scoring section can add additional 10
Goto>Score
Label>Two
Let>Value=2
Goto>Score
...
...
...
Label>King
Let>Value=10
Goto>Score
Label>Score
Add>Total,%Value%
IF>%Total%>12,Check15
If>%Value%=1,HandleAces,Check15
Label>HandleAces
Let>Value=10
Goto>Score
Label>Check15
If>%Total%>15,Stand,Hit
Label>Stand
......
Label>Hit
...
...
Label>End
Last edited by Bob Hansen on Wed Jul 07, 2004 3:18 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!