找回密码
 点一下
查看: 3567|回复: 11

[求教]一些本地函数的功能(Issue函数和触发器函数) (已解决)

[复制链接]
发表于 2006-4-3 19:02:58 | 显示全部楼层 |阅读模式
一些看起来和别的很类似的函数,但测试得不出所以然来;
Issue Order:
native IssueInstantPointOrder takes unit whichUnit, string order, real x, real y, widget instantTargetWidget returns boolean 等;比起平时用的多了"Instant",多了个参数,不知何解?
Trigger:
native TriggerExecuteWait takes trigger whichTrigger returns nothing 字面翻译起来..可实际上也不得其解;
native TriggerSyncReady takes nothing returns nothing
native TriggerSyncStart takes nothing returns nothing
native TriggerWaitOnSleeps takes trigger whichTrigger, boolean flag returns nothing这些BJ中都不曾引用过,莫非本身是当前没定义的空壳?
有的过得太久自己都忘记了..

[ 本帖最后由 zyl910 于 2006-4-24 01:01 编辑 ]
发表于 2006-4-3 21:08:46 | 显示全部楼层
1.IssueInstantPointOrder
不是很清楚
但看了一下定义,发现多了一个instantTargetWidget参数
我估计这命令对instantTargetWidget是立即有效的,然后再执行命令
[jass]
native IssuePointOrder              takes unit whichUnit, string order, real x, real y returns boolean
native IssueInstantPointOrder       takes unit whichUnit, string order, real x, real y, widget instantTargetWidget returns boolean

native IssuePointOrderById          takes unit whichUnit, integer order, real x, real y returns boolean
native IssueInstantPointOrderById   takes unit whichUnit, integer order, real x, real y, widget instantTargetWidget returns boolean

native IssueTargetOrder             takes unit whichUnit, string order, widget targetWidget returns boolean
native IssueInstantTargetOrder      takes unit whichUnit, string order, widget targetWidget, widget instantTargetWidget returns boolean

native IssueTargetOrderById         takes unit whichUnit, integer order, widget targetWidget returns boolean
native IssueInstantTargetOrderById  takes unit whichUnit, integer order, widget targetWidget, widget instantTargetWidget returns boolean
[/jass]


2.
这些都没用过
我估计它们的功能可能是:

TriggerExecuteWait:只是将该触发器加入就绪触发器队列,并不立即执行
TriggerSyncReady:已经准备好同步?
TriggerSyncStart:开始同步?
TriggerWaitOnSleeps:似乎是等待某个触发器进入休眠/执行状态,但不知道flag究竟代表 休眠 还是 执行
回复

使用道具 举报

发表于 2006-4-11 09:37:02 | 显示全部楼层
TriggerWaitOnSleeps
http://www.wc3campaigns.net/showthread.php?t=7783
Wait Info Discovery, Untested

ZellDominiko
12-22-2002, 05:03 PM    #5  

I haven\'t tested this and I don\'t think it\'s necessary to. Obviously these two triggers affect the Wait in triggers. The first one TriggerWaitOnSleeps takes a trigger and a boolean: false to disallow waits in a specified trigger, true to allow waits in a specified trigger. Similarly, IsTriggerWaitOnSleeps takes a trigger and returns a boolean: false if the specified trigger currently skips any waits, true if the specified trigger currently \"sleeps\" or \"pauses\" when it runs into a Wait action.



http://www.wc3campaigns.net/showthread.php?t=55851
What would TriggerWaitOnSleeps

weaaddar
05-23-2004, 02:08 AM    #2

this just means if the trigger ignores or accepts the sleep action command. if it doesn\'t wait on sleep it just keeps on churning. Default its on.


http://www.wc3jass.com/viewtopic.php?t=2726
PipeDream
Wed Mar 29, 2006 11:11 am

