Fiendish said:
Ace, Two, Three, etc need to be strings. "Ace", "Two", "Three", and so on.
Also, holy cow. Make all those elses and ifs into elseifs so that you can collapse that crazy chain of ends down to only one.
Heavily condensed:
local DealHand = GetVariable("deal_hand")
local MyHand = GetVariable("my_hand")
local cardnums = {
Ace = 1,
Two = 2,
Three = 3,
Four = 4,
Five = 5,
Six = 6,
Seven = 7,
Eight = 8,
Nine = 9,
Ten = 10,
Jack = 10,
Queen = 10,
King = 10,
}
if cardnums[DealHand] then
DealHand = cardnums[DealHand]
SetVariable("deal_hand", DealHand)
end
ColourNote ("Black", "Blue", "DealHand is (" .. DealHand .. ")")
ColourNote ("Black", "Blue", "MyHand is (" .. MyHand .. ")")
[EDIT]: (If you're -really- curious and don't want your head to explode from my late-night ramblings) - One might wonder why I didn't quote the keys of that table, when Fiendish just said "Ace", "Two", etc. needed to be quoted. Long story short: if you're putting something on the right into something on the left, the thing on the left is probably a variable, and the variable name isn't quoted. Since we're defining these variables within a table, though, we can use a string to get at those variables. |