qq123123 发表于 2011-3-26 20:53:18

(易语言) 求翻译,怎么翻译成au3问题不重要了,当做(已解决)

本帖最后由 qq123123 于 2011-4-19 19:11 编辑

function nearest(type)
        local p = getObjectAddrList();
        local nearId = nil;
        local distNear = 0;
        if p == nil then
                return nil;
        end
        for _, baseAddr in pairs(p)do
                local object = getObjectInfo(baseAddr);
                if object.type==type then
                        local distNow = distance(object);
                        if nearId ==nil then
                                nearId = object.id;
                                distNear = distNow;
                        elseif distNear>distNow then
                                nearId = object.id;
                                distNear = distNow;
                        end
                end
        end
        return nearId;
end

function distance(object)
        local cx, cy = Player:GetPos();
        local xx = math.abs(cx-object.x);
        local yy = math.abs(cy-object.y);
        return math.sqrt(xx*xx+yy*yy);
end

local nearId = nearest("box");
if nearId~=nil then
        SetNotifyTip("最近的箱子ID:"..nearId);
        openBag(nearId);        --可以使用openBox(nearId);试试..
else
        SetNotifyTip("未找到箱子.");
end

ceoguang 发表于 2011-3-27 08:31:14

这像D多过像E吧.
getObjxxxxx这些应该不是内置函数

yhxhappy 发表于 2011-3-27 12:17:12

易语言 不是中文的吗?

zitoy 发表于 2011-3-27 20:39:07

内置函数 不易转

5i5wei 发表于 2011-3-28 11:58:35

内置函数多了

haijie1223 发表于 2011-3-28 15:52:02

自己按照思路重新编写一个代码得了

papapa314 发表于 2011-3-28 15:57:47

呵呵,这个哪是易语言

guland 发表于 2011-3-28 21:31:48

简单而看不懂的语言=易语言{:1_402:}

hollandmfq 发表于 2014-5-13 14:56:26

雷锋精神传天下!谢谢分享!
页: [1]
查看完整版本: (易语言) 求翻译,怎么翻译成au3问题不重要了,当做(已解决)