| 
 | 
 
go 是一个非常好用的方程,而且也是脚本基础。 
写起来简单又好用。给一个callback 函数让go执行完回调,然后再给目标地点信息即可 
 
我这里介绍一个毫无用途的小技巧,如何把go写个await 版本。 
 
- function await_go(area, room, sId) 
 
 -     local self = coroutine.running()
 
 -     local async_continue = function(...)       
 
 -         print("async resume")
 
 -         coroutine.resume(self, ...)
 
 -     end
 
 -     go(async_continue,area,room,sId)
 
 -     print("async yield")
 
 -     return coroutine.yield()
 
 - end
 
 
  复制代码 
 
使用例子 
- function huashan_start()
 
 -     map.rooms["village/zhongxin"].ways["northwest"] = "village/caidi"
 
 -     map.rooms["village/zhongxin"].ways["northeast"] = "village/caidi"
 
 -     DeleteTriggerGroup("all_fight")
 
 -     DeleteTriggerGroup("huashan_fight")
 
 -     DeleteTriggerGroup("huashan_cut")
 
 -     DeleteTriggerGroup("huashan_yls")
 
 -     DeleteTriggerGroup("huashan_yls_ask")
 
 -     DeleteTriggerGroup("huashan_over")
 
 -     DeleteTriggerGroup("huashan_find")
 
 -     flag.idle = nil
 
  
-     wait.make(function()
 
 -         await_go('华山', '正气堂')
 
 -         return hsaskjob()
 
 -     end)
 
 -     -- return go(hsaskjob, '华山', '正气堂')
 
 - end
 
  复制代码 
 
没啥太大用处,但是挺好玩的,希望大家喜欢 |   
 
评分
- 
1
查看全部评分 
 
- 
 
 
 
 
 |