Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: NickyNyce on Thu 31/01/2013 15:39:22

Title: Gui and character names cant be the same?
Post by: NickyNyce on Thu 31/01/2013 15:39:22
this really isn't a big deal, but I noticed that a GUI name and a character's name can't be the same. Example....gEvil and cEvil. I was wondering why this is?

I also noticed at times....your object name will not auto pop up when typing in the room script sometimes. You need to go to the room and click on the object and then go back to the script and it will work fine. I'm guessing this occurs when switching rooms while scripting.

Again, not a big deal, but just wondering why these things happen.
Title: Re: Gui and character names cant be the same?
Post by: Gilbert on Thu 31/01/2013 18:45:49
I think it is the same reason as how you cannot have a String and an int both named BLAH at the same time.
Title: Re: Gui and character names cant be the same?
Post by: Crimson Wizard on Thu 31/01/2013 19:47:59
That's related to old-style object constants. For every (or most of) in-game objects there's a (integer?) constant created automatically, with name formed by removing first special character from script name and changing name to uppercase: CHAR1 for cChar1, GUI1 for gGui1, etc. So, if you make character cEvil and gui gEvil, they both will correspond to the same constant - EVIL.
I think these constants were supposed to be used in old non-OOP style functions, like NewRoom, MoveCharacter etc.

Interesting thing is, that you can call your character just Evil, and that will work...
Title: Re: Gui and character names cant be the same?
Post by: NickyNyce on Thu 31/01/2013 21:19:38
Interesting. Thanks for the quick and thorough explanation guys.