weird compile error -- *resolved*

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... ";
}

}

;
*/[/code]

–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 “Amys Key_dbg.t3" -D "TADS_INCLUDE_NET" -D "LANGUAGE=en_us" -D "MESSAGESTYLE=neu" -v -d -statprefix <@> -statpct "Amys 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.[/code]

ps – I can get rid of this message by commenting out the showIntro() and showGoodbye() code from gameMain.

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.

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.

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.

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.

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.

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.

Public’s not an issue. But I’ll try to zip it up and mail it, as it’s tidier.

Conrad.

RealNC figured this out. Not a deep problem with T3, as it turns out, but a stray semicolon.

Many thanks, RealNC!

This thread solved a problem I was having while running through the TADS 3 “Quick Start Guide”.

Version 2 of the Burgler story had the showIntro() function below the gameMainDef. Placing it under the initialPlayerChar definition inside brackets as below solved the error. I knew the error was somehow involved with gameMain but I couldn’t find the solution until I read this thread.

Thanks, Jeff

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