Aug 2

SC4中building轉prop批處理腳本(READER1.4)(LUA

Lrdcq , 2014/08/02 13:09 , 教程 , 閱讀(855) , Via 本站原創
如下腳本,粘貼到腳本運行框裏面針對滿是building的文件運行一次就可以了。。。展開見全文

--require("iuplua")
--require( "iupluacontrols" )
function reader.main (this)
        pos = reader:entries_GetHeadPosition()    
        while pos~=0 do
                entry,pos = reader:entries_GetNext(pos)
                flag = reader:entry_GetFlag(entry)  
                myT,myG,myI = reader:entry_GetTGI(entry)
                if (flag == 7) then
                        breakflag=0
                        exemplar = reader:ex_Decode(entry)
                        reader:ex_SetParentCohort(exemplar,dw1,dw2,dw3)
                        proppos = reader:exprop_GetHeadPosition(exemplar)  
                        while proppos~=0 do
                                exprop, proppos = reader:exprop_GetNext(exemplar,proppos)
                                desc,descname = reader:exprop_GetDesc(exprop)    
                                --print (desc..":"..descname)
                                if (desc == 0x00000010) then
                                        --type
                                        if (reader:exprop_GetValueStr(exprop)~='Buildings') then
                                                --print ("I have to break")
                                                breakflag = 1
                                                --reader:ex_Release(exemplar)
                                                break
                                        end
                                        reader:exprop_SetValue(exprop,0x0000001e)
                                elseif (desc == 0x00000020) then
                                        --name
                                        ptid = "0x"..string.format("%x",tostring(myT,"o"))
                                        pgid = "0x"..string.format("%x",tostring(myG+1,"o"))
                                        piid = "0x"..string.format("%x",tostring(myI,"o"))
                                        pname = "b2p_"..reader:exprop_GetValueStr(exprop)
                                        --res, pgid2,piid2,pname2 = iup.GetParam("B2P (Cancel to Next One)", nil,"GID:%s\nIID:%s\nProp Name:%s\n",pgid,piid ,pname)
                                        --if(not res) then
                                                --break
                                        --end
                                        reader:entry_SetTGI(entry,piid,pgid,ptid)
                                        reader:exprop_SetValue(exprop,pname)
                                        --reader:entry_SetTGI(entry,piid2,pgid2,ptid)
                                        --reader:exprop_SetValue(exprop,pname2)
                                elseif (desc == 0x27812810) then
                                        --size
                                elseif (desc >= 0x27812820 and desc <= 0x27812825) then
                                        --box
                                elseif (desc == 0x29244DB5) then
                                        --Flammability
                                        reader:exprop_SetValue(exprop,0x00)
                                elseif (desc == 0x49BEDA31) then
                                        --MaxFireStage
                                elseif (desc == 0xAA1DD397) then
                                        --zoom
                                        reader:exprop_SetDesc(exprop,0x0ABFC024)
                                        reader:exprop_SetValue(exprop, 0x0000001F)
                                elseif (desc == 0x0ABFC024) then
                                        --zoom
                                else
                                        reader:exprop_SetDesc(exprop,0xffffffff)
                                        --reader:exprop_Del(exemplar ,proppos)
                                end
                        end
                        if not (breakflag == 1) then
                                --add light
                                exprop = reader:exprop_Add(exemplar)
                                reader:exprop_SetDesc(exprop,0x4A9F188B)
                                reader:exprop_SetType(exprop,0xB00)
                                reader:exprop_SetRep(exprop,1)
                                reader:exprop_SetValue(exprop, 0x01)
                        end
                        reader:ex_Encode(entry,exemplar)
                end
        end
end

其中有一些廢棄的代碼(GUI相關的),需要iuplua庫支持,如果感興趣的話可以試試哦~smile
發表評論
暱稱   密碼   訪客無需密碼
網址   電郵