Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Grim on Wed 06/04/2016 10:59:41

Title: Variable already defined?... __Plugin100.ash -SOLVED- :)
Post by: Grim on Wed 06/04/2016 10:59:41
Please help!

I've been experimenting with the joystick plugin: http://www.adventuregamestudio.co.uk/forums/index.php?topic=41658.0. I've added it to my game and now I keep getting this error:

Failed to save room room6.crm; details below
__Plugin100.ash(51): Error (line 51): 'IsButtonDown' is already defined

The problem is, I don't have IsButtonPressed defined anywhere! What's _Plugin100 anyway? I can't find it. I've actually deleted all scripts and rooms hoping it was hidden in there somewhere and this error still shows up...

Any ideas, folks?...
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Danvzare on Wed 06/04/2016 11:10:59
You could always go into the actual game folder and delete the file __Plugin100.ash manually.
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Grim on Wed 06/04/2016 11:14:47
Quote from: Danvzare on Wed 06/04/2016 11:10:59
You could always go into the actual game folder and delete the file __Plugin100.ash manually.

It's not there.
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Gurok on Wed 06/04/2016 11:15:28
"__Plugin###.ash" are auto-generated script headers that AGS creates for plugins. Try rebuilding all files?
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Grim on Wed 06/04/2016 12:04:54
Quote from: Gurok on Wed 06/04/2016 11:15:28
"__Plugin###.ash" are auto-generated script headers that AGS creates for plugins. Try rebuilding all files?

I tried rebuilding several times. With the joystick plugin switched off, it rebuilds fine. With joystick on, it fails to rebuild, because of the error...
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Wyz on Wed 06/04/2016 12:45:38
Hmm I checked and this seems to be a problem of recent AGS versions. There is another struct that has the same function but those should not clash.  Hmm I guess I'm going to write a bug report on this. Which AGS version are you using?
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Grim on Wed 06/04/2016 12:53:30
Quote from: Wyz on Wed 06/04/2016 12:45:38
Hmm I checked and this seems to be a problem of recent AGS versions. There is another struct that has the same function but those should not clash.  Hmm I guess I'm going to write a bug report on this. Which AGS version are you using?

Version 3.3.0.
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Crimson Wizard on Wed 06/04/2016 13:49:46
Quote from: Grim on Wed 06/04/2016 12:53:30
Version 3.3.0.

This is very strange BTW, because I used joystick plugin many times with this version (and following updates).
I will try again.


E:I have made a simple game with joystick plugin, and it compiles fine in 3.3.0 - 3.3.5 and 3.4.0.6.

We would need an example of script (like the room that could not save) that causes this error.

Are you using other plugins, or script modules?
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Crimson Wizard on Wed 06/04/2016 14:38:50
Okay, I found WHEN it happens.

You need to have "Enforce object-oriented scripting" set to FALSE to make this error appear.

The conflict involves the global IsButtonDown function (which was obsolete since around AGS 2.72).

This error was in AGS for a very long time. If you have a function in global namespace, you cannot have struct function of same name.
The solution is to turn "Enforce object-oriented scripting" to TRUE (you might need to fix your scripts after that if you kept using obsolete functions).
We already had an issue in tracker about this: http://www.adventuregamestudio.co.uk/forums/index.php?issue=361.0
Title: Re: Variable already defined?... __Plugin100.ash
Post by: Grim on Wed 06/04/2016 15:13:41
Dude, you're awesome! :) :) That's totally what it was!!! :)

Now... I just have to figure out how to set up the scripts so it would work ;) But the stupid error is gone! Finally!!! :)