Card Comparing Script 12/01/2008 08:21 AM CST
Was trading cards with someone today and they liked my script, so I figured I'd post it in case anyone finds it useful. (I might have posted this before). It's only compatible with YASSE and not super-efficient but better than doing it by hand since I can't convince anyone else to use www.zairius.com :( It's probably genie-fyable.
#Card Sorter Script

define variable givecards getcards

match dups already
match dups you get
put get my col case
match

#Save my dups
dups:
put card dup
WAITFOR In other words, your duplicates are:
SETVARIABLE dups %l-
GOSUB remcom dups

#save my needed cards
put card need
WAITFOR In other words, you need:
SETVARIABLE needs %l-
GOSUB remcom needs

#Save TARGET's dups
ECHO ************************************************************************
ECHO Once the target tells you his dups, type out "trader dups: (cards)"
ECHO ************************************************************************
PAUSE
WAITFOR trader dups:
setvariable traderdups %l-
gosub remcom traderdups

#save TARGET's needed cards
ECHO *************************************************************************
ECHO Once the target tells you his dups, type out "trader needs: (cards)"
ECHO *************************************************************************
PAUSE
WAITFOR trader needs:
SETGLOBALVARIABLE traderneeds %l-
gosub remcom traderneeds

Echo ** Processing...
for temp = 1 to 150
begin
if $needs$ contains " %temp "
begin
if $traderdups$ contains " %temp "
begin
setvariable getcards "$getcards$ %temp,"
end
end
end

for temp = 1 to 150
begin
if $dups$ contains " %temp "
begin
if $traderneeds$ contains " %temp "
begin
setvariable givecards "$givecards$ %temp,"
end
end
end


ECHO ****************************************************************
IF $givecards$ contains ","
ECHO ** They need : $givecards$
else
ECHO ** They need : Nothing from you, buddy.
ECHO **
IF $getcards$ contains ","
ECHO ** You need : $getcards$
else
ECHO ** You need : Nothing, sucker!
ECHO ****************************************************************
EXIT

#recusivly remove ,
remcom:
setvariable temp %w
pause
remcom2:
CALCULATE $temp$ remove ","
IF %$temp$ contains ", "
GOTO remcom2
CALCULATE $temp$ remove "."
CALCULATE $temp$ remove "\n"
CALCULATE $temp$ remove " "
RETURN

errorhandler:
ECHO ** Error #$errornumber$ occurred on the line #$errorline$ : $line$
EXIT

~Hanryu Ves'Shomis
http://drplat.com/CombatEquipmentCompendium.xls
Tolle says, "Yup yup, 'bout time. What the heck took you so long?"
Reply