For example, you simply need to create a function like this:
if ( ros_command(":put [:len [/ip firewall filter find where src-address=66.77.88.99]]") > 0
, ros_command("/ip firewall filter add action=accept chain=input dst-address=11.22.33.44 dst-port=8291 protocol=tcp src-address=66.77.88.99 place-before=([find]->0)")
, "rule exist"
)
However, obviously, it is difficult to explain "The Dude" from scratch.
That is a sample script, but if the script is written correctly, you can do anything...
ros_command("/ip firewall filter add action=accept chain=input dst-address=11.22.33.44 dst-port=8291 protocol=tcp src-address=66.77.88.99 place-before=([find]->0)")