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YCARDS
FOR 1 52
TAG.CARD.<dLOCAL._FOR>
ENDFOR
SYSMESSAGE @,,1 CARDS RESETED!
RETURN 1
[FUNCTION CHECKCARD]
IF <dARGV> != 2
SYSMESSAGE @026,,1 You must type the cards number.
SYSMESSAGE @026,,1 Syntax: .CheckCard "CardNumber 1","CardNumber 2" without quotes
SYSMESSAGE @026,,1 Example: .CheckCard 1,2 will check card 1 and 2
RETURN 0
ENDIF
SERV.B @044,,1 <GETARGVX 2,<TAG.CARD.<ARGV[0]>>> <GETARGVX 2,<TAG.CARD.<ARGV[1]>>>
FOR 1 4
IF STRMATCH(*<GETARGVX 4,<TAG.CARD.<ARGV[0]>>>*,<DEF.SUIT.<dLOCAL._FOR>>)
LOCAL.CARD.1.SUIT <dLOCAL._FOR>
ENDIF
IF STRMATCH(*<GETARGVX 4,<TAG.CARD.<ARGV[1]>>>*,<DEF.SUIT.<dLOCAL._FOR>>)
LOCAL.CARD.2.SUIT <dLOCAL._FOR>
ENDIF
ENDFOR
FOR 1 13
LOCAL.SYMBOL <GETARGVX 3,<TAG.CARD.<ARGV[0]>>>
IF STRMATCH(*<QVAL <ISNUM <LOCAL.SYMBOL>>?<dLOCAL.SYMBOL>:<LOCAL.SYMBOL>>*,*<DEF.SYMBOL.<dLOCAL._FOR>>*)
LOCAL.CARD.1.SYMBOL <dLOCAL._FOR>
ENDIF
LOCAL.SYMBOL <GETARGVX 3,<TAG.CARD.<ARGV[1]>>>
IF STRMATCH(*<QVAL <ISNUM <LOCAL.SYMBOL>>?<dLOCAL.SYMBOL>:<LOCAL.SYMBOL>>*,*<DEF.SYMBOL.<dLOCAL._FOR>>*)
LOCAL.CARD.2.SYMBOL <dLOCAL._FOR>
ENDIF
ENDFOR
IF <dLOCAL.CARD.1.SYMBOL> < <dLOCAL.CARD.2.SYMBOL>
SYSMESSAGE @035,,1 CARD 1 HIGHER
RETURN 1
ELIF <dLOCAL.CARD.1.SYMBOL> > <dLOCAL.CARD.2.SYMBOL>
SYSMESSAGE @035,,1 CARD 2 HIGHER
RETURN 2
ELIF <dLOCAL.CARD.1.SYMBOL> == <dLOCAL.CARD.2.SYMBOL>
IF <dLOCAL.CARD.1.SUIT> < <dLOCAL.CARD.2.SUIT>
SYSMESSAGE @035,,1 CARD 1 HIGHER
RETURN 1
ELIF <dLOCAL.CARD.1.SUIT> > <dLOCAL.CARD.2.SUIT>
SYSMESSAGE @035,,1 CARD 2 HIGHER
RETURN 2
ELSE
SYSMESSAGE @026,,1 SAME CARD!
RETURN 0
ENDIF
ENDIF
RETURN 1