Author Topic: Original SCI syntax  (Read 184036 times)

0 Members and 1 Guest are viewing this topic.

Offline lance.ewing

Re: Original SCI syntax
« Reply #120 on: May 23, 2015, 06:23:10 PM »
Lars, I was taking a look at script 325 in PQ SWAT this morning and I can see what you mean about the source being quite different (perhaps unfinished) when compared to the compiled version.

I spent the last hour decompiling this method by hand from my copy of PQ SWAT. This is what I have:

Code: [Select]
(instance hitNineShot of Script
   (method (changeState newState)
      (switchto (= state newState)
         (
            (theGame handsOff:)
            (qualProd dispose:, delete:)
            (if (== (++ nineShotCntr) 9) ; Assume local21 is nineShotCntr
               (qualList dispose:) ; Assume local20 is qualList
               (Bset fQualifiedSniper) ; Assume 24 is fQualifiedSniper
               (ego awardMedal: 256)
               (= local43 1) ; ?????
               (curRoom newRoom: 320) ; Assume global2 is curroom (or curRoom if its a typo or an OCR error)
            else
               (messenger say: 0 0 88 0 self 320)       ; Assume 88 is QUAL-HIT-9-C and 0 is ALL
            )
         )

         (
            (messenger say: 0 0 89 0 self 320)          ; Assume 89 is QUAL-RELOAD-9-C and 0 is ALL
         )

         (
            (= qualList (List new:)) ; Assume local20 is qualList
            (qualProd setReal: qualProd 6)
            (theGame hands0n:) ; Assume global1 is called "theGame"
            (self dispose:)
         )
      )
   )
)

It is indeed quite different from the same code that appears on the Wayback Machine copies of Brian's web site:

http://web.archive.org/web/20050205191150/http://www.classicgaming.com/agisci/swatcode.shtml

But at the same time, it is recognisably the same method. So what are the likely explanations for these differences? We talked about some already but I'm keen for as many suggestions as we can get. I doubt that it was leaked code, because why would a single method be leaked? If it were leaked, we'd be more likely to see a whole Script file. So I'm still leaning towards the OCR theory, which might account for the syntax errors, inconsistencies and lower-cased vars.
« Last Edit: May 24, 2015, 07:09:10 PM by lance.ewing »

Offline Collector

Re: Original SCI syntax
« Reply #121 on: May 23, 2015, 06:26:47 PM »
The person that I was talking to that has the source to Freddy said that the HWM debug list was missing several things for Freddy.
KQII Remake Pic

Offline lance.ewing

Re: Original SCI syntax
« Reply #122 on: May 23, 2015, 06:37:58 PM »
Easy peasy, here you go...

Hey, thanks, I'm taking a look now...

Offline lance.ewing

Re: Original SCI syntax
« Reply #123 on: May 23, 2015, 06:44:42 PM »
The person that I was talking to that has the source to Freddy said that the HWM debug list was missing several things for Freddy.

HWM? Do you mean this list?

http://wiki.scummvm.org/index.php/SCI/Debug_Modes#Game_specific:_Freddy_Pharkas:_Frontier_Pharmacist

I've got it activated, and have been playing around with the Polygon Editor. I've managed to crash it once so far.

Offline lance.ewing

Re: Original SCI syntax
« Reply #124 on: May 23, 2015, 07:19:41 PM »
I produced this with the Dialog Editor:

Code: [Select]
; DialogEditor v1.0
; by Brian K. Hughes
(Print
posn: 217 113,
addTitle: {Testing 123},
font: 0,
addButton: 0 {button test} 3 3,
addText: {text} 3 3,
addText: {text} 3 3,
addIcon: 0 0 0 3 3,
addEdit: @str 5 3 3 {},
font: 2108,
width: 20,
addText: {text} 0 0,
init:
)

and this with the Polygon Editor:

