Author Topic: Compiling script with yourself: [KQ5 CD]  (Read 5641 times)

0 Members and 1 Guest are viewing this topic.

Offline L@Zar0

Compiling script with yourself: [KQ5 CD]
« on: November 16, 2024, 03:29:35 PM »
Hi again. I'm trying to compile the script CodeCue.sc from KQ5 CD. When decompiled it has a Prop called "yourself:". But I can not compile the script with it, and I don't know if there is any alternative to this:



I can use "self" directly, but I don't know if it is the same, apart the game crashes when using it. I'm using SCI Companion 3.0.1.7 for this.

Any help would be appreciated.



Offline Kawa

Re: Compiling script with yourself: [KQ5 CD]
« Reply #1 on: November 16, 2024, 04:01:00 PM »
self and yourself: are not the same. The simple fact one of them is bold and blue and the other is thin and pink should say that well enough.

self has no colon, for it is not a selector (object method or property), but a keyword referring to the object this method is all about (theBackground I guess).

yourself: is a method implemented by the Obj class, which all other classes inherit from. All it does is return a reference/pointer/whatchamacallit to whatever object you called yourself: on.

So first it init-ializes theBust, then returns a reference to said bust to use as an argument for Talker::init, which indeed wants a bust, prop (eyes), and synchronized prop (mouth) in that order.

Therefore, if you replace it with self like you considered, you'll get theBackground where you're supposed to have theBust, theEyes, and theMouth.

The problem then becomes why does SCI Companion's compiler not realize these portrait elements have a yourself method? They should inherit that down the chain.

I mean, you could rewrite it, initialize the parts before calling super init, and then just do (super init: theBust theEyes theMouth local0 0 0 (if local8 0 else 1) talkerObject) but that won't solve the real puzzle.

Offline L@Zar0

Re: Compiling script with yourself: [KQ5 CD]
« Reply #2 on: November 16, 2024, 04:43:16 PM »
I see that the bust, eyes and mouth are Props.



I saw Prop is a class of View in Actor.sc, then View is a class of Feature, and then Feature is a class of Obj, which has (Obj) the yourself method (very simple definition).

So, is the method inherited after the definition of all this classes? If it is, I assume the compiler has an issue, right?

In any case, I can compile correctly AND working CodeCue.sc using the assembler code in that script (specifically the init method only). But I'm encountering some parts impossible to compile if I use decompiled code and I need to use the disassembled code for it to work (cdIntro5.sc is another script where I had to use disassembled code).

« Last Edit: November 16, 2024, 04:56:50 PM by L@Zar0 »

Offline lskovlun

Re: Compiling script with yourself: [KQ5 CD]
« Reply #3 on: November 16, 2024, 07:36:01 PM »
Maybe things got compiled in the wrong order. Original SCI lacks a linker phase, while Companion does have a linker phase. Subtle bugs could arise due to this. You could try recompiling some of the base classes, tweak the order a bit and see if that helps.

(There are places in the SCI class library where they had to work around the lack of a linker phase; they test for class inheritance at runtime using respondsTo: instead of isKindOf:, which would be more natural)

Offline L@Zar0

Re: Compiling script with yourself: [KQ5 CD]
« Reply #4 on: November 17, 2024, 05:10:08 AM »
Amazing. That seems to be a good tip. I put the method "yourself" in Obj BEFORE the "init" method, and it seems to work well now. :O



I hope this change doesn't break anything.

Offline Kawa

Re: Compiling script with yourself: [KQ5 CD]
« Reply #5 on: November 17, 2024, 05:49:40 AM »
It shouldn't even change anything. The intent was to recompile System without any further changes so that SCI Companion's link phase would be properly informed.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.131 seconds with 22 queries.