Difference between revisions of "Client script"
From Dragon Age Toolset Wiki
BryanDerksen (Talk | contribs) (import from extranet) |
BryanDerksen (Talk | contribs) m (category) |
||
Line 12: | Line 12: | ||
{ | { | ||
LoadModule( "Sniff Test" ); | LoadModule( "Sniff Test" ); | ||
− | |||
PrintToScreen("Loading..."); | PrintToScreen("Loading..."); | ||
− | |||
WaitUntil( IsModuleLoaded() ); | WaitUntil( IsModuleLoaded() ); | ||
− | |||
PerformUseObject( oPlayer, oDoor ); | PerformUseObject( oPlayer, oDoor ); | ||
− | |||
WaitFor(10.0f); | WaitFor(10.0f); | ||
− | |||
if (GetDistanceBetweenObjects(oPlayer, oDoor) < 4.0f) | if (GetDistanceBetweenObjects(oPlayer, oDoor) < 4.0f) | ||
{ | { | ||
Line 27: | Line 22: | ||
} | } | ||
</code> | </code> | ||
+ | |||
+ | [[Category:Scripts]] |
Revision as of 12:55, 2 July 2009
Client Scripts are used to automate client behavior and are intended primarily for debugging use.
Client Scripting Wait Commands
The client scripting language supports 2 built in commands for pausing a script:
- void WaitFor(float fTime) - Pauses the script for fTime seconds
- void WaitUntil(int bCondition) - Pauses the script until bCondition == true
A script that is paused on a WaitUntil command will timeout after a default of 30 seconds. This time-out can be modified using the void SetWaitTimeout(float fTime) command.
void main()
{
LoadModule( "Sniff Test" ); PrintToScreen("Loading..."); WaitUntil( IsModuleLoaded() ); PerformUseObject( oPlayer, oDoor ); WaitFor(10.0f); if (GetDistanceBetweenObjects(oPlayer, oDoor) < 4.0f) { PrintToScreen("Player moved to door"); }
}