もしローカルのvar 変数を関数でやりたいなら
var hoge=3;
test(hoge)

別途スクリプト作成して
function test(_hoge){
show_debug_message(_hoge);
}