How do i make a raycasting for enemy ai?

How do i make script like
If distance to player > 1000 then
Throw a ray to player
If ray not touching wall or door then
Go to player.x() player.y()

I dont know how to make “if ray not touching wall or door”

Hi, there is a game example that includes the raycast and it uses a scene variable to track whether the raycast was in contact with a specific object or not. GDevelop 5