Quote: "How did he get the state=10 at the end? I can only see 7 conditions and actions."
state=x is telling it what state the entity's script is in.
It is not a count of the actions or condidtions within a state and it can be 2, 6, 10, 30, etc.
For example...
:state=0:state=1
:state=1,plrwithinzone=1:state=2
:state=2,plrwithinzone=0:state=1
...as you can see we start at state=0, which is the initialization state.
In this example it simply tell the script to put the entity in a state of 1.
So, now the script will execute the line with the state=1 condition, because that is now true.
It will ignore the other lines because we are not in those states, so those lines first condidtion is not true, so those lines get ignored.
Now, in the line where state=1 was a condidtion, it was true so the script checks the next condition for the line, which is plrwithinzone=1.
If that condition is also true, then the script will execute the actions after the second colon, which in this case simply changes the state value again.
So, if the player is in the zone, then the state=2 action gets executed and now the script will run that line and ignore the others.
Really it is reading all the lines, but the others get ignored because their first condition (the state=x) is not true.
At this point the script's state value = 2 so since that condition is met it will check that lines next condition, which is plrwithinzone=0.
Now we stay in that state until the player leaves the zone, then that condition is also true and the actions after the colon would be executed.
Which in this example simply puts us back at state=1, so we loop.
This script does nothing but loop, so you would need more actions to make it do anything, but hopefully it is enough for you to grasp the use of the state=x condition.
Also, you can omit that condition for a stateless line like ...
:activated=1:activate=2,state=30
In this case the script would jump to state=30 if the activation is 1, regardless of whatever state it might be in since we had no state=x condition in the line.
Note that in this line example we also change the activation to 2 so the line will not become and endless loop and get stuck there.
I hope this helps.