Author Topic: SCI Companion exporting instance definitions help.  (Read 1646 times)

0 Members and 1 Guest are viewing this topic.

Offline deckarep

SCI Companion exporting instance definitions help.
« on: October 09, 2023, 02:41:33 PM »
Hello,

Can someone please clarify check my understanding on using SCI Companion 3.0 to edit game resources.

It's obvious to me that I can use the Script editor and make a change to a method and export this change as a patch file.

But what's less clear is how to make a change to a property of an instance within the script? If I change a property, say a view number for example and then I export the script as a patch file the game doesn't see these types of changes.

I feel like this has something to do with SCI 1.1 games using the heap resource as well. So do i need to also export the heap file as a patch as well? Do I need to edit the heaps manually using a hex editor or will editing the script definition cascade the change to the heap?

I appreciate if anyone can shed light on this process as I know I can do anything with a hex editor but I want to avoid that in this case because my changes are more complicated now.

Thank you in advance!

-deckarep



Offline Kawa

Re: SCI Companion exporting instance definitions help.
« Reply #1 on: October 09, 2023, 03:03:47 PM »
Properties are part of the heap resource, yeah. So if you change a property but not anything in a method or procedure, you may well get away with only exporting the heap resource. On the flip side, the heap resources are still generated from the .SC files, by compiling them!

So say I want to replace a given room's picture, not by changing the picture resources themselves but by changing the room's properties.
Code: [Select]
(instance demoRoom of Room
(properties
picture 240
; more properties left out
)
(method (init)
; unsullied code
)
)
Let's say I extracted the script resource for this room and put it safely aside.

If I were to edit the .SC file to change that one line to picture 420 and compiled it, one of two things can happen:
If this were an SCI 0.x to SCI 1.0 game, without heap resources, I would extract the script resource again. Comparing this to the one put away, on a binary level should, if I were very lucky, reveal one change: 240 is now 420.
If this were an SCI 1.1 or later game, the script resource would, if I were as lucky, be exactly identical to the old one. Its matching heap however would have that one change.

The luck in this hypothetical situation boils down to small differences in how SCI Companion compiles things compared to Sierra's SC utility. That is all.

Offline deckarep

Re: SCI Companion exporting instance definitions help.
« Reply #2 on: October 09, 2023, 03:18:42 PM »
Thanks for the details this is exactly what I am looking for.

So just to be clear: if I am editing an SCI 1.1 game (which I know I am) and just generally editing sections of code that affect both methods and properties I just need to compile this one script and be sure to export both the .SCR and .HEP file and I should be covered?

ie, The act of compiling a SCRIPT indirectly takes care of updating the matching .HEP resource right?

I guess I didn't realize that the compiler also updated the HEP resources automatically but it makes sense.

Big thank you for your prompt reply!
« Last Edit: October 09, 2023, 03:28:55 PM by deckarep »

Offline Kawa

Re: SCI Companion exporting instance definitions help.
« Reply #3 on: October 09, 2023, 03:30:29 PM »
I was just writing a list of things that interact between scripts and heaps!

Things you certainly can't do to a heap without affecting its matching script:
  • Add or remove properties (you can only change their values)
  • Change the length of a near string (the ones stored in the heap instead of a text resource)
  • Change the length of an instance name (same reason)
  • Change the number of local variables

Things you probably can't do to a script without affecting the heap:
  • Make any change to a procedure or method that results in a different length of machine code (so changing a return value is okay, as is simple logic or math changes, but no adding or removing statements)

And don't forget: if you patch a given room's heap and reload a save in that room, that will include the heap as it was saved. This may break your game! If it doesn't, leave the room as soon as possible and hope there's no special "leave the room" Scripts that may be thrown off by the incongruity.

Offline deckarep

Re: SCI Companion exporting instance definitions help.
« Reply #4 on: October 09, 2023, 03:34:38 PM »
Ah, this is great insight and much appreciated.

I just discovered that my save game wasn't working due to observing this behavior. Now I know better!

Cheers Kawa!

-deckarep


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

Page created in 0.076 seconds with 22 queries.