For system variable like video_mode, video_depth : put
them inside a function and without the keyword "var".

For user define "global" variables like var myVar, yourVar... etc. put
them outside any functions just like usual. See an exammple from liteC
Workshop->Workdshop 23->script23.c.

I hope I can help to make it clear.