iPLstate=0iLastTick = 0iTickCount = 0iPLtime=0sTimeOut=''iFontW=7iFontH=14 function myd3dsettext(nShowstate,strText,nAlpha) war3w = getwar3window() win3wl,win3wr,win3wt,win3wb = getclientrect(war3w) if((win3wr-win3wl)<790) then iFontW=5 elseif((win3wr-win3wl)>=790 and (win3wr-win3wl)<1010) then iFontW=6 else iFontW=7 end if nShowPosition==1 then x=(win3wr-win3wl)*0.553 y=(win3wb-win3wt)*0.045 end if nShowPosition==2 then x=(win3wr-win3wl)*0.02 y=(win3wb-win3wt)*0.7345 end if nShowPosition==3 then x=(win3wr-win3wl)*0.768 y=(win3wb-win3wt)*0.7525 end if nShowstate==0 then idSet, ridSet = d3dsettext(idSet, ridSet,strText, 1000, x, y, "宋体", fontColor, nAlpha, iFontW, 0, 500, 0, 0, 0,0,0) else idSet, ridSet = d3dsettext(idSet, ridSet,strText, 0, x, y, "宋体", fontColor, nAlpha, iFontW, 0, 500, 0, 0, 0,0,0) endend function runshowfunc() if 1==isplaying() then if 0==iPLstate then iPLstate=1 iLastTick = gettickcount() end iTickCount=gettickcount() iPLtime=tonumber(string.format('%d',(iTickCount-iLastTick)/1000)) if iPLtime>3600 then sTimeH=tonumber(string.format('%d',iPLtime/3600)) sTimeM=tonumber(string.format('%d',iPLtime/60))-sTimeH*60 sTimeS=iPLtime-(sTimeH*3600+sTimeM*60) sTimeOut=sTimeH..':'..sTimeM..':'..sTimeS elseif iPLtime>60 then sTimeM=tonumber(string.format('%d',iPLtime/60)) sTimeS=iPLtime-sTimeM*60 sTimeOut='00:'..sTimeM..':'..sTimeS elseif iPLtime>0 then sTimeOut='00:'..'00:'..iPLtime end if(sTimeOut~='') then sTimeOut = 'Used['..sTimeOut..'] Now['..os.date("%X",os.time{year=1970, month=1, day=1, hour=0})..']' end myd3dsettext(0,sTimeOut,255) else iPLstate=0 sTimeOut=' ' myd3dsettext(1,sTimeOut,255) endend settimer(1000, 'runshowfunc')
iPLstate=0 iLastTick = 0 iTickCount = 0 iPLtime=0sTimeOut='' iFontW=7iFontH=14 function myd3dsettext(nShowstate,strText,nAlpha) war3w = getwar3window() win3wl,win3wr,win3wt,win3wb = getclientrect(war3w) if((win3wr-win3wl)<790) then iFontW=5 elseif((win3wr-win3wl)>=790 and (win3wr-win3wl)<1010) then iFontW=6 else iFontW=7 end if nShowPosition==1 then x=(win3wr-win3wl)*0.553 y=(win3wb-win3wt)*0.045 end if nShowPosition==2 then x=(win3wr-win3wl)*0.02 y=(win3wb-win3wt)*0.7345 end if nShowPosition==3 then x=(win3wr-win3wl)*0.768 y=(win3wb-win3wt)*0.7525 end if nShowstate==0 then idSet, ridSet = d3dsettext(idSet, ridSet,strText, 1000, x, y, "宋体", fontColor, nAlpha, iFontW, 0, 500, 0, 0, 0,0,0) else idSet, ridSet = d3dsettext(idSet, ridSet,strText, 0, x, y, "宋体", fontColor, nAlpha, iFontW, 0, 500, 0, 0, 0,0,0) end end function runshowfunc() if 1==isplaying() then if 0==iPLstate then iPLstate=1 iLastTick = gettickcount() end iTickCount=gettickcount() iPLtime=tonumber(string.format('%d',(iTickCount-iLastTick)/1000)) if iPLtime>3600 then sTimeH=tonumber(string.format('%d',iPLtime/3600)) sTimeM=tonumber(string.format('%d',iPLtime/60))-sTimeH*60 sTimeS=iPLtime-(sTimeH*3600+sTimeM*60) sTimeOut=sTimeH..':'..sTimeM..':'..sTimeS elseif iPLtime>60 then sTimeM=tonumber(string.format('%d',iPLtime/60)) sTimeS=iPLtime-sTimeM*60 sTimeOut='00:'..sTimeM..':'..sTimeS elseif iPLtime>0 then sTimeOut='00:'..'00:'..iPLtime end if(sTimeOut~='') then sTimeOut = 'Used['..sTimeOut..'] Now['..os.date("%X",os.time{year=1970, month=1, day=1, hour=0})..']' end myd3dsettext(0,sTimeOut,255) else iPLstate=0 sTimeOut=' ' myd3dsettext(1,sTimeOut,255) end end settimer(1000, 'runshowfunc') -------------------------------------------------- 从某个脚本里翻出来的...