#!/usr/bin/perl -w # 1. in JS console in browser # json_report_error(pieces) # 2. c&p resulting error into a file, strip off front # 3. run this # 4. paste into jst-lower.rs use strict; use JSON; use Data::Dumper; my $jtext = do { undef $/; ; }; my $data = decode_json($jtext); #print STDERR Dumper($data); my @pieces = map { my $id = $_; my $p = $data->{$_}; [ $p->{z}, $p->{zg}, (sprintf " sp!(%8s, %s, %-3s, %-23s, %6d ), %s\n", "\"$id\"", $p->{pinned} ? 'true' : 'false', $p->{moveable} eq 'IfWresting' ? 'No' : $p->{moveable}, "\"$p->{z}\"", $p->{zg}, $p->{held} ? "// HELD $p->{held}" : '', ) ] } keys %$data; my @sorted = sort { $a->[0] cmp $b->[0] || $a->[1] <=> $b->[1] } @pieces; foreach my $p (@sorted) { print $p->[2] or die $!; }