intfiction.org

The Interactive Fiction Community Forum
It is currently Tue Sep 16, 2014 2:23 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Wed Feb 15, 2012 10:06 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
In a previous episode, I was trying to switch the PC to another character. That has since been solved, thanks to Ben. But in pursuing that on my own, I've created a persistent weird compile error.

I was (mis)using "intialPlayerChar = ..." mid-game for this purpose.

It didn't work. Therefore I tried "gameMain.initialPlayerChar = ...."

That didn't work. Therefore I tried making a method in gameMain that would take a parameter and set the PC to the parameter. I figured that the gameMain object didn't like outside code fiddling with its data.

That didn't work, so I tried creating gameMain's PC assignment method inside a pre-game intialization code, on the theory I was getting to gameMain too late. That didn't work either -- turns out all of this was a red herring; could the intialPlayerChar documentation perhaps mention gPlayerChar? -- but now I have a weird compile error I can't clear.

It seems that I've somehow created an EXTRA gameMain object, that I CAN'T get rid of.

I've tried Build > Clean (Delete Derived Files), followed by Build > Full Recompile for Debugging.

The code I still have, commented out, is this --
Code:
/*
myInitObj: PreinitObject
   execute()
   {
    
    modify GameMainDef
            setPC (somePC)
    {
        initialPlayerChar = somePC;
        "hmmm... ";
    }

    }
;
*/


--doesn't mean this is the only version of that code I tried, but I don't think I did anything much outside of this.

Any thoughts?

Error message follows...

.....................................................................................................
Code:
>t3make -Fy "C:\Users\Conrad\Documents\TADS 3\obj" -Fo "C:\Users\Conrad\Documents\TADS 3\obj" -o "Amy`s Key_dbg.t3" -D "TADS_INCLUDE_NET" -D "LANGUAGE=en_us" -D "MESSAGESTYLE=neu" -v -d -statprefix <@> -statpct "Amy`s Key.t" "system.tl" "adv3\adv3web.tl" "webui.tl" "tadsnet.t" "other\scenes_ee.t" "AK_act1.t" "AK_act2.t" "AK_act3.t" "AK_verbs.t" -res "GameInfo.txt"
TADS Compiler 3.1.0  Copyright 1999, 2010 Michael J. Roberts
error: 
The symbol "showGoodbye", which was originally defined of type function, is
redefined with type property in object file "C:\Users\Conrad\Documents\TADS
3\obj\misc.t3o".  A global symbol can be defined only once in the entire
program.  You must change one of the symbol's names in one of your source files
to remove the conflict.

If you recently changed the meaning of this symbol,
you might simply need to do a full recompile - try building again with the -a
option.


error: 
The symbol "showIntro", which was originally defined of type function, is
redefined with type property in object file "C:\Users\Conrad\Documents\TADS
3\obj\misc.t3o".  A global symbol can be defined only once in the entire
program.  You must change one of the symbol's names in one of your source files
to remove the conflict.

If you recently changed the meaning of this symbol,
you might simply need to do a full recompile - try building again with the -a
option.


Errors:   2
Warnings: 0

t3make: error code 1

Build failed.

_________________
http://tiltedcandle.wordpress.com


Last edited by conradcook on Wed Feb 15, 2012 12:14 pm, edited 1 time in total.

Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 10:13 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
ps -- I can get rid of this message by commenting out the showIntro() and showGoodbye() code from gameMain.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 10:14 am 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 794
The code doesn't make any sense to me. You are trying to "modify" a method and you even do that inside another method? You can't modify methods or funtions, and you also can't define them inside other methods/functions.

Edit:
Btw, you will never be able to do this using initialPlayerChar. As the name of that property implies, it holds the *initial* player character. After initialization, that property is useless.


Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 10:26 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
RealNC wrote:
Btw, you will never be able to do this using initialPlayerChar. As the name of that property implies, it holds the *initial* player character. After initialization, that property is useless.


Yeah, that's been clarified to me, by Ben this time and by Eric a year ago. -- Is this documented anywhere? I couldn't find it, and I had a basic idea what to look for.

Quote:
The code doesn't make any sense to me. You are trying to "modify" a method and you even do that inside another method? You can't modify methods or funtions, and you also can't define them inside other methods/functions.


Heh, I won't say the code makes sense. It's been removed from the game now, but I still get the error -- apparently because it created some weirdly persistent object.

I *did* just try using modify before the posted version. In any case, the problem is not now to make the code work. The problem is to unbreak whatever mysterious thing inside the project got broken by my attempt to edit gameMain.

Conrad.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 10:34 am 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 794
Hmm, in case you found a compiler bug, try deleting the files by hand. Delete everything in the directory "C:\Users\Conrad\Documents\TADS 3\obj" and see if it helps. If yes, the "clean" functionality of the compiler has a bug. If it doesn't help, you still have definitions of showGoodbye() and showIntro() as functions somewhere in your code. Do a global search for them.


Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 10:40 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
RealNC wrote:
Hmm, in case you found a compiler bug, try deleting the files by hand. Delete everything in the directory "C:\Users\Conrad\Documents\TADS 3\obj" and see if it helps. If yes, the "clean" functionality of the compiler has a bug. If it doesn't help, you still have definitions of showGoodbye() and showIntro() as functions somewhere in your code. Do a global search for them.


I never wrote definitions for showGoodbye() or showIntro().

I'll delete TADS 3\obj files and see what happens. Almost doesn't matter at this point, as I've created a clean project and cut-pasted the code over. Which worked fine, by the way.


Conrad.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 10:42 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
Nope! Deleting the files had no effect -- the error persists.

I've got the cloned project working, so I'm out. Does anyone want to chase this down for the good of TADS? I can send you a zip.


Conrad.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 10:44 am 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 794
Yes, please do. You can PM it to me or send it to realnc@gmail.com if you don't want your WIP's source code going public.


Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 10:55 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
Public's not an issue. But I'll try to zip it up and mail it, as it's tidier.


Conrad.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
PostPosted: Wed Feb 15, 2012 12:13 pm 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
RealNC figured this out. Not a deep problem with T3, as it turns out, but a stray semicolon.

RealNC wrote:
I found the problem. You have this in your code:

Code:
gameMain: GameMainDef
    initialPlayerChar = me;


The semicolon ("me;") terminates the object definition. So when you try to define showIntro() after that, what you're doing is defining a function, not overriding the showInto() method of GameMainDef, which is why the compiler is giving an error.

Personally, I don't like the short syntax for defining objects and classes, because using a semicolon to terminate property overrides is very natural. I use this syntax instead:

Code:
gameMain: GameMainDef
{
    initialPlayerChar = me;
    showIntro()
    {
        // ...
    }
    someProperty = someValue;
}


Which IMO is much more intuitive since I can (and actually *must*) use semicolons after every property definition/override.


Many thanks, RealNC!

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group