rdfs:comment
| - function DelayCommand (float fSeconds, action aActionToDelay) Delay aActionToDelay by fSeconds.
* No return value, but if an error occurs, the log file will contain "DelayCommand failed.". It is suggested that functions which create effects should not be used as parameters to delayed actions. Instead, the effect should be created in the script and then passed into the action. For example: effect eDamage = EffectDamage(nDamage, DAMAGE_TYPE_MAGICAL); DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget); For example:
- The DelayCommand() NWScript command causes the indicated command (or function) to be executed after the indicated delay. The delay is a fixed number of seconds; in order to have a variable delay based upon certain actions completing, <a href="/mediawiki/ActionDoCommand" title="ActionDoCommand">ActionDoCommand</a>() should be used. Delayed commands are lost if the calling object does not exist when the delay is finished. (This can be gotten around by using <a href="/mediawiki/AssignCommand" title="AssignCommand">AssignCommand</a>() to assign the delay to a different object, often the module as returned by <a href="/mediawiki/GetModule" title="GetModule">GetModule</a>().)
|
abstract
| - function DelayCommand (float fSeconds, action aActionToDelay) Delay aActionToDelay by fSeconds.
* No return value, but if an error occurs, the log file will contain "DelayCommand failed.". It is suggested that functions which create effects should not be used as parameters to delayed actions. Instead, the effect should be created in the script and then passed into the action. For example: effect eDamage = EffectDamage(nDamage, DAMAGE_TYPE_MAGICAL); DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget); If you use a series of delay commands in a row, notice that the time is in seconds from the beginning, not from the last delay command. So, if you want something to happen at ten-second intervals, you need to have delays of 10, 20, 30, and so on, not a series of 10's. For example: DelayCommand(15.0, AssignCommand(oPraying,SpeakOneLinerConversation("ck_pray_maiden"))); DelayCommand(25.0, AssignCommand(oPraying,SpeakOneLinerConversation("ck_pray_mother"))); DelayCommand(35.0, AssignCommand(oPraying,SpeakOneLinerConversation("ck_pray_crone")));
* Return type: void
* Include file: nwscriptdefn
- The DelayCommand() NWScript command causes the indicated command (or function) to be executed after the indicated delay. The delay is a fixed number of seconds; in order to have a variable delay based upon certain actions completing, <a href="/mediawiki/ActionDoCommand" title="ActionDoCommand">ActionDoCommand</a>() should be used. Delayed commands are lost if the calling object does not exist when the delay is finished. (This can be gotten around by using <a href="/mediawiki/AssignCommand" title="AssignCommand">AssignCommand</a>() to assign the delay to a different object, often the module as returned by <a href="/mediawiki/GetModule" title="GetModule">GetModule</a>().) Delayed commands cannot be canceled (other than by destroying the calling object), but they can sometimes be lost under extreme server conditions (such as having thousands of concurrently delayed commands). Delayed commands are sometimes used to create pseudo-heartbeats, which in its most basic form involves a function that calls itself after a delay. Multiple delays of the same duration should not be relied upon if efficiency or the order of execution is important. Instead, those commands should be collected into a single function, and the function delayed.
|