This function enables evaluation of a simple mathematical string and the calculation of the average over the given number of @iterations.
Example:
if( %average( "5 + 1d20" ) > 10 ) { %echoTo( "This is a fine weapon indeed!", @actor ) } endif
Example:
if( %isValid( (@wielded = @actor->eq->wielded) ) ) \ && \ %itemIsTypeWeapon( @wielded ) ) { if( %average( @wielded->weapon->damageString ) > 10 ) { %echoTo( "This is a fine weapon indeed!", @actor ) } else { %echoTo( "This weapon could use some improvement!", @actor ) } endif } endif
Note: It is important that the mathematical string to be evaluated is a string or a string assigned to a variable. If it is not then the calculation will have already been performed and the average will be constant based on that initial value. |