Author Topic: Public Instances  (Read 1414 times)

0 Members and 1 Guest are viewing this topic.

Offline Nostalgic

Public Instances
« on: April 17, 2007, 02:21:17 PM »
I have a question of clarification.

The tutorial for SCI Studio says that procedures that are made public are available to all scripts.

There's also said to be a public modifier for instances but the tutorial says that this does not allow global access for instances. Rather, it says you would have to store the address of the instance in a global variable.

I'm curious then: what is the purpose of declaring an instance public?



Offline lskovlun

Re: Public Instances
« Reply #1 on: April 17, 2007, 03:27:09 PM »
Public instances are stored in something called an export table inside the script. This makes it possible for other scripts to retrieve a pointer to it by calling the ScriptID kernel function with a script number and export index as arguments. in addition, Sierra's own SCI compiler was able to generate ScriptID calls automatically. It is the lack of the latter feature that makes it necessary (or at least strongly recommended) to use a global variable. I reckon the processing time required by ScriptID was another reason "back in the day".

Offline Nostalgic

Re: Public Instances
« Reply #2 on: April 17, 2007, 04:26:08 PM »
Thank you. This information is very helpful. It's also information I highly doubt I would have come up with on my own, so I really appreciate it.


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.072 seconds with 24 queries.