But it won't compile. I made the exact same trigger using the GUI. But it just won't compile, it gives me a syntax error.
Am I doing something wrong? or is it bug?
I can think of two scenarios:
It's obvious that you copy/pasted the script from a previously GUI created trigger, so..
1) If you haven't removed the GUI trigger, then the compiler will probably complain that there's now functions with the same name (e.g. gt_Camp_Func would be once in the GUI trigger and once in the custom script). You can fix that by either renaming your GUI trigger or all functions in your script. See 2) for more problems if that's the case.
2) If you have removed the GUI trigger, then the compiler will probably complain that it can't find the variable gt_Camp (which is of type trigger). GUI created triggers all have a global trigger variable which contains the trigger:
gt_Camp=TriggerCreate("gt_Camp_Func");
In this line the trigger is created, but if there is no gt_Camp variable it'll give errors of course. You can fix that by creating this variable manually by adding this line as the first line of your custom script (the position doesn't really matter, but you generally put it at the top):
I'm pretty new to scripting and by looking to the script made by the GUI, I made this custom script:
But it won't compile. I made the exact same trigger using the GUI. But it just won't compile, it gives me a syntax error. Am I doing something wrong? or is it bug?
In which lines does it give you a syntax error?
I can think of two scenarios:
It's obvious that you copy/pasted the script from a previously GUI created trigger, so..
1) If you haven't removed the GUI trigger, then the compiler will probably complain that there's now functions with the same name (e.g. gt_Camp_Func would be once in the GUI trigger and once in the custom script). You can fix that by either renaming your GUI trigger or all functions in your script. See 2) for more problems if that's the case.
2) If you have removed the GUI trigger, then the compiler will probably complain that it can't find the variable gt_Camp (which is of type trigger). GUI created triggers all have a global trigger variable which contains the trigger:
In this line the trigger is created, but if there is no gt_Camp variable it'll give errors of course. You can fix that by creating this variable manually by adding this line as the first line of your custom script (the position doesn't really matter, but you generally put it at the top):