Difference between revisions of "Auto Assembler:createThreadAndWait"

From Cheat Engine
Jump to navigation Jump to search
m (Examples)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Assembler]]
 
[[Category:Assembler]]
'''Auto Assembler''' createThreadAndWait(''Address'', ''Timeout''OPTIONAL(7.1+) )
+
'''Auto Assembler''' createThreadAndWait(''Address'', ''Timeout'' OPTIONAL(7.1+) )
  
Will spawn a thread in the process at the specified address and wait till it returns.
+
Will spawn a thread in the process at the specified address and wait till it returns and then continues assembling the code after the createThreadAndWait command.
  
Timeout lets you specify the time to wait in milliseconds before giving an error, which is handy if the AA script runs in the main thread
+
Timeout lets you specify the time to wait in milliseconds before throwing an error, which is handy if the AA script runs in the main thread. If the timeout is missing, or smaller than 0, it will wait forever.
  
If the timeout is missing, 0 smaller, it will wait forever
+
'''Note:'''  In the case of CE 7.0 or earlier there was no timeout parameter, and the timeout is always set to 5000 ms (5 seconds). When you load a table made with CE 7.0 or earlier the behavior of AA scripts without a timeout parameter reverts back to 5000 instead of 0.
 
 
Note: In the case of CE 7.0 or earlier there was no timeout parameter, and the timeout is always set to 5000 (5 seconds)<br>
 
When you load a table made with CE 7.0 or earlier the behavior of AA scripts without a timeout parameter reverts back to 5000 instead of 0
 
  
  
Line 24: Line 21:
 
|string
 
|string
 
|The symbol or address to create the thread at
 
|The symbol or address to create the thread at
 +
|-
 +
|Timeout
 +
|integer
 +
|Optional timeout (in ms) waiting the launched thread before throwing an error
 
|}
 
|}
  
  
 
== Examples ==
 
== Examples ==
  createThreadAndWait(SomeSymbol)
+
  createThreadAndWait(SomeSymbol)    // launch a new thread at SomeSymbol and wait for 5 seconds (CE 7.0-)
  
 
  createThreadAndWait(00123ABC,0)
 
  createThreadAndWait(00123ABC,0)
  
 +
createThreadAndWait(MyThread,3000) // launch a new thread at MyThread and wait for 3 seconds (CE 7.1+)
  
 
== See also ==
 
== See also ==

Latest revision as of 15:13, 22 April 2022

Auto Assembler createThreadAndWait(Address, Timeout OPTIONAL(7.1+) )

Will spawn a thread in the process at the specified address and wait till it returns and then continues assembling the code after the createThreadAndWait command.

Timeout lets you specify the time to wait in milliseconds before throwing an error, which is handy if the AA script runs in the main thread. If the timeout is missing, or smaller than 0, it will wait forever.

Note: In the case of CE 7.0 or earlier there was no timeout parameter, and the timeout is always set to 5000 ms (5 seconds). When you load a table made with CE 7.0 or earlier the behavior of AA scripts without a timeout parameter reverts back to 5000 instead of 0.



Command Parameters[edit]

Parameter Type Description
Address string The symbol or address to create the thread at
Timeout integer Optional timeout (in ms) waiting the launched thread before throwing an error


Examples[edit]

createThreadAndWait(SomeSymbol)    // launch a new thread at SomeSymbol and wait for 5 seconds (CE 7.0-)
createThreadAndWait(00123ABC,0)
createThreadAndWait(MyThread,3000) // launch a new thread at MyThread and wait for 3 seconds (CE 7.1+)

See also[edit]

Related Commands[edit]