找回密码
 点一下
查看: 2420|回复: 3

某无聊做的东西~

[复制链接]
发表于 2008-6-19 01:25:15 | 显示全部楼层 |阅读模式
[jass]
function H2I takes handle H returns integer
    return H
    return 0
endfunction

function I2T takes integer I returns timer
    return I
    return null
endfunction

function I2U takes integer I returns unit
    return I
    return null
endfunction

function I2GC takes integer I returns gamecache
    return I
    return null
endfunction

function print takes nothing returns nothing
    local integer HOfItem
    local integer HOfItemV
    local gamecache GcOfS
    local timer t
    local unit who
    local item Item=GetEnumItem()
    local real x
    local real y
    local integer n
    if ( IsItemVisible(Item) == false ) then
        set HOfItem=GetItemUserData(Item)
        set GcOfS=I2GC(HOfItem)
        set HOfItemV=GetStoredInteger(GcOfS,"Item","int")
        if HOfItemV==H2I(Item) then
            set n=GetStoredInteger(GcOfS,"Timer","int")
            set t=I2T(GetStoredInteger(GcOfS,"Timer","H"))
            set who=I2U(GetStoredInteger(GcOfS,"Unit","int"))
            set x=GetUnitX(who)+5
            set y=GetUnitX(who)+5
            set n=n+1
            call SetUnitX(who,x)
            call SetUnitX(who,y)
            call StoreReal(GcOfS,"Unit","x",x)
            call StoreReal(GcOfS,"Unit","y",y)
            call StoreInteger(GcOfS,"Timer","int",n)
        endif
    endif
    if n>30 then
        call RemoveItem( Item )
        set n=0
        call StoreInteger(GcOfS,"Timer","int",n)
        call PauseTimer(t)
        call DestroyTimer(t)
        call FlushGameCache( GcOfS )
    endif
    set GcOfS=null
endfunction

function TmCode takes nothing returns nothing
    call EnumItemsInRect(GetPlayableMapRect(),null,function print)
endfunction

function startOO takes unit who returns nothing
    local item ItemForCache
    local integer HOfItem
    local gamecache GcOfS
    local integer HOfUnit
    local string SOfUnit
    local real xOfUnit=GetUnitX(who)
    local real yOfUnit=GetUnitY(who)
    local timer T=CreateTimer()
    set SOfUnit=I2S(H2I(who))+".w3v"
    set GcOfS = InitGameCache(SOfUnit)
    set ItemForCache = CreateItem('kybl', 0, 0)
    call SetItemVisibleBJ( false, ItemForCache )
    set HOfItem=H2I(GcOfS)
    call SetItemUserData( ItemForCache, HOfItem )
    call StoreInteger(GcOfS,"Unit","int",H2I(who))
    call StoreInteger(GcOfS,"Item","int",H2I(ItemForCache))
    call DisplayTextToPlayer( Player(0), 0, 0,I2S(GetStoredInteger(GcOfS,"Item","int")) )
    call StoreReal(GcOfS,"Unit","x",xOfUnit)
    call StoreReal(GcOfS,"Unit","y",yOfUnit)
    call StoreInteger(GcOfS,"Timer","int",0)
    call StoreInteger(GcOfS,"Timer","H",H2I(T))
    call TimerStart(T,0.10,true,function TmCode)
endfunction
[/jass]

目的是想做个不用全局变量的 gamecache 不过现在的东西感觉还是在耍赖

还有高手不要说我渣

只是无聊啊~~~~~

演示1.w3x

19 KB, 下载次数: 17

发表于 2008-6-19 02:33:01 | 显示全部楼层
用物品...
真那啥..
回复

使用道具 举报

发表于 2008-6-19 09:48:22 | 显示全部楼层
但是,这个到了地图的缓存上限貌似就不能用了啊………………
回复

使用道具 举报

发表于 2008-6-19 19:51:24 | 显示全部楼层
所以说..
昨晚被马甲欺骗了我感情...

我还以为啥..
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-11-24 07:41 , Processed in 0.040654 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表