分享

【新提醒】请教DateDiff问题!!!!!!!!!!!

 淳爷们 2013-08-28
本帖最后由 laozha 于 2009-3-27 15:41 编辑

If DateDiff("s",t1,now)>=66
    VBS t1=now
    KeyPress 112 1
    Delay 10
EndIf 
If DateDiff("s",t2,now)>=41
    VBS t2=now
    KeyPress 113 1
    Delay 10
EndIf 
t3=now
If DateDiff("s",t3,now)>=7 
    VBS t3=now
    KeyPress 114 1
    Delay 10
EndIf 
If DateDiff("s",t4,now)>=12 
    VBS t4=now
    KeyPress 115 1
    Delay 10
EndIf 
If DateDiff("s",t5,now)>=24
    VBS t5=now
    KeyPress 51,1
    Delay 10
EndIf 

请大家指点我下,以上是我玩的游戏的技能,分别延迟以上时间才能使用。如何才能让他每间隔一定时间使用次技能?
上面不知道错在哪里。就是按个不停,根本不等设定的时间!
还有个很菜很菜的问题,按键执行命令是同时执行还是依次执行,如果是依次的话怎么才能让他同时执行多个命令,互不牵制。现在我弄了7-8个脚本一起运行才能达到我想要的效果,可是游戏就很卡了
呵呵~~~
请高人指点指点!!!!!!!!!

===========================================
你若想间隔一定时间做某个动作,如果你的脚本内容不够长,就必须有个循环。
而最初的时间必须定义在循环之外(前面)。

我不清楚你原来的脚本是什么样子的,你可以参考下面的。
其中,Rem 1 和 Goto 1 就是一个循环(当然也有别的方式循环)
t1=now
t2=now
Rem 1
If DateDiff("s",t1,now)>=66
    KeyPress 112 1
    Delay 10
    t1=now
EndIf 
If DateDiff("s",t2,now)>=41
    KeyPress 113 1
    Delay 10
    t2=now
    KeyPress 192,1
EndIf 
Delay 32
Goto 1

按键通常是按顺序执行的,当然也有跳转、循环和调用返回等。
若两段内容的间隔比较短,就可以认为是同时进行的。

新版本的按键,有多线程的功能,你可以了解一下。
===================================
前辈!我找的就是你!
谢谢你能来!
我的脚本内容技能部分是在中间,他的前面有找怪还有些其他动作,技能的后面还有找不到怪要做的动作。脚本是整个脚本一直循环!
前后面都有动作应该怎么做呢?
还有就是这样的话是不是互不影响啊?是不是各自记各自的时间的?

===================================

那没关系,只要你把首次计时的t1=now:t2=now放在最前面,不放在循环里面就可以了。
里面的
If DateDiff("s",t1,now)>=66
    KeyPress 112 1
    Delay 10
    t1=now
EndIf 
If DateDiff("s",t2,now)>=41
    KeyPress 113 1
    Delay 10
    t2=now
    KeyPress 192,1
EndIf 
还是这样写就成。
你既然分别定义了t1 t2,那就是分别计时,互不干扰。
=======================================================


t1=66
t2=41
t3=7
t4=12
t5=24
t6=12
Rem 开始
VBSCall FindColorEx(0,0,1024,670,"#0916EB",1,0.9,x,y)
If x>=0 and y>=0
    Goto 打怪
Else 
    Goto 找怪
EndIf 
Rem 打怪
MoveTo x+15 y+60
Delay 1
LeftClick 1
Delay 1
LeftClick 1
Delay 1
左键单击进行攻击
Delay 20
If DateDiff("s",t1,time)>=66   //F1黑魔咒
    //VBS t1=time
    KeyDown 112,1
    Delay 1000
    KeyUp 112,1
    Delay 10
    t1=time
    Delay 500
    KeyPress 192,1
EndIf 
If DateDiff("s",t2,time)>=41  // F2魂灵
    //VBS t2=time
    KeyDown 113,1
    Delay 1000
    KeyUp 113,1
    Delay 10
    t2=time
    Delay 10
    KeyPress 192,1
EndIf 
If DateDiff("s",t3,time)>=7       //F3魔灵
    //VBS t3=time
    KeyPress 114 1
    Delay 10
    t3=time
    Delay 10
    KeyPress 192,1
