Author Topic: Original SCI syntax  (Read 69918 times)

0 Members and 1 Guest are viewing this topic.

Offline troflip

Re: Original SCI syntax
« Reply #135 on: June 11, 2015, 02:29:37 PM »
No, the two statements don't do the same thing. The second statement sets the value of the selector property of theObj to whatever is between the parentheses (maybe, if &rest works with property messages; I'm not sure of that). The first statement executes the method (or gets/sets the property) of theObj given by the selector property of the executing object.

Not quite. In the proc999_7 I posted I had actually changed the var names for readability, but that just caused confusion. In either case, the intention is to call a selector that is only known at runtime.

Code: [Select]
(procedure public (proc999_7 param1 param2 param3) // param2 is a selector value (presumably only known at runtime)
    (send param1:param2(rest param3))
)

Why would the calling code use proc999_7? Only if there would otherwise be ambiguity in the syntax - or rather, if the variable name of the variable containing the selector value was actually a selector name.

With code like this:

Code: [Select]
(send myObj:myVarWithSelectorValue(stuff))

there's no point to using proc999_7, since myVarWithSelectorValue isn't a valid selector (so we know to use the value of the variable instead).

But if your code was:
Code: [Select]
(send myObj:selector(stuff))

"selector" is a valid selector (#535), so the compiler thinks the code is trying to set the value of the selector property on myObj. But the actual intent is to call a method on myObj, where the method selector is stored in the selector property of the current object. This code appears in the Slider class, which has a "selector" property.

The other usage is in Game:doit. In this case, the variable is "thePanelSelector", but this is a fabricated variable name from my decompiler. That suggests that whatever variable name was used in the original source code at this point conflicted with an actual selector name. So they needed to use proc999_7.

The conclusion to be drawn is that Sierra's syntax suffered from the same ambiguity as SCI Studio's syntax when it comes to invoking selectors that are only known at runtime (which answers a question I had posed earlier in this thread). Thus they required this little helper procedure.
« Last Edit: June 11, 2015, 02:31:28 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Collector

Re: Original SCI syntax
« Reply #136 on: May 06, 2016, 08:23:11 PM »
Did anyone decompile KQ6?
KQII Remake Pic

Offline Kawa

Re: Original SCI syntax
« Reply #137 on: May 06, 2016, 08:28:14 PM »
Several times, why?

Offline Collector

Re: Original SCI syntax
« Reply #138 on: May 06, 2016, 09:00:31 PM »
I thought so, but was not finding an attachment with it. Robert Lindsley was wanting to see it.
KQII Remake Pic

Offline MusicallyInspired

Re: Original SCI syntax
« Reply #139 on: May 06, 2016, 09:36:55 PM »
Whoever does it, make sure you decompile at least 3 times. I'm in the middle of reinstalling everything at the moment.
Brass Lantern Prop Competition

Offline Collector

Re: Original SCI syntax
« Reply #140 on: May 06, 2016, 09:57:05 PM »
As I said, I thought someone already had decompiled it and didn't want to bother if t already had been done.

You giving up on Win10?
KQII Remake Pic

Offline MusicallyInspired

Re: Original SCI syntax
« Reply #141 on: May 06, 2016, 10:09:00 PM »
No, still working it into submission. Actually, it's kind of worked me into submission. I screwed everything up by messing with file/folder ownerships. Never worked right since. I just have to get over the fact that I just can't put whatever I want in root C drive anymore. Not really any going back either seeing as when I reset Windows it removed the option to rollback (as it reinstalls from scratch rather than an upgrade).
Brass Lantern Prop Competition

Offline Kawa

Re: Original SCI syntax
« Reply #142 on: May 07, 2016, 11:20:29 AM »
I've got several recurring issues in my latest decompilation of KQ6 that I just made. Four times over. For example, edgeToRoom is not a property or method on type KQ6Room, or PROPERTY-ACCESS-IN-NON-METHOD in an assembly block. Got a few instances of invalid &rest uses, some duplicated case labels... I'd believe those first two may be related to the latest commit at this time? Considering how Rm totally has an edgeToRoom method and  KQ6Room is a kind of Rm...

Oh, here's the decomp in question, just for the hell of it.
« Last Edit: May 07, 2016, 11:22:01 AM by Kawa »

Offline Collector

Re: Original SCI syntax
« Reply #143 on: May 07, 2016, 11:49:29 AM »
I decompiled it last night, too. Curious thing is that when I decompiled without setting the names of the scripts it compiles without issues. If I decompile with script names set it results in many compiling errors. It would take a while to track down all of the errors.
KQII Remake Pic

Offline troflip

Re: Original SCI syntax
« Reply #144 on: May 07, 2016, 12:06:09 PM »
Is this KQ6 CD?

The invalid &rest's might need to be fixed up manually. It's the result of changes I made to the decompiler to be more accurate (it was sometimes generating incorrect code, which is worse than non-compiling code). If I can detect these situations and try to correct them, I will. Just not sure how much work that would be yet.

The duplicate cases is unavoidable, those are just bugs in Sierra's code. I can probably turn these into warnings so at least the script will compile.

The PROPERTY-ACCESS-IN-NON-METHOD should be easily fixable.
« Last Edit: May 07, 2016, 12:24:40 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Collector

Re: Original SCI syntax
« Reply #145 on: May 07, 2016, 01:03:35 PM »
I was decompiling the CD version.
KQII Remake Pic

Offline troflip

Re: Original SCI syntax
« Reply #146 on: May 07, 2016, 01:14:35 PM »
fyi, the PROPERTY-ACCESS-IN-NON-METHOD in at least some of these cases is happening inside public procedures that fallback to disassembly. They fallback because they are invalid pointers (and appear to be unused). That is, the export points into the middle of another function. So it's trying to decompile invalid code.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Collector

Re: Original SCI syntax
« Reply #147 on: May 07, 2016, 03:48:05 PM »
Why does it compile without error if the file names of the scripts are not set, i.e. "n000.sc" instead of "Main.sc"?
KQII Remake Pic

Offline troflip

Re: Original SCI syntax
« Reply #148 on: May 07, 2016, 05:23:41 PM »
I think you must be mistaken?
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Original SCI syntax
« Reply #149 on: May 07, 2016, 05:44:23 PM »
Mine was the diskette version, incidentally.


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

Page created in 0.024 seconds with 23 queries.