You can see where to put these scripts within Cura on the Starting & Ending G-code Scripts Location page.
Here are some examples of the many different options available for the G29 Automatic Bed Leveling command.
G90 ; switch to absolute positioning - this line was added in case Cura doesn't include it by default M82 ; set extruder to absolute mode - this line was added in case Cura doesn't include it by default G28 ; start from home position G29 C-0.8 Z0.3 ; probe the bed at 3 points with a 0.3mm overall vertical offset and an additional -0.8mm center offset G1 Z15.0 F4800 ; move the nozzle up 15mm G92 E0 ; reset extrusion distance G1 F200 E3 ; extrude 3mm of feed stock G92 E0 ; reset extrusion distance again G1 F4800
M104 S0 ; turn off nozzle heater M140 S0 ; turn off bed heater G91 ; switch to relative positioning G1 E-1 F300 ; retract the filament a bit before lifting the nozzle to release some of the pressure G1 Z1 E-5 F4800 ; move nozzle up a bit and retract filament even more (Removed "X-20 Y-20" from stock. I have no idea why this was part of the end script) G28 X0 ; return to home positions so the nozzle is out of the way M84 ; turn off stepper motors G90 ; switch to absolute positioning
;This is a long one. The purpose of this script is to eliminate the tiny blobs and strings at each probing point. If you a G29 command that probes 3 or 4 points then don't bother with this script. The 25mm purge is so when the G29 command moves the effector plate down the cooled string of filament will eject out the side (doesn't always work). G90 ; switch to absolute positioning - this line was added in case Cura doesn't include it by default M82 ; set extruder to absolute mode - this line was added in case Cura doesn't include it by default (may not be needed) G92 E0 ; reset extrusion distance G1 E25 F300 ; purge 25mm of filament to prime nozzle. G92 E0 ; reset extrusion distance G4 S5 ; Pause for 5 seconds to allow time for removing extruded filament G28 ; start from home position G1 E-6 F900 ; retract 6mm of filament before starting the bed leveling process G92 E0 ; reset extrusion distance G4 S5 ; pause for 5 seconds to allow time for removing extruded filament G29 P4 Z0.38 ; 4x4 mesh (12-points) with offset - YOU MAY NEED TO ADJUST THE Z OFFSET EXAMPLE: change "Z0.38" to Z0.45 or Z0.2 G1 Z60 ; raise Z 60mm to prepare for priming the nozzle G1 E4 F300 ; extrude 4mm of filament to help prime the nozzle just prior to the start of the print G92 E0 ; reset extrusion distance G4 S5 ; pause for 5 seconds to allow time for cleaniing the nozzle and build plate if needed
M104 S0 ; turn off hotend heater M140 S0 ; turn off bed heater G91 ; Switch to use Relative Coordinates G1 E-3 F700 ; retract the filament a bit before lifting the nozzle to release some of the pressure G1 Z2 F1000 ; raise platform 2mm from current position G1 E-2 F700 ; retract filament even more G90 ; Switch back to using absolute coordinates G28 X ; Return to home position. Without an X Y or Z after G28 the print completion time will not be displayed on the Mini Delta's display. M84 ; disable motors G4 S360 ; pause for 360 seconds to keep fan running to cool hotend and allow the fan to be turned off M107 ; turn off fan. Don't use M106 S1. Using M106 S1 may prevent the fan from turning on for the following print. Some say M107 doesn't work for them but if the hotend is below 70 degrees it should work
Nozzle temperature must be below 70°C
G4 S360 ; keep fan running for 360 seconds to cool hotend and allow the fan to be turned off - adjust to your needs M107 ; turn off fan