Blackjack game

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

Message
Author
telnex
Noob
Noob
Posts: 19
Joined: 22 Jul 2014, 10:13
Noob?: Yes

Blackjack game

#1 Post by telnex »

Well, at the moment I'm not so sure about how to make it but I guess that a macro is the best way to go.

On my server there is a Blackjack game where countrary to real casino you know what are the 2 cards of the croupier so....for people who knows how to play blackjack it means that the probability of winning is over 50%.

That's the reason why I'm trying to do a bot there but there are many things I want to know. Is this possible using an automacro to get 2 numbers that the NPC says to me (my score and his score)? I know it would be possible if the 2 numbers were on the same line using "console .........(\d+) ..... (\d+)" but they are on different lines, so I don't know how to do.

To give you some idea how it is, it appears more or less like that :

Code: Select all

 
You have this cards : 7 A 8
Your score is : 16
Croupier cards are : 9 8
Croupier score is : 17
Is it possible to use something like :

Code: Select all

automacro detectscore {
console /Your score is : (\d+)/
console /Croupier score is : (\d+)/
delay 1
exclusive 1

if ($.lastMatch1>=$.lastMatch2) call .....
if ($.lastMatch1<$.lastMatch2) call .....
.......
}
Or it is easier to use the config.txt? (I don't think we can use variable in config.txt right?)

User avatar
4epT
Developers
Developers
Posts: 617
Joined: 30 Apr 2008, 14:17
Noob?: No
Location: Moskow (Russia)
Contact:

Re: Blackjack game

#2 Post by 4epT »

may be this?
All my posts are made by machine translator!
¤ Manual ¤ Anti BotKiller ¤ Packet Extractor v3 ¤
Image
Image

telnex
Noob
Noob
Posts: 19
Joined: 22 Jul 2014, 10:13
Noob?: Yes

Re: Blackjack game

#3 Post by telnex »

Well no, it's an other kind of machine.

The thing I want to do (to start) is to get using a macro the 2 numbers points that the NPC gives me into that form :

Your cards are: X X
Your total points are: XX

The dealer's cards are: X X
The dealer's total points are: XX

I don't succeed to get those two values. How could I do that?

telnex
Noob
Noob
Posts: 19
Joined: 22 Jul 2014, 10:13
Noob?: Yes

Re: Blackjack game

#4 Post by telnex »

Well. That's where I am :
Talk to NPC / set up the bet

What I'm nearly getting:
Both scores

Where I'm stucked:

Code: Select all

automacro YourPoints {
console /.*Your total points are: (\d+)/i
console /.*The dealer\'s total points are: (\d+)/i
delay 1
timeout 2
call {
	if ($.lastMatch1<=11) call BJhit
	if ($.lastMatch2>=17 && ($.lastMatch1<$.lastMatch2)) call BJhit
	if ($.lastMatch2<=11 && $.lastMatch2>=7 && $.lastMatch1<=14) call BJhit
	if ($.lastMatch2>=17 && ($.lastMatch1>=$.lastMatch2)) call BJstay
	if ($.lastMatch2<=6 && ($.lastMatch1>=12) call BJstay
	if ($.lastMatch2<=11 && $.lastMatch2>=7 && $.lastMatch1>14) call BJstay
	if ($.lastMatch2>11 && $.lastMatch1>11) call BJstay
	if ($.lastMatch1=21) call BJbaby
}
} 
This code seems not to be recognize / is messed up.
I'm having this error in the console : [macro] tempMacro3 error: error in 0: syntax error in if statement


Is it a mistake by myself using the if comparaison?

What I'll try to do next:
If the game is lost, next game it plays it will double the bet.

telnex
Noob
Noob
Posts: 19
Joined: 22 Jul 2014, 10:13
Noob?: Yes

Re: Blackjack game

#5 Post by telnex »

Can you help me with that?

It seems that $.lastMatch1 = Dealer's score & $.lastMatch2 is null. I want $.lastMatch1 to be my score and $.lastMatch2 to be dealer's score.

Is there a way to store my score and then dealer's score?

User avatar
4epT
Developers
Developers
Posts: 617
Joined: 30 Apr 2008, 14:17
Noob?: No
Location: Moskow (Russia)
Contact:

Re: Blackjack game

#6 Post by 4epT »

You can not use two conditions "console" in one macro!!!

may be this:

Code: Select all

automacro YourPoints {
console /.*Your total points are: (\d+)/i
call {
 do conf YourPoints $.lastMatch1
}
}

automacro DealerPoints {
console /.*The dealer\'s total points are: (\d+)/i
call {
 do conf DealerPoints $.lastMatch1
}
}
PS:
you can use reactOnNPC plugin:

Code: Select all

reactOnNPC_debug 1
reactOnNPC macro @eval(my $myscore = '#0~1';my $crscore = '#3~1';my $answer; $answer = "BJhit" if $myscore <= 11; return $answer) {
   delay 5
   msg_0 /You have this cards : .*/
   msg_1 /Your score is : (\d+)/
   msg_2 /Croupier cards are : .*
   msg_3 /Croupier score is : (\d+)/
}
All my posts are made by machine translator!
¤ Manual ¤ Anti BotKiller ¤ Packet Extractor v3 ¤
Image
Image

telnex
Noob
Noob
Posts: 19
Joined: 22 Jul 2014, 10:13
Noob?: Yes

Re: Blackjack game

#7 Post by telnex »

Well thanks a lot for helping me.

I decided to use the first option (using macros).

So I've created YourPoints & DealerPoints inside config.txt.

Code: Select all

YourPoints 0
DealerPoints 0

Both points are nicely recognize.

But now I have no idea why I still get an error with the if statement. I still get tempMacro5 error : error in 0: syntax error in if statement.

Here is the automacro where I'm stucked

Code: Select all

automacro CHOICE {
console /.*What would you like to do\?/i
delay 1
timeout 2
call {
	if (YourPoints <= 11) call BJhit
	elseif (DealerPoints >= 17 && (YourPoints < DealerPoints)) call BJhit
	elseif (DealerPoints <= 11 && DealerPoints >= 7 && YourPoints <= 14) call BJhit
	elseif (DealerPoints >= 17 && (YourPoints >= DealerPoints)) call BJstay
	elseif (DealerPoints <= 6 && (YourPoints >= 12) call BJstay
	elseif (DealerPoints <= 11 && DealerPoints >= 7 && YourPoints > 14) call BJstay
	elseif (DealerPoints > 11 && YourPoints > 11) call BJstay
	elseif (YourPoints = 21) call BJbaby
}
} 
I tried to use $YourPoints and $DealerPoints instead of YourPoints / DealerPoints without success
And I also tried with $.YourPoints and $.DealerPoints with same result.

Is there a way to use the variables that I don't know how to do? Or is this my if condition that is false?

User avatar
4epT
Developers
Developers
Posts: 617
Joined: 30 Apr 2008, 14:17
Noob?: No
Location: Moskow (Russia)
Contact:

Re: Blackjack game

#8 Post by 4epT »

read the manual and use:

Code: Select all

...
if (@config(YourPoints) <= 11) call BJhit
...
All my posts are made by machine translator!
¤ Manual ¤ Anti BotKiller ¤ Packet Extractor v3 ¤
Image
Image

telnex
Noob
Noob
Posts: 19
Joined: 22 Jul 2014, 10:13
Noob?: Yes

Re: Blackjack game

#9 Post by telnex »

I'm still getting the same error.

I tried to use elseif instead of if


Code: Select all

automacro CHOICE {
console /.*What would you like to do\?/i
delay 1
timeout 2
call {
	if (@config(YourPoints) <= 11) call BJhit
	elseif (@config(DealerPoints) >= 17 && (@config(YourPoints) < @config(DealerPoints))) call BJhit
	elseif (@config(DealerPoints) <= 11 && @config(DealerPoints) >= 7 && @config(YourPoints) <= 14) call BJhit
	elseif (@config(DealerPoints) >= 17 && (@config(YourPoints) >= @config(DealerPoints))) call BJstay
	elseif (@config(DealerPoints) <= 6 && (@config(YourPoints) >= 12) call BJstay
	elseif (@config(DealerPoints) <= 11 && @config(DealerPoints) >= 7 && @config(YourPoints) > 14) call BJstay
	elseif (@config(DealerPoints) > 11 && @config(YourPoints) > 11) call BJstay
	elseif (@config(YourPoints) = 21) call BJbaby
}
} 
Still getting the error.

User avatar
4epT
Developers
Developers
Posts: 617
Joined: 30 Apr 2008, 14:17
Noob?: No
Location: Moskow (Russia)
Contact:

Re: Blackjack game

#10 Post by 4epT »

what is "elseif"? read the manual again
All my posts are made by machine translator!
¤ Manual ¤ Anti BotKiller ¤ Packet Extractor v3 ¤
Image
Image

Post Reply