Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Wed Mar 20, 2002 3:14 am   

Playing blackjack
 
I have been trying to write a trigger to play my games of blackjack for me. My problem seems to be converting queens and kings to 10's....

The code I have been using is

The dealer shows the (%a)

#if (%1 = Ace) {dealershows = 11} {#if (%1 = King|Queen|Jack) {dealershows = 10} {dealershows = %1}}

it works fine when capturing the numbesr, but sometimes stores "Queen" or "Jack" to "dealershows" which does not work down below. I thought I saw it work, but I am not so sure. I can't find any differences between cases in which I thought it worked and when it didn't... can anyone out there see an error?
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Wed Mar 20, 2002 3:34 am   
 
#if (@ihave >=17) {stand} {#if (@ihave = 13|14|15|16 AND @dealershows = 2|3|4|5|6) {stand}{#if (@ihave = 12 AND @dealershows = 4|5|6) {stand}{#if (@ihave = 11 AND @dealershows != 11) {double}{#if (@ihave = 10 AND @dealershows != 10|11) {double} {#if (@ihave = 9 AND @dealershows = 3|4|5|6) {double}{hit}}}}}}

I can't figure this out either. my variables get set fine, but many times nothing executes. I can't find the error here either
Reply with quote
Humpton
Apprentice


Joined: 10 Oct 2000
Posts: 158
Location: Chicago, IL

PostPosted: Wed Mar 20, 2002 3:52 am   
 
Your first one:

Is it possible that even though %a captures number and letters, it doesn't actually know the difference between a string and a number? So maybe the last bit needs to be %number(%1)? And, does the string you are testing against have to be in quotes ""?Otherwise, I'm sorry, I have nothing to offer.

Your second one:

I'd try just breaking it down into little bits and force it some values and see what comes of that. Put lots of #SHOW I'm in the >=17 place, etc to give you an idea of where it's getting to. You may have a } in the wrong place somewhere? But, it looks ok to me right now.

Good luck!

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

Core 2651: For those who prefer the future to the past.
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Wed Mar 20, 2002 6:00 am   
 
Your conditionals will not work as written. In %1 = King|Queen|Jack, the expression is comparing %1 to the string (not string list) "King|Queen|Jack".

Instead of #IF (%1 = King|Queen|Jack) you can write #IF (%1 = King|%1 = Queen|%1=Jack) OR you can use the %ismember function and write #IF (%ismember(%1, {King|Queen|Jack}))

Apply the same solution to your conditional expressions in your other problem.
Troubadour
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net