EndIf 
If DateDiff("s",t4,time)>=12     //F4束缚
    //VBS t4=time
    KeyPress 115 1
    Delay 10
    t4=time
    KeyPress 192,1
EndIf 
If DateDiff("s",t5,time)>=24     //3 旋魔
    //VBS t5=time
    KeyPress 51,1
    Delay 10
    t5=time
    Delay 10
    KeyPress 192,1
EndIf 
VBSCall FindColorEx(432,288,591,447,"#0916EB",1,0.9,x,y)
If x>=0 and y>=0
    If DateDiff("s",t6,time)>=12     //4 黑龙咒
        //VBS t6=time
        KeyPress 52,1
        Delay 10
        t6=time
        Delay 10
        KeyPress 192,1
    EndIf 
    Goto 开始
    Rem 找怪
    Delay 3000
    KeyDown 65,1
    KeyDown 83,1
    Delay 2200
    KeyUp 65,1
    KeyUp 83,1
    VBSCall FindColorEx(0,0,1024,715,"#0916EB",1,0.9,x,y)
    If x>=0 and y>=0
        Goto 打怪
    EndIf 
    Delay 3000
    KeyDown 68,1
    KeyDown 83,1
    Delay 1800
    KeyUp 68,1
    KeyUp 83,1
    VBSCall FindColorEx(0,0,1024,715,"#0916EB",1,0.9,x,y)
    If x>=0 and y>=0
        Goto 打怪
    EndIf 
    Goto 开始


按你说的这个做的看下对不对?
可是还是不行

===========================
看了很久,终于大概看懂了你的脚本。
你是不是想做成这样的:

找怪,找到后 就开始打怪,用了6种技能,分别按固定间隔发出技能,若此时怪还在,就继续发技能。
没怪,或怪死了,就循环找怪。

是不是?

我按上面我说的意思改了你的脚本(你的脚本中有些错误,比照看一下)

Rem 开始
youguai=0
Delay 3000
KeyDown 65,1
KeyDown 83,1
Delay 2200
KeyUp 65,1
KeyUp 83,1
VBSCall FindColorEx(0,0,1024,715,"0916EB",1,0.9,x,y)
If x>=0 and y>=0
    MoveTo x+15 y+60
    Delay 1
    LeftClick 1
    Delay 1
    LeftClick 1
    Delay 1
    //左键单击进行攻击
    t1=time:t2=time:t3=time:t4=time:t5=time:t6=time
    youguai=1
    Goto 打怪
EndIf 
Delay 3000
KeyDown 68,1
KeyDown 83,1
Delay 1800
KeyUp 68,1
KeyUp 83,1
VBSCall FindColorEx(0,0,1024,715,"0916EB",1,0.9,x,y)
If x>=0 and y>=0
    MoveTo x+15 y+60
    Delay 1
    LeftClick 1
    Delay 1
    LeftClick 1
    Delay 1
    //左键单击进行攻击
    t1=time:t2=time:t3=time:t4=time:t5=time:t6=time
    youguai=1
    Goto 打怪
EndIf 
Rem 打怪
If youguai=1
    Delay 20
    If DateDiff("s",t1,time)>=66
        //F1黑魔咒
        KeyDown 112,1
        Delay 1000
        KeyUp 112,1
        Delay 10
        t1=time
        Delay 500
        KeyPress 192,1
    EndIf 
    If DateDiff("s",t2,time)>=41
        // F2魂灵
        KeyDown 113,1
        Delay 1000
        KeyUp 113,1
        Delay 10
        t2=time
        Delay 10
        KeyPress 192,1
    EndIf 
    If DateDiff("s",t3,time)>=7
        //F3魔灵
        KeyPress 114 1
        Delay 10
        t3=time
        Delay 10
        KeyPress 192,1
    EndIf 
    If DateDiff("s",t4,time)>=12
        //F4束缚
        KeyPress 115 1
        Delay 10
        t4=time
        KeyPress 192,1
    EndIf 
    If DateDiff("s",t5,time)>=24
        //3 旋魔
        KeyPress 51,1
        Delay 10
        t5=time
        Delay 10
        KeyPress 192,1
    EndIf 
    If DateDiff("s",t6,time)>=12
        //4 黑龙咒
        KeyPress 52,1
        Delay 10
        t6=time
        Delay 10
        KeyPress 192,1
    EndIf 
    VBSCall FindColorEx(0,0,1024,715,"0916EB",1,0.9,x,y)
    If x>=0 and y>=0
        MoveTo x+15 y+60
        Delay 1
        LeftClick 1
        Delay 1
        LeftClick 1
        Delay 1
        //左键单击进行攻击
        youguai=1
        Goto 打怪
    EndIf 
