User:Espyo/PFE 0.9 to 0.10 tool

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   Pikmin fangame engine v0.9 -> v0.10 file converter  function convert { var types = document.getElementsByName("type"); var type = ""; for(var t = 0; t < types.length; t++) { if(types[t].checked) { type = types[t].value; break; }			}			var input = document.getElementById("input").value; var replacements = []; var result = "All done."; if(type == "area") { replacements = { "guide_x *= *(.+)\nguide_y *= *(.+)": "reference_pos=\$1 \$2", "guide_w *= *(.+)\nguide_h *= *(.+)": "reference_size=\$1 \$2", "guide_file_name *=":                "reference_file_name=", "guide_alpha *=":                    "reference_alpha=", "Misc\. *\{":                        "Custom{" };				if(input.indexOf("Bridge") != -1) { result = "All done, but bridges could not be converted. Please open the converted area in-editor, remove all bridges, and re-add them."; }			} else if(type == "animation") { replacements = { "frames *\{":                          "sprites{", "frames *=":                           "sprites=", "frame_instances *\{":                 "frames{", "frame_instances *=":                  "frames=", "hitboxes *\{":                        "body_parts{", "hitboxes *=":                         "body_parts=", "hitbox_instances *\{":                "hitboxes{", "hitbox_instances *=":                 "hitboxes=", "file_x *= *(.+)\n\t\tfile_y *= *(.+)": "file_pos=\$1 \$2", "file_w *= *(.+)\n\t\tfile_h *= *(.+)": "file_size=\$1 \$2", "game_w *= *(.+)\n\t\tgame_h *= *(.+)": "game_size=\$1 \$2", "offs_x *= *(.+)\n\t\toffs_y *= *(.+)": "offset=\$1 \$2" };			} else if(type == "particles") { replacements = { "\\bspeed *=":                                                    "total_speed =", "\\bspeed_deviation *=":                                          "total_speed_deviation =", "\\bspeed_x *= *(.+)\n[ \t]*speed_y *= *(.+)":                    "speed = \$1 \$2", "\\bspeed_x_deviation *= *(.+)\n[ \t]*speed_y_deviation *= *(.+)": "speed_deviation = \$1 \$2", "\\bx_deviation *= *(.+)\n[ \t]*y_deviation *= *(.+)":            "pos_deviation = \$1 \$2" };				result = "All done, but you'll still need to convert all angles ( and  ) from radians to degrees."; }			for(var r in replacements) { var replacement = new RegExp(r, "g"); input = input.replace(replacement, replacements[r]); }			document.getElementById("output").value = input; document.getElementById("result").innerHTML = result; }	 textarea { width: 100%; height: 300px; }		td, th { width: 300px; padding: 4px 10px; }	 This script will convert area, animation, etc. files created in version 0.9 of the Pikmin fangame engine to the format read by version 0.10. This isn't perfect, so remember to create a backup before converting your files.