/def shards = \ /set v_shard_step1=1 %; \ /set v_shard_weight=0 %; \ /send ih shard %; \ /send ii shard %; \ /def -E{v_shard_step1} -F -mregexp -t'^"shard(\d+)"' t_shard_num_get = \ /eval /set v_shard_nums=%v_shard_nums %{P1} %; \ /def -E{v_shard_step1} -F -mregexp -t'^You are holding:$' t_shard_holding = \ /def -1 -Fp999 -hPROMPT t_shard_go = \ /unset v_shard_step1 %%; \ /set v_shard_step2=1 %%; \ /probe_shard %; \ /def -E{v_shard_step2} -F -mregexp -t'^It weighs about (\d+) pounds? and (\d+) ounce\(s\)\.$' t_shard_get1 = /add_shard_weight $[{P1}*16 + {P2}] /def -E{v_shard_step2} -F -mregexp -t'^It weighs about (\d+) pounds?\.$' t_shard_get2 = /add_shard_weight $[{P1}*16] /def -E{v_shard_step2} -F -mregexp -t'^It weighs (\d+) ounce\(s\)\.$' t_shard_get3 = /add_shard_weight %{P1} /def add_shard_weight = \ /test v_shard_weight := v_shard_weight + %{1} %; \ /probe_shard %; \ /def probe_shard = \ /eval /send probe $(/car %v_shard_nums) %; \ /eval /set v_shard_nums=$(/cdr %v_shard_nums) %; \ /def shards_finish = \ /eval /echo -p @{nBCwhite}Shards: @{nBCblue}$[v_shard_weight / 16]@{nBCwhite}lb@{nBCblue}$[mod(v_shard_weight, 16)]@{nBCwhite}oz %; \ /quote -S /unset `"/listvar -s v_shard*" %; \ /def -E{v_shard_step2} -mregexp -agL -t'^What do you wish to examine\?$' t_shard_done = /shards_finish /def -E{v_shard_step2} -mregexp -agL -t'^This strange-looking shard' t_shard_gag