【发布时间】:2018-05-28 16:04:01
【问题描述】:
我得到了这个由 ARMA2(游戏)的 3d 编辑器生成的大 .SQF 文件。 这个编辑器有很多问题,但它是添加自定义地图内容的唯一“简单”方式。一个很大的例子就是这个问题:
编辑器将某些行写入所谓的 .SQF 文件。每个对象都由几行组成。问题是,行的顺序并不总是以正确的顺序编写。它会导致对象被错误地生成。当有超过 1000 多个对象,即超过 10000 条以上的线条时,将每个对象的线条按正确的顺序排列将成为一项艰巨的任务。
这是文件中几个对象的示例:
_vehicle_372 = objNull;
if (true) then
{
_this = createVehicle ["MAP_asf2_1_1000", [13661.608, 2976.1057, 4.9591064e-005], [], 0, "CAN_COLLIDE"];
_vehicle_372 = _this;
_this setDir 40.844734;
_this setPos [13661.608, 2976.1057, 4.9591064e-005];
};
_vehicle_378 = objNull;
if (true) then
{
_this = createVehicle ["MAP_dum_mesto2", [13689.696, 2863.1313, 0.17608854], [], 0, "CAN_COLLIDE"];
_vehicle_378 = _this;
_this setDir -30.116863;
_this setVectorUp [0, 0, 1];
_this setPos [13689.696, 2863.1313, 0.17608854];
};
_vehicle_380 = objNull;
if (true) then
{
_this = createVehicle ["MAP_dum_mesto_in", [13686.867, 2907.3464, -0.009554117], [], 0, "CAN_COLLIDE"];
_vehicle_380 = _this;
_this setDir -63.79903;
_this setPos [13686.867, 2907.3464, -0.009554117];
};
_vehicle_384 = objNull;
if (true) then
{
_this = createVehicle ["MAP_HouseBlock_B1", [13722.756, 2839.5999, 0.29589382], [], 0, "CAN_COLLIDE"];
_vehicle_384 = _this;
_this setDir -216.63187;
_this setVectorUp [0, 0, 1];
_this setPos [13722.756, 2839.5999, 0.29589382];
};
我喜欢交换的行是:
_this setVectorUp [0, 0, 1];
与:
_this setPos [13722.756, 2839.5999, 0.29589382];
setvectorup 的线值是一致的,但是 setPos 每次都会包含不同的坐标。 (只有“_this setPos”保持不变)。
notepad++ 中有没有办法自动将所有“_this setvectorup”行与“_this setPos”行交换?
【问题讨论】:
-
请将您的问题减少到您所面临的最小问题,这样会更容易为您提供帮助
-
顺便说一句,如果你在 Windows 上有 linux 或 cygwin,你可以使用 'sort' 和 'uniq' 实用程序来删除重复的行或从同一源收集行(假设它们的源在开头说明行)
-
我的帖子只有一个问题,在底部都有说明。它很短。其余的文字只是解释我面临的问题。如果你不能帮助我解决这个问题,那么请不要费心写评论。
标签: automation notepad++ swap lines sqf