The very simple script below runs fine in the MacOS Script Editor but quietly dies when run in BTT as a blocking or not Applescript. No errors or anything, it just does nothing. I'm sure there's a simple explanation but for the life of me I can't see it. The problem seems to be with count of windows.
set nWindows to count of windows
display dialog "Window Count " & nWindows with title "xxxx"
I also think the script is missing some parts. The windows of what should be counted? If you run it like this in Script Editor I believe it would count the windows of the Script Editor. However when this is run inside the BTT Script Runner there wouldn't be any windows because the script runner itself is not scriptable and doesn't have any UI - possibly this throws an error then.
I think you need to specify the app you want to count the windows for - but it's hard to tell from this snippet. Something like
tell application "Finder"
set nWindows to count of windows
display dialog "Window Count " & nWindows with title "xxxx"
end tell
Additionally it needs to be run using the blocking action to be able to display UI.
You can also try to wrap it in a try catch to get the error that is thrown:
try
set nWindows to count of windows
display dialog "Window Count " & nWindows with title "xxxx"
on error errMsg
display dialog "ERROR: " & errMsg
end try