I have spent the majority of last night and today sorting out the tool change code for the DuetWifi. I have attached the files to this post. When using this code you can remove the tool change script from S3D. It should allow you to use any slicer without worrying about the tool change being different. Simply put the scripts in you sys files. The code sees the T# in the gcode and runs the tfree#.g (retract, dock & purge). Followed by the tpost#.g (prime). The tpre#.g is empty. So the duet handles the tool change independent of the slicer. You may need to modify your docking positions to suit your dual setup. It is also worth remembering to set the G10 P# S### R### somewhere so your tools have a operating and standby temperature. Particularly useful if you will be using scaffold (you can burn it if it stays too hot in the hot end). Also remember to make sure you have code to turn the hot ends off. Like the code above but with S0 R0 so they don't sit at their standby temps. If you need any help feel free to ask.