Code: [Select]
; Polygon Editor 1.11
; Dynamic Obstacles : Picture 230
(curRoom addObstacle:
((Polygon new:)
type: PBarredAccess,
init: 0 0 319 0 319 124 281 124 281 110 205 110 168 113 151 74
147 74 147 114 134 114 129 105 51 105 51 78 37 78 37 105
0 105,
yourself:
)
((Polygon new:)
type: PBarredAccess,
init: 0 174 319 174 319 189 0 189,
yourself:
)
((Polygon new:)
type: PBarredAccess,
init: 131 114 145 133 111 125 103 134 64 123 64 108 75 108 76 114,
yourself:
)
((Polygon new:)
type: PBarredAccess,
init: 8 107 23 107 23 118 8 118,
yourself:
)
((Polygon new:)
type: PBarredAccess,
init: 302 109 302 122 283 122 283 109,
yourself:
)
((Polygon new:)
type: PBarredAccess,
init: 200 112 215 112 215 120 200 120,
yourself:
)
((Polygon new:)
type: PBarredAccess,
init: 243 111 258 111 258 120 243 120,
yourself:
)
((Polygon new:)
type: PBarredAccess,
init: 192 129 259 126 254 147 201 149 190 129,
yourself:
)
)

(altPolyList add:
((Polygon new:)
type: PBarredAccess,
init: 135 99 135 87 163 87 163 99,
yourself:
)
((Polygon new:)
type: PBarredAccess,
init: 28 103 28 100 57 100 57 103,
yourself:
)
)

As a side note, that "curRoom" global var confirms that the curroom in the PQ SWAT code is another example of the wrong case, which is a consistent error in the PQ SWAT code snippet. It is full of examples of the case being wrong and/or inconsistent.

Offline Collector

Re: Original SCI syntax
« Reply #125 on: May 23, 2015, 07:28:37 PM »
The person that I was talking to that has the source to Freddy said that the HWM debug list was missing several things for Freddy.

HWM? Do you mean this list?

http://wiki.scummvm.org/index.php/SCI/Debug_Modes#Game_specific:_Freddy_Pharkas:_Frontier_Pharmacist

I've got it activated, and have been playing around with the Polygon Editor. I've managed to crash it once so far.

Yes, I believe that Lars and Omer have collaborated to it. http://agisci.altervista.org/SDMFAQ094.TXT
KQII Remake Pic

Offline lance.ewing

Re: Original SCI syntax
« Reply #126 on: May 24, 2015, 04:15:52 AM »
But at the same time, it is recognisably the same method. So what are the likely explanations for these differences? We talked about some already but I'm keen for as many suggestions as we can get. I doubt that it was leaked code, because why would a single method be leaked? If it were leaked, we'd be more likely to see a whole Script file. So I'm still leaning towards the OCR theory, which might account for the syntax errors, inconsistencies and lower-cased vars.

I guess it could have been typed in by hand rather than OCR. The newState parameter is written in different cases, as is qualProd. Can OCR create inconsistent cases like that?

But if instead someone had typed this in by hand, then it might explain a few of the inconsistencies. I was thinking this when I was decompiling the same method by hand last night. I had initially typed in some inconsistent var names at the start.

If someone did originally type in the PQ SWAT code by hand, then that suggests that they didn't have the actual source to copy and paste from, otherwise the source would have been syntactically correct. So that feels to me like they were reading from something, such as a book or magazine, and typing it in.
« Last Edit: May 24, 2015, 05:04:12 AM by lance.ewing »

Offline HWM

Re: Original SCI syntax
« Reply #127 on: May 24, 2015, 04:11:58 PM »
The person that I was talking to that has the source to Freddy said that the HWM debug list was missing several things for Freddy.

Any ideas what they could be? It's possible since Freddy was one of the first covered in the list, and back then I purely based it on what was listed in the "debug help" screen, which I later discovered was not always correct and did not necessarily cover all options.

In later discoveries I did try to cover all by disassembling the scripts and checking for key codes, but I don't think the ones covered earlier were revised. I didn't bother with documenting the specific options such as the Polygon Editor, etc. as I thought they were rather straigthforward and a bit beyond the original scope of the document.

To weigh in on the SCI syntax discussion: I have some parts of Sierra fan/development sites (pre 2000) still backupped somewhere, that might contain some additional information on the SWAT code (as it was already out there around that time). Also I think I've encountered an example of code somewhere, other than the SWAT code, in a SCI release. The memory is vague; it might have been AGI instead. I do know for sure that there are portions of the official AGI specs by Sierra and even assembly code of the AGI interpreter included with some AGI release(s).

