No line can start with `ptre` as this is part of type specifier. Variable need start from keyword `var` and after that you put type and finally variable name.
e.g.
instead of
ptr GeoscapeSoldier inital_acc;
you need use
var ptr GeoscapeSoldier inital_acc;
but looking on rest of your code it looks like you do not want "solder" here but accuracy stat value.
And most of this values are `int` not "soldiers", this mean
var int inital_acc;
should be correct definition of used variable.
Another problem I see is that you copy paste part of other scripts, and you cut it in that place you have more `end;` lines that should be there looking on number of `if`.
side note, I recall plugin for Visual Studio Code that have basic validation for my script syntax (and rest of rule files), probably this would be helpful for you as error messages would be more precise.