Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: HandsFree on Wed 23/11/2016 19:50:20

Title: variable already defined in _AutoGenerated.ash
Post by: HandsFree on Wed 23/11/2016 19:50:20
A hotspot is apparently already defined in _AutoGenerated.ash.
How can I fix that? What is _AutoGenerated.ash and where can I find/edit it?

thanks
Title: Re: variable already defined in _AutoGenerated.ash
Post by: Crimson Wizard on Wed 23/11/2016 19:59:25
"hotspot" is a global array of hotspots in the room, it is made for accessing hotspots by index. _AutoGenerated.ash is a built-in header created by AGS, you cannot modify it.
Title: Re: variable already defined in _AutoGenerated.ash
Post by: HandsFree on Wed 23/11/2016 20:26:04
So how do I get rid of this error? The game won't save anymore.
Title: Re: variable already defined in _AutoGenerated.ash
Post by: Crimson Wizard on Wed 23/11/2016 20:36:02
Quote from: HandsFree on Wed 23/11/2016 20:26:04
So how do I get rid of this error? The game won't save anymore.
There is probably a variable or object called "hotspot" in your game; you need to rename it to something else, because it conflicts with built-in AGS declaration.
Title: Re: variable already defined in _AutoGenerated.ash
Post by: HandsFree on Wed 23/11/2016 21:56:30
The variable is called hCrashSite and there's only one of it.
I can rename to something else I suppose, but why does the game not accept it?
Title: Re: variable already defined in _AutoGenerated.ash
Post by: Crimson Wizard on Wed 23/11/2016 22:14:51
Quote from: HandsFree on Wed 23/11/2016 21:56:30
The variable is called hCrashSite and there's only one of it.

Wait, what is the actual error message you are getting, and what line in your script does it refer to?
Title: Re: variable already defined in _AutoGenerated.ash
Post by: HandsFree on Thu 24/11/2016 17:12:41
Error (line 410): Variable 'hCrashSite' is already defined.
File: _AutoGenerated.ash.
Title: Re: variable already defined in _AutoGenerated.ash
Post by: Slasher on Thu 24/11/2016 17:21:09
Have you done an editor search for hCrashSite to see if more than one entry?



Title: Re: variable already defined in _AutoGenerated.ash
Post by: Crimson Wizard on Thu 24/11/2016 18:04:48
Oh, first I thought that "hotspot" word is causing this issue.

I made some tests and I found that it is easy to reproduce this bug: all you have to do is to create two objects, hotspots etc and give them the same name. For some reason AGS does not prevent this until you try to save the room or compile the game.

I suggest searching all your room elements to see if you created second hCrashSite somewhere.
Title: Re: variable already defined in _AutoGenerated.ash
Post by: HandsFree on Thu 24/11/2016 18:45:24
Yeah, sorry, there was another one. I was sure there wasn't but it appears I created one ages ago. :confused: