$${
// Bind this script to the OnChat event
// When you punch a chest shop, it will log the current exchange to a text file
// If the shop has more than one exchange, just cycle it through each
// Example:
// @ [0000,00,0000] input: 1 Diamond, output: 1 Diamond Sword, stock: 3
// OUT OF STOCK: @ [0000,00,0000] input: 1 Iron Ingot, output: 2 XP Bottle, stock: 0
ifmatches(%CHATCLEAN%,"(Input: (([0-9][0-9]?[0-9]?) ([a-z][a-z]+).?([a-z]*)))",@&exchangeinput,2);
endif;
ifmatches(%CHATCLEAN%,"(Output: (([0-9][0-9]?[0-9]?) ([a-z][a-z]+).?([a-z]*)))",@&exchangeoutput,2);
endif;
ifmatches(%CHATCLEAN%,"(([0-9][0-9]?[0-9]?) exchanges available)",@&exchangesleft,2);
time(&ctime);
if(%@&exchangesleft% = 0);
logto(shoplog.txt,"OUT OF STOCK: @ [%HITX%,%HITY%,%HITZ%] input: %@&exchangeinput%, output: %@&exchangeoutput%, stock: %@&exchangesleft%");
else;
logto(shoplog.txt," @ [%HITX%,%HITY%,%HITZ%] input: %@&exchangeinput%, output: %@&exchangeoutput%, stock: %@&exchangesleft%");
endif;
endif;
}$$