I tried to use this to measure game latency
[jass]
function GetHost takes nothing returns nothing
    local timer t = CreateTimer
    local real dt
    call TimerStart(t,20.,false,null)
    set dt = TimerGetElapsed(t)

    call StoreInteger(udg_MedalCache, \"Alpha\", \"Beta\", GetPlayerId(GetLocalPlayer()) + 1)
    call TriggerSyncStart()
    call SyncStoredInteger(udg_MedalCache, \"Alpha\", \"Beta\")
    call TriggerSyncReady()
    set udg_GameHost = Player(GetStoredInteger(udg_MedalCache, \"Alpha\", \"Beta\") - 1)
    call FlushStoredMission(udg_MedalCache,\"Alpha\")

    set dt = TimerGetElapsed(t) - dt        //dt is now max latency, I think
    call PauseTimer(t)
    call DestroyTimer(t)
    set t = null
    call DisplayTextToPlayer(GetLocalPlayer(),0,0,\"Game latency: \"+I2S(R2I(dt*1000))+\"ms\")
endfunction
[/jass]



also tried SyncSelections() instead of TriggerSyncStart/TriggerSyncReady()

Didn\'t work out. TriggerSyncStart/ready always consumed 500ms, SyncSelections() 250ms. Possibly all sync commands do a 250ms sleep and SyncStoredInteger really does sync by itself.

Anyone got other ideas?


http://www.wc3campaigns.net/showthread.php?t=57379
Unknown Functions

danny760311
06-13-2004, 07:29 PM    #1  

These are the functions in common.j that I hasn\'t known what they\'re doing...:( Could someone explain how to use them?


ExecuteFunc
TriggerWaitOnSleeps
IsTriggerWaitOnSleeps
TriggerExecuteWait
TriggerSyncStart
TriggerSyncReady


IssueInstantTargetOrder
IssueInstantTargetOrderById
(2 targets?? why??)


IssueNeutralImmediateOrder
IssueNeutralImmediateOrderById
IssueNeutralPointOrder
IssueNeutralPointOrderById
IssueNeutralTargetOrder
IssueNeutralTargetOrderById
(What\'s different from IssueImmediateOrder...??)

SyncStoredInteger
SyncStoredReal
SyncStoredUnit
SyncStoredString

FlushGameCache
FlushStoredMission
FlushStoredInteger
FlushStoredReal
FlushStoredBoolean
FlushStoredUnit
FlushStoredString
      

AIAndy
06-13-2004, 08:26 PM    #2  

ExecuteFunc allows you to call a function by its name as a string. That is very useful although it works only on takes nothing returns nothing functions. I use that for example in my class system to implement polymorphism.

IssueInstantTarget stuff is used for orders that actually require 2 targets. For example selling an item.
IssueNeutral stuff is for orders that require a player like orders to neutral buildings

the flush stuff deletes gamecache entries.
      


Cubasis
06-13-2004, 09:37 PM    #3  

The Sync functions synchronize the data saved in the file and the data in memory.

If a trigger is set not to WaitOnSleeps, then all TriggerSleepActions are ignored in it.

And I forgot what the other 3 trigger-functions did.


danny760311
06-13-2004, 10:04 PM    #4  

>IssueInstantTarget stuff is used for orders that actually require 2 targets. For example selling an item.

Uh...how to make a \"sellitem\" order???

>IssueNeutral stuff is for orders that require a player like orders to neutral buildings

Example??
      


danny760311
06-13-2004, 10:20 PM    #5  

>The Sync functions synchronize the data saved in the file and the data in memory.

What does it mean? I can\'t understand :(
      


Cubasis
06-13-2004, 10:25 PM    #6  

Before you run: SaveGameCache() - All game cache stuff is stored in memory... not on the hard drive. So when you run this function, all the stuff that is in memory, is now put into a file on the hard drive. After that is done, you can continue to change stuff in the game cache, but that won\'t affect the file, that will only affect the data in memory. So you have too manually update the file by either synchronizing a specific data by using one of these Sync functions, or run the SaveGameCache function again.

Note that this is also how you can use GameCache on Multiplayer, that is, you can do anything except run SaveGameCache or Sync functions.


AIAndy
06-14-2004, 05:44 AM    #7  

The order string for selling is \"dropitem\" and then one of the targets is the shop and the other the item.
call IssueNeutralImmediateOrderById(ai_player, buy_place, old_id[id])
That is from AMAI for buying a mercenary.
      


danny760311
06-15-2004, 10:51 PM    #8  

Well....I still can\'t figure out how to use IssueNeutral<xxx>Order...

What does the player matter??
      


Cubasis
06-15-2004, 10:53 PM    #9  

eh.

If you have a function that orders a shop to sell a unit. Then it must know which player should get the unit. The player parameter only discerns who\'s the buyer/user.




danny760311
06-22-2004, 01:24 PM    #10  

TriggerExecuteWait
TriggerSyncStart
TriggerSyncReady

Still don\'t know them...

Any1 has the idea?
      


AIAndy
06-22-2004, 02:18 PM    #11  

Quote from Brett Wood:

TriggerExecuteWait

native TriggerExecuteWait takes trigger whichTrigger returns nothing



Runs the given trigger in a special mode which affects all other triggers that have the \"wait on sleep\" property set. When this trigger sleeps (via TriggerSleepAction), all other triggers that have \"wait on sleep\" turned on will wait until this trigger stops sleeping and resumes execution before they also resume execution.

TriggerSyncStart
TriggerSyncReady

native TriggerSyncStart takes nothing returns nothing

native TriggerSyncReady takes nothing returns nothing



This pair of functions can be used to synchronize all players after performing asynchronous operations (such as loading files). Once TriggerSyncStart is called, execution will continue until TriggerSyncReady is called, and then wait until all other players have also called TriggerSyncReady before continuing.
回复

使用道具 举报

发表于 2006-4-11 10:53:29 | 显示全部楼层
楼上的天书。看不懂。
回复

使用道具 举报

发表于 2006-4-11 11:13:23 | 显示全部楼层
从wc3c搜到的的,我也看不太懂


TriggerWaitOnSleeps
this just means if the trigger ignores or accepts the sleep action command. if it doesn\'t wait on sleep it just keeps on churning. Default its on.
意思就是是否忽略或允许 TriggerSleepAction。if it doesn\'t wait on sleep it just keeps on churning。默认是打开的(true?)。


TriggerSyncStart
TriggerSyncRead
用于创建同步区域,那片区域内的代码在每个玩家机子上是同步执行的
http://www.wc3campaigns.net/showthread.php?t=64036

Guvante
09-01-2004, 12:47 AM    #2  
TriggerSyncStart and SyncReady are used for doing things like loading and saving, including the game cache and games themselves




TriggerExecuteWait
Runs the given trigger in a special mode which affects all other triggers that have the \"wait on sleep\" property set. When this trigger sleeps (via TriggerSleepAction), all other triggers that have \"wait on sleep\" turned on will wait until this trigger stops sleeping and resumes execution before they also resume execution.
???硬是看不懂
回复

使用道具 举报

发表于 2006-4-11 11:30:58 | 显示全部楼层
Instant,类似单位装箱之类的命令属于这一类.
回复

使用道具 举报

发表于 2006-4-11 11:35:23 | 显示全部楼层
说到同步,其实很多地方没比较,同步了反而断线。所以那2个函数确实比较鸡肋………………
回复

使用道具 举报

发表于 2006-4-11 11:38:08 | 显示全部楼层
TriggerExecuteWait
Runs the given trigger in a special mode which affects all other triggers that have the \"wait on sleep\" property set. When this trigger sleeps (via TriggerSleepAction), all other triggers that have \"wait on sleep\" turned on will wait until this trigger stops sleeping and resumes execution before they also resume execution.
???硬是看不懂

就是说TriggerExecuteWait(t0)了之后,如果t0里面出现sleep了,那么它不许别的trigger执行了,大家都得等着,直到t0 sleep完继续,大家才跟着继续。就是说,t0一sleep,就跟时间停止了一样。TriggerWaitOnSleeps为False的Trigger不受此影响。
以上为字面翻译。
回复

使用道具 举报

发表于 2006-4-11 11:40:11 | 显示全部楼层
其实最好的方法是,把blz自己的任务关地图的war3map.j全部解压缩出来,然后在里面搜,搜不到就别管了,搜得到就学一下。
回复

使用道具 举报

发表于 2006-4-11 11:40:27 | 显示全部楼层
TriggerExecuteWait,这个对于需要执行1000次以上步的T比较好,可以不用中途等待了。
回复

使用道具 举报

发表于 2006-4-11 13:04:07 | 显示全部楼层
原帖由 lars 于 2006-4-11 11:40 发表
其实最好的方法是,把blz自己的任务关地图的war3map.j全部解压缩出来,然后在里面搜,搜不到就别管了,搜得到就学一下。

嗯。有道理。
可是有蛮多的。。
回复

使用道具 举报

发表于 2006-4-24 01:01:53 | 显示全部楼层
已修改标题,以后请按照Jass区版规发帖子:
http://bbs.ourga.com/thread-947-1-1.html
Jass区导航贴
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 21:01 , Processed in 0.044731 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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