Offline lance.ewing

Re: Original SCI syntax
« Reply #128 on: May 24, 2015, 05:33:39 PM »
Yeah, if you do find something in those old files that mentions where the PQ SWAT code originally came from, that would be great. I was probably told at some point but I just can't remember.

There is sample AGI code in The Official Book of King's Quest that you might be remembering. Everyone thinks of that one when they think of code examples.

Wow, I'd be very keen to know what AGI releases contained portions of the official AGI specs and assembly code. I'd never heard of that before. Can you track that down?

Offline Collector

Re: Original SCI syntax
« Reply #129 on: May 24, 2015, 10:10:07 PM »
HWM wow, everybody has been resurfacing.

Any ideas what they could be? It's possible since Freddy was one of the first covered in the list, and back then I purely based it on what was listed in the "debug help" screen, which I later discovered was not always correct and did not necessarily cover all options.

Unfortunately no. He has the entire source for Freddy on CD that he recently checked to see if it was still readable. He mentioned the debug modes and the magic files. I said what the files were and linked to the AGI Wiki debug page which is based on your list. That is when he said it was missing things. I asked him if it would be possible to see a sample of the code and he disappeared from the scene.
KQII Remake Pic

Offline lance.ewing

Re: Original SCI syntax
« Reply #130 on: May 25, 2015, 04:13:03 AM »
If we compare troflips decompiled scripts with what is in on the debug page, we should be able to spot if something is missing. I haven't had a chance to look at it in detail yet. A quick skim over it and it looks like there are cases in there that are empty, which is a bit strange. Maybe the debug script itself is missing things. Maybe they commented bits of code in an out depending on what they were doing at the time.

Offline Collector

Re: Original SCI syntax
« Reply #131 on: May 25, 2015, 10:53:04 AM »
I would expect that the code he had was from development, so it may have debugging that was removed for the release.
KQII Remake Pic

Offline HWM

Re: Original SCI syntax
« Reply #132 on: May 30, 2015, 07:44:12 PM »
Yeah, if you do find something in those old files that mentions where the PQ SWAT code originally came from, that would be great. I was probably told at some point but I just can't remember.

There is sample AGI code in The Official Book of King's Quest that you might be remembering. Everyone thinks of that one when they think of code examples.

Wow, I'd be very keen to know what AGI releases contained portions of the official AGI specs and assembly code. I'd never heard of that before. Can you track that down?

No leads (yet) on the SWAT code, but I did manage to track the AGI specs portions down. I remembered I had copied them off the disk(s), back when their existence was mentioned in a thread on the old MT/AGIgames board. I'm not sure which release it was; it might have been the original LSL release.

Since it's somewhat off-topic I've created a new thread for it: http://sciprogramming.com/community/index.php?topic=1418.0

Offline troflip

Re: Original SCI syntax
« Reply #133 on: June 11, 2015, 12:24:10 PM »
Another possible syntax clue? The SQ5 code has the following in Obj.sc:

Code: [Select]
(procedure public (proc999_7 param1 param2 param3)
    (send param1:param2(rest param3))
)

This seems like a completely pointless function. It's used in (for example) Slider.sc:
Code: [Select]
proc999_7(theObj selector rest param1)

which could of course have easily been written:

Code: [Select]
(send theObj:selector(rest param1))

since the SCI Studio syntax allows using variable names as selector values. But maybe the fact that they have this proc999_7 at all suggests that the original Sierra syntax to do this was more verbose/ugly. Or rather, that there was no syntax for it, and it had to be written in asm?
« Last Edit: June 11, 2015, 12:32:10 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline lskovlun

Re: Original SCI syntax
« Reply #134 on: June 11, 2015, 01:20:24 PM »
This seems like a completely pointless function. It's used in (for example) Slider.sc:
Code: [Select]
proc999_7(theObj selector rest param1)

which could of course have easily been written:

Code: [Select]
(send theObj:selector(rest param1))
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. To elaborate on the syntactical ideas developed in this thread, I guess the compiler might have allowed a syntax like
Code: [Select]
(theObj (self selector?): &rest)
but if it did, this function would indeed be pointless. There is also the matter of getting in the right position to use &rest.


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

Page created in 0.06 seconds with 23 queries.