Quote: "if object in screen(8) = 1 and object position z(4) < 4800 and showobject = 0"
Be careful that db will interpret this in the desired order for you.
if a = 1 and b < c
This could be interpreted several ways:
if (a = 1) and (b < c)
if a = (1 and b) < c
if a = (1 and (b < c))
It's usually a good idea to play safe and surround your terms with brackets.
You don't actually need to specify the one here because the value of
object in screen(8) can only be 1 or 0, which is interpretted as TRUE or FALSE. So you can simply omit it:
if object in screen(8) and object position z(4} < 4800 and showobject = 0 then showobject = 1 : shownow = timer()
It seems like you are setting this "showobject" flag entirely based on the terms in this condition, therefore allow the condition to set the flag for you:
showobject = object in screen(8) * (object position z(4) < 4800)
I don't know what you are doing with the "shownow" timer but from what I see you could maintain it's function like so:
if showobject = 0 then shownow = timer()
showobject = object in screen(8) * (object position z(4) < 4800)
"shownow" is continually reset until showobject=1.