Script Only Stack Architecture

Richard Gaskin ambassador at fourthworld.com
Wed Mar 30 19:27:50 EDT 2016


On 03/30/2016 03:53 PM, Sannyasin Brahmanathaswami wrote:

> 1) create a script only stack. Save to disk and leave open call it
> "behavior-field-text.livecodescript)
> 2) create field; set behavior, aha! my new script only stack is available.
> 3) assign the stack to the field
...
> 4) lock field, click on field... nothing happens .... aaaahhh (blink)
>
> 5) go to the message box... on a hunch type
>
> "start using behavior-field-text.livecodesript"

"start using" is the command to start using a stack as a library, 
putting it globally into the back of the message path.  Since you're 
using these stack as a behavior script that's probably not what you want.

You can simply open the stacks (invisibly if you prefer), or you can 
load a stack file into memory by just querying any property within it, 
such as:

   get the name of stack "SomeStack"

Might be nice to have a "load stack" command, but for now even though 
the syntax may seem less intuitive the result is equally achievable.


NOTE: a long-standing source of confusion and frustration with behaviors 
is that the object holding the behavior script must be in memory when 
any stack containing objects subscribed to it is loaded.

When behaviors are in the same stack file the engine figures it out on 
its own.  But if the behaviors are in a separate stack file (regardless 
of whether it's script-only or normal) that separate stack file must be 
in memory first.

In some cases this can mean introducing a new stack only for the purpose 
of loading your others so that they load in an order that will allow 
behaviors to be resolved correctly.

Another option is to write a script that works on preOpenStack and walks 
through each object setting the object's behavior property to the 
object's behavior property, which forces resolution of the information 
already known to the engine but not loaded in the finicky order it requires.

A request to simplify this has been submitted:
<http://quality.livecode.com/show_bug.cgi?id=8993>



PS: Thanks for the CC, but if this was sent to the list I'm also a 
subscriber and will get a copy there.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list