找回密码
 点一下
查看: 2285|回复: 13

一段聊天纪录以及一个问题

[复制链接]
发表于 2008-5-16 18:44:47 | 显示全部楼层 |阅读模式
[codes=jass]
Narz 18:35:07
call TimerStart(t,x,false, function RunCode )
言灵 18:35:11
不然不能call EndTimer(t)

Narz 18:35:25
call TimerStart(t,x,false, function RunCode )
这个最后一个参数就是code
言灵 18:35:40
那样就要在每个code后面加上call EndTimer(t)

Narz 18:35:51
那又怎样?
言灵 18:35:57
多麻烦啊

Narz 18:36:05
您想出办法可以不加吗?
言灵 18:36:11
function RunCode takes nothing returns nothing
local timer t = GetExpiredTimer()
local code c = I2C(GetStoredInteger(udg_Cache,"Function","Code"))

call EndTimer(t)
endfunction

function TimerRunCode takes real x , code s returns nothing
local timer t=CreateTimer()
call StoreInteger(udg_Cache,"Function","Code", C2I(s))
call TimerStart(t,x,false, function RunCode )
set t = null
endfunction

言灵 18:36:22
如果能找个办法call一下

言灵 18:36:26
就不用了

Narz 18:36:32
比如
Narz 18:36:42
您的理想状态
Narz 18:36:53
说说i
Narz 18:36:58
我看能否实现
言灵 18:37:09
你看上面那函数就是

Narz 18:37:19
我什么都没看出来
言灵 18:37:38
call TimerRunCode(real ,code)

言灵 18:37:41
就可以了

Narz 18:37:52
嗯……就可以怎样……?
Narz 18:38:02

言灵 18:38:09
不用再在code后面加call EndTimer(t)

言灵 18:38:18
不然需要加很多

Narz 18:38:35
那没办法
Narz 18:38:46
C2I(s)这个根本就行不通的
Narz 18:39:01
code变量是不支持用整数保存的
言灵 18:39:13
= =
[/codes]



==============================
那么以上说的那个问题
如果不用整数保存
有可能达到吗?
 楼主| 发表于 2008-5-16 18:47:34 | 显示全部楼层
[codes=jass]globals

gamecache              udg_Cache
code                   udg_c         = null

endglobals


function H2I takes handle h returns integer
      return h
      return 0
endfunction

function I2TG takes integer i returns trigger
      return i
      return null
endfunction

function I2TC takes integer i returns triggercondition
      return i
      return null
endfunction

function I2TA takes integer i returns triggeraction
      return i
      return null
endfunction

function C2I takes code c returns integer
    return c
    return 0
endfunction

function I2C takes integer i returns code
    return i
    return null
endfunction

//以上为储存的rt bug函数



function EndTimer takes timer t returns nothing
local timer t = GetExpiredTimer()
call PauseTimer(t)
call DestroyTimer(t)
set t= null
endfunction

function RunCode takes nothing returns nothing
local timer t = GetExpiredTimer()
local code c = I2C(GetStoredInteger(udg_Cache,"Function","Code"))

call EndTimer(t)
endfunction

function TimerRunCode takes real x , code s returns nothing
local timer t=CreateTimer()
call StoreInteger(udg_Cache,"Function","Code", C2I(s))
call TimerStart(t,x,false, function RunCode )
set t = null
endfunction


function loopX takes code func ,integer x returns integer i
local integer i = 1
loop
exitwhen i > x
call TimerRunCode(0,func)
set i = i + 1
return i
endloop
endfunction[/codes]


保存一下
回复

使用道具 举报

发表于 2008-5-16 18:51:58 | 显示全部楼层
  [s:166]

保存一下??您好歹设个高亮吧~~~~
回复

使用道具 举报

 楼主| 发表于 2008-5-16 18:57:49 | 显示全部楼层
回LS
不会
回复

使用道具 举报

发表于 2008-5-16 18:59:44 | 显示全部楼层
引用第3楼280259078于2008-05-16 18:57发表的  :
回LS
不会

那好,偶教你,在代码前面加 [ jass]
代码后面加 [ /jass]
省略空格
回复

使用道具 举报

 楼主| 发表于 2008-5-16 19:08:25 | 显示全部楼层
真麻烦 就那么晾着吧
反正我这么看挺习惯的
回复

使用道具 举报

发表于 2008-5-16 19:09:54 | 显示全部楼层
把[之后的空格删掉就好了………………
回复

使用道具 举报

发表于 2008-5-16 19:12:26 | 显示全部楼层
你这段纪录没头没尾的~~

好好组织一下想问的问题再提问吧~~
回复

使用道具 举报

发表于 2008-5-16 19:14:15 | 显示全部楼层
囧,大囧~~~~~~~

jiong5.gif
回复

使用道具 举报

 楼主| 发表于 2008-5-16 20:23:50 | 显示全部楼层
引用第7楼Renee于2008-05-16 19:12发表的  :
你这段纪录没头没尾的~~

好好组织一下想问的问题再提问吧~~
问题不是很明显了。。。
就是做一个可以不用写很多endtimer的code函数。。。
回复

使用道具 举报

发表于 2008-5-16 23:53:34 | 显示全部楼层
endtimer是什么?
回复

使用道具 举报

发表于 2008-5-17 17:53:14 | 显示全部楼层
我看不出Endtimer在这段Jass里有什么作用。而且在我所做的地图里还没有碰到过需要频繁DestroyTimer的情况,对于计时器,最好是用全局变量,在地图加载时就创建,不用时就停下来,再用就再开始,效率高,不需要频繁Create和Destroy.
回复

使用道具 举报

发表于 2008-5-19 09:34:41 | 显示全部楼层

JASS真的比T好用?这不是一种显摆的心理吗?
回复

使用道具 举报

发表于 2008-6-14 15:31:23 | 显示全部楼层

写得不错啊

文章写得真是漂亮。

---------------

代孕
代孕妈妈
代孕网
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-22 14:44 , Processed in 0.105004 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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