EndIf 
Goto 开始

若不符合你的意愿,就把你想完成的过程说一下。
=================================
 前辈你理解对了
我就是这个意思!
我再发个最原来的
Rem 开始
VBSCall FindColorEx(0,0,1024,670,"#0916EB",1,0.9,x,y)
If x>=0 and y>=0  //这里证明找到怪,跳到打怪!
    Goto 打怪
Else 
    Goto 找怪   //没找到跳到找怪
EndIf 
Rem 打怪
MoveTo x+15 y+60  //因为是抓色找怪 抓的色是怪的名字 所以鼠标要偏移些
Delay 1
LeftClick 1  //鼠标左键单击就是物理攻击
Delay 1
LeftClick 1  //第二次是防止第一次没点上
Delay 1
左键单击进行攻击
Delay 20
If DateDiff("s",t1,time)>=66   //F1黑魔咒  //这里开始使用技能了同时也在物理攻击
    VBS t1=time
    KeyDown 112,1
    Delay 1000
    KeyUp 112,1
    Delay 500
    KeyPress 192,1
EndIf 
If DateDiff("s",t2,time)>=41  // F2魂灵  //都一样只是间隔时间不一样
    VBS t2=time
    KeyDown 113,1
    Delay 1000
    KeyUp 113,1
    Delay 500
    KeyPress 192,1
EndIf 
If DateDiff("s",t3,time)>=7       //F3魔灵
    VBS t3=time
    KeyPress 114 1
    Delay 10
    KeyPress 192,1
EndIf 
If DateDiff("s",t4,time)>=12     //F4束缚
    VBS t4=time
    KeyPress 115 1
    Delay 10
    KeyPress 192,1
EndIf 
If DateDiff("s",t5,time)>=24     //3 旋魔   //从这里以上都是远程攻击和加防的
    VBS t5=time  
    KeyPress 51,1
    Delay 10
    KeyPress 192,1
EndIf 
VBSCall FindColorEx(432,288,591,447,"#0916EB",1,0.9,x,y)
If x>=0 and y>=0
    If DateDiff("s",t6,time)>=12     //4 黑龙咒   //这个是近身攻击所以要在身边有怪的时候才使用
        VBS t6=time
        KeyPress 52,1
        Delay 10
        KeyPress 192,1
    EndIf 
    Goto 开始
    Rem 找怪   //找怪这里就是做简单的走动动作 找到怪就跳到打怪那里
    Delay 3000
    KeyDown 65,1   
    KeyDown 83,1
    Delay 2200
    KeyUp 65,1
    KeyUp 83,1
    VBSCall FindColorEx(0,0,1024,715,"#0916EB",1,0.9,x,y)
    //区域模煳找色  0,0,1024,768为区域范围 "FFFFFF"为颜色 1为查找方式(中间向外) 0.8为模煳值 x,y为找到颜色后的坐标变量
    If x>=0 and y>=0
        Goto 打怪
    EndIf 
    Delay 3000
    KeyDown 68,1
    KeyDown 83,1
    Delay 1800
    KeyUp 68,1
    KeyUp 83,1
    VBSCall FindColorEx(0,0,1024,715,"#0916EB",1,0.9,x,y)
    //区域模煳找色  0,0,1024,768为区域范围 "FFFFFF"为颜色 1为查找方式(中间向外) 0.8为模煳值 x,y为找到颜色后的坐标变量
    If x>=0 and y>=0
        Goto 打怪
    EndIf 
    Goto 开始

你那个和我这个还有些不一样
请你帮我解决下延时一定时间再使用技能!
我的问题就出在这里 其他的还可以 本帖最后由 我是新手 于 2011-1-16 22:46 编辑


 
其中有两个技能很烦人,就是一定要等到指定的时间才可以用。要是提前用的话上次的都失效了,而且接下来的一段时间内都用不